An agent-supplemental-audit-node read-only execution control method and system
Patent Information
- Application Number
- CN202610658026.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-13
- Publication Date
- 2026-08-04
AI Technical Summary
[0004]本发明的目的是提供一种智能体补充审计节点的只读执行控制方法及系统,以解决补充审计节点场景下上下文漂移导致的越权继承、静态目录白名单过宽以及多来源路径漏检或重复校验等技术问题
1.通过在补充审计节点运行时实例化前执行上下文指纹匹配,并在失配时于不构造只读权限集的情况下直接取消启动,可减少无效补充审计节点进入权限派生、参数解析和路径校验流程带来的处理开销,并降低上下文漂移导致的越权继承风险。
Smart Images

Figure CN122508568A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of computer security control, command execution constraints, and agent auditing technology, and in particular relates to a read-only execution control method and system for agent supplementary audit nodes. Background Technology
[0002] In security operation and maintenance scenarios such as code repository auditing and host inspection, the current common working mode is "anomaly detection by the front-end audit node - triggering verification by the supplementary audit node". However, the existing technical system has significant shortcomings in the permission control and security verification of the supplementary audit node: First, there is a serious risk of context drift. Existing intelligent agent systems and containerized environments often directly use the permission scope and directory configuration of the front-end node without re-verifying the execution context before the supplementary audit node is started. When the working directory and environment variables change dynamically, the original permission boundaries are still inherited, which can easily lead to unauthorized operations. Second, the directory authorization boundaries lack dynamic adaptability. Existing solutions often use a static directory whitelist mechanism, which has an overly broad authorization scope and cannot dynamically generate the minimum necessary authorization boundaries for the supplementary audit node based on the actual access directory of the front-end node. The problem of permission redundancy is prominent. Third, there are integrity vulnerabilities in path verification. There is a lack of unified identification and verification logic for implicit paths such as the parameter section after the termination option in the command and the input / output redirection target. This often results in missed detections or duplicate verifications, making it difficult to cover all-dimensional path risks. Fourth, the granularity of permission control is insufficient. Authorization based solely on path strings, without constraining the identity of the file system object pointed to by the path, poses a risk of object-level permission drift. In summary, existing technologies lack a continuous control chain that builds a complete process around supplementary audit nodes, including "blocking before instantiation, dynamic boundary generation, and unified path verification during execution." In high-frequency dynamic audit scenarios, the security risk prevention and control capabilities can no longer meet actual needs.
[0003] In other words, existing command execution restriction schemes typically follow technical routes such as static directory control, mandatory access control, system call constraints, remote call authentication, or general parameter verification. Although they can provide access restriction capabilities at their respective levels, their control objects, authorization bases, and control timing do not form a fixed sequential dependency relationship around the supplementary audit node scenario. Even if existing technologies are combined, it is difficult to naturally obtain the continuous control chain scheme of "pre-instantiation blocking, dynamic authorization boundary generation, active environment variable purification, and kernel object anchoring based on directory file descriptors" in this invention. Summary of the Invention
[0004] The purpose of this invention is to provide a read-only execution control method and system for supplementary audit nodes of intelligent agents, so as to solve technical problems such as unauthorized inheritance caused by context drift, excessively wide static directory whitelists, and missed detection or duplicate verification of multiple source paths in the supplementary audit node scenario.
[0005] The core technical idea of this invention is to connect execution context fingerprint and ticket verification, dynamic compact authorization directory prefix generation, environment variable proactive purification, and relative path verification based on kernel file descriptors into a complete continuous defense closed loop, forming four major control chain schemes: timing locking, dynamic boundary, proactive purification, and kernel object anchoring.
[0006] The technical solution of this invention to solve the above-mentioned technical problems is as follows: A read-only execution control method for supplementing audit nodes in an intelligent agent, comprising: Obtain the execution results of the preceding audit nodes; When the exception flag meets the triggering conditions, a supplementary audit node insertion request is generated. Generate and match execution context fingerprints before instantiating supplementary audit nodes, and cancel startup if a mismatch occurs; During matching, the set of directories accessed by the preceding audit node and the preset set of read-only directories are processed to obtain a compact authorized directory prefix list, and a set of read-only permissions containing the compact authorized directory prefix list is assigned to the supplementary audit node; Before executing the candidate audit instruction, the parameter segment after the termination option is marked, the path parameter and the redirection target are uniformly extracted into a set of path entries to be verified, and path verification is performed based on the compact authorized directory prefix list; Execution will be blocked if an unauthorized path entry exists or output is redirected. When input redirection exists, perform path validation on the input redirection target. If the validation passes, execution is allowed to continue; if the validation fails, execution is blocked.
[0007] Preferably, the normalization process of the executed instruction sequence and the absolute path of the current working directory includes at least one of the following: eliminating irrelevant space differences, unifying the path separator format, expanding the relative path into an absolute path in conjunction with the corresponding working directory, and unifying the directory end separator format; the relative path in the candidate audit instruction is converted into an absolute path in conjunction with the current working directory before participating in path verification, and the "." and ".." path traversal symbols are parsed and eliminated during the path normalization process.
[0008] Preferably, the context items involved in generating the current execution context fingerprint and the initial execution context fingerprint also include a set of environment variables, which are sorted by variable name before being concatenated. Before the supplementary audit node is instantiated and after the compact licensed directory prefix list is generated, the system uses the compact licensed directory prefix list as the dynamic license boundary to actively clean high-risk environment variables in the execution environment. The active cleaning includes: extracting high-risk environment variables in the execution environment, which at least include executable file search paths and dynamic link library loading paths; extracting path entries contained in the high-risk environment variables, and using the dynamic license boundary represented by the compact licensed directory prefix list as the basis for filtering, eliminating, or rewriting for matching and verification. Path entries that exceed the license boundary represented by the compact licensed directory prefix list during the matching and verification will be forcibly filtered, eliminated, or rewritten from the high-risk environment variables.
[0009] Preferably, the compact authorized directory prefix list is generated by performing absolute path normalization, deduplication, and sorting on the set of directories accessed by the pre-audit node and the preset read-only directory set, and then finding their intersection, and deleting redundant directory entries covered by the parent directory prefix.
[0010] Preferably, after the compact authorized directory prefix list is generated, the system further records object identity identifiers for the directory prefixes in the compact authorized directory prefix list. The object identity identifiers include at least one or more of device identifiers, inode identifiers, and mount point identifiers. During the execution of the supplementary audit node, after the path to be accessed is normalized to an absolute path, its object identity identifier is first parsed and its consistency is verified with the object identity identifier recorded at the authorization boundary. After the object identity consistency verification is passed, the system calls the directory open interface to obtain and maintain the directory file descriptor of the corresponding directory prefix, so as to form an authorization benchmark anchored to the underlying system kernel.
[0011] Preferably, when generating the supplementary audit node insertion request, a single execution authorization ticket corresponding one-to-one with the supplementary audit node insertion request is simultaneously generated. The supplementary audit node insertion request identifier is determined by the current execution context fingerprint and the candidate audit instruction digest. The single execution authorization ticket is bound to the supplementary audit node insertion request identifier, the initial execution context fingerprint, the candidate audit instruction digest, and a random number, and optionally to the compact authorization directory prefix list digest, timestamp, and validity period. Before the supplementary audit node is instantiated, the single execution authorization ticket is validated. The supplementary audit node is allowed to enter the instantiation process only if the ticket has not been consumed, the ticket binding information is consistent with the current supplementary audit node insertion request, and the ticket validation passes. After the validation passes, the single execution authorization ticket is marked as consumed, deleted, or invalid.
[0012] Preferably, after acquiring and maintaining the directory file descriptor, the system continues to perform path resolution chain semantic verification on the path to be accessed; in the path resolution chain semantic verification and subsequent actual file access operations, the system forces relative path traversal and access to be initiated based on the maintained directory file descriptor; the path resolution chain semantic verification includes detecting whether symbolic link jumps, binding mount jumps, mount namespace switching, and cross mount point jumps occur in the resolution chain based on the relative path resolution, and directly blocking the execution of the candidate audit instruction when the resolution chain crosses the authorized root represented by the compact authorized directory prefix list, crosses the preset allowed mount boundary, or enters an unauthorized mount point.
[0013] A read-only execution system for intelligent agents to supplement audit nodes includes: a result receiving module, used to obtain the execution results of the previous audit nodes, which include anomaly markers, candidate audit instructions, and a set of directories accessed by the previous audit nodes; The triggering module is used to generate a supplementary audit node insertion request when the abnormality marker indicates an abnormal state and the command family to which the candidate audit instruction belongs is within a preset audit command family set; The context verification module is used to generate and verify the execution context fingerprint before the supplementary audit node is instantiated, and to cancel the startup of the supplementary audit node in case of mismatch. The authorization boundary generation module is used to generate a compact authorization directory prefix list when performing context fingerprint matching, and to allocate a read-only permission set containing the compact authorization directory prefix list to the supplementary audit node; The path verification module is used to uniformly extract the set of path entries to be verified corresponding to the parameter segment after the termination option mark, the path parameters, and the redirection target before the supplementary audit node executes the candidate audit instruction, and to perform path verification and path parsing chain semantic verification based on the compact authorized directory prefix list. The blocking module is used to block the execution of the candidate audit instruction or block the instantiation of the supplementary audit node when there is an unauthorized path entry, the candidate audit instruction contains output redirection, the input redirection target verification fails, or the single execution authorization ticket verification fails.
[0014] Preferably, the authorization boundary generation module is further used to record the object identity identifier corresponding to the compact authorization directory prefix list. The context verification module is further used to extract high-risk environment variables containing executable file search paths and dynamic link library loading paths, and perform filtering, elimination, or rewriting based on the compact authorization directory prefix list. It also verifies the validity of the single execution authorization ticket that corresponds one-to-one with the supplementary audit node insertion request. The path verification module is further used to obtain and maintain the directory file descriptor after the path prefix matching is successful and the object identity is consistent. It also initiates relative path resolution based on the directory file descriptor to detect whether symbolic link jumps, mount point crossings, or object identity drifts occur in the path resolution chain. The filtering, elimination, or rewriting of the high-risk environment variables, the acquisition of the directory file descriptor, and subsequent relative path resolution are all based on the authorization boundary represented by the compact authorization directory prefix list.
[0015] A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, a read-only execution control method for supplementing audit nodes of an intelligent agent is implemented.
[0016] Compared with the prior art, the technical solution of the present invention has the following significant differences: First, this invention does not use context information as a common authorization judgment field for comparison. Instead, it recalculates the execution context fingerprint before the supplementary audit node is instantiated at runtime and the read-only permission set is constructed, and uses whether it matches as a pre-gating condition for whether the supplementary audit node can enter the subsequent execution chain.
[0017] Second, this invention does not directly use the preset read-only directory whitelist, nor does it simply inherit the set of directories accessed by the preceding node. Instead, it performs absolute path normalization, deduplication, and sorting on the two types of directory sets respectively, and then finds their intersection. Finally, it performs prefix overlay deduplication on the intersection result to obtain a compact authorized directory prefix list exclusive to the current supplementary audit node.
[0018] Third, instead of establishing separate distributed verification branches for explicit path parameters, parameter segments after termination option marking, and redirection targets, this invention extracts different source paths into a unified set of path entries to be verified. After deduplication by normalizing the path keys, it performs absolute path normalization and prefix matching verification only once for each normalized unique path entry.
[0019] Furthermore, in this invention, the dynamic authorization boundary is not only used for subsequent path prefix matching, but also serves as the common basis for the active purification of high-risk environment variables and the anchoring of kernel objects for subsequent out-of-bounds judgments, so that subsequent control actions are all constrained by the same task boundary, rather than depending on each other's independent static rules.
[0020] The four core features mentioned above are not isolated, but form a continuous defense loop with a clear sequential dependency and interlocking beginning and end. The verification result of the timing locking link determines whether the dynamic authorization boundary can be generated. The generation result of the dynamic authorization boundary further constitutes the common authorization basis for the active purification of environmental variables and the anchoring of kernel objects. Therefore, the subsequent links are not parallel additions to the results of the preceding links, but rather take the output of the preceding links as a premise for their validity.
[0021] The beneficial effects of this invention are: 1. By performing context fingerprint matching before instantiating the supplementary audit node at runtime, and canceling the startup directly without constructing a read-only permission set when a mismatch occurs, the processing overhead caused by invalid supplementary audit nodes entering the permission derivation, parameter parsing, and path verification process can be reduced, and the risk of unauthorized inheritance caused by context drift can be reduced.
[0022] 2. By finding the intersection of the visited directory set and the preset read-only directory set, and deleting redundant directory entries covered by the parent directory prefix, a compact authorized directory prefix list is obtained. This can converge the directory authorization boundary of the supplementary audit node to the minimum necessary range directly related to the current audit task.
[0023] 3. By unifying the parameter segment, path parameters, and redirection target after the termination option is marked into the set of path entries to be verified, and then performing absolute path normalization and prefix matching after deduplication by normalized path key, the operations of repeated path expansion, repeated absolute path conversion, repeated prefix matching, and repeated unauthorized judgment can be reduced, and the risk of missing detection of multi-source paths can be reduced.
[0024] 4. By organizing execution context fingerprint pre-verification, dynamic boundary generation, proactive purification of high-risk environments, and kernel object anchoring into a continuous defense closed loop in a fixed time sequence, a four-control chain closed loop effect can be formed in the scenario of supplementary audit nodes, which includes time sequence locking, dynamic boundary convergence, proactive purification and isolation, and kernel-level object anchoring.
[0025] 5. By introducing a single-execution authorization ticket when the request is generated during the supplementary audit node, and writing the consumed status before instantiation, the risk of replaying old requests can be transformed from ex-post argumentation into a structured blocking mechanism.
[0026] 6. By maintaining directory file descriptors for authorized directory prefixes and performing subsequent relative path resolution and access control based on the directory file descriptors, the race window between object identity verification and actual access can be narrowed, thereby enhancing the ability to resist evasion attacks that separate time checks from actual use. Attached Figure Description
[0027] The advantages of the present invention, both above and / or other aspects, will become clearer and more readily understood through the following detailed description taken in conjunction with the accompanying drawings, which are merely illustrative and do not limit the invention, wherein: Figure 1 This is an overall system architecture diagram of one embodiment of the present invention; Figure 2 This is a flowchart of an execution control method according to an embodiment of the present invention; Figure 3 This is a flowchart illustrating the execution context fingerprint generation and matching process according to an embodiment of the present invention. Figure 4 This is a flowchart illustrating the path verification process according to an embodiment of the present invention. Figure 5 This is a timing diagram illustrating attack blocking according to an embodiment of the present invention. Detailed Implementation
[0028] In the following text, reference will be made to the appendix. Figure 1-5 This invention describes an embodiment of a read-only execution control method and system for supplementary audit nodes of an intelligent agent.
[0029] The embodiments described herein are specific implementations of the present invention, used to illustrate the concept of the invention, and are illustrative and exemplary, and should not be construed as limiting the implementation or scope of the invention. In addition to the embodiments described herein, those skilled in the art can employ other obvious technical solutions based on the content disclosed in the claims and specification of this application. These technical solutions include those that make any obvious substitutions and modifications to the embodiments described herein.
[0030] The accompanying drawings in this specification are schematic diagrams to aid in illustrating the concept of the invention, and schematically show the shapes of the various parts and their interrelationships. Please note that, in order to clearly demonstrate the structure of the components in the embodiments of the invention, the drawings are not drawn to the same scale. The same reference numerals are used to indicate the same parts.
[0031] Example: A read-only execution control method for supplementing audit nodes in an intelligent agent includes: Obtain the execution results of the preceding audit nodes; When the exception flag meets the triggering conditions, a supplementary audit node insertion request is generated. Generate and match execution context fingerprints before instantiating supplementary audit nodes, and cancel startup if a mismatch occurs; During matching, the set of directories accessed by the preceding audit node and the preset set of read-only directories are processed to obtain a compact authorized directory prefix list, and a set of read-only permissions containing the compact authorized directory prefix list is assigned to the supplementary audit node; Before executing the candidate audit instruction, the parameter segment after the termination option is marked, the path parameter and the redirection target are uniformly extracted into a set of path entries to be verified, and path verification is performed based on the compact authorized directory prefix list; Execution will be blocked if an unauthorized path entry exists or output is redirected. When input redirection exists, perform path validation on the input redirection target. If the validation passes, execution is allowed to continue; if the validation fails, execution is blocked.
[0032] The normalization process for the executed instruction sequence and the absolute path of the current working directory includes at least one of the following: eliminating irrelevant space differences, unifying the path separator format, expanding relative paths into absolute paths by combining them with the corresponding working directory, and unifying the directory end separator format; the relative paths in the candidate audit instructions are converted into absolute paths by combining them with the current working directory before participating in path verification, and the "." and ".." path traversal symbols are parsed and eliminated during the path normalization process.
[0033] The context items involved in generating the current execution context fingerprint and the initial execution context fingerprint also include a set of environment variables, which are sorted by variable name before being concatenated. Before the supplementary audit node is instantiated and after the compact licensed directory prefix list is generated, the system uses the compact licensed directory prefix list as the dynamic license boundary to actively clean high-risk environment variables in the execution environment. The active cleaning includes: extracting high-risk environment variables in the execution environment, which at least include executable file search paths and dynamic link library loading paths; extracting path entries contained in the high-risk environment variables, and using the dynamic license boundary represented by the compact licensed directory prefix list as the basis for filtering, eliminating, or rewriting for matching and verification. Path entries that exceed the license boundary represented by the compact licensed directory prefix list during the matching and verification will be forcibly filtered, eliminated, or rewritten from the high-risk environment variables.
[0034] The compact authorized directory prefix list is generated by performing absolute path normalization, deduplication, and sorting on the set of directories accessed by the pre-audit node and the preset read-only directory set, then finding their intersection, and deleting redundant directory entries covered by the parent directory prefix.
[0035] After the compact authorized directory prefix list is generated, the system further records object identity identifiers for the directory prefixes in the compact authorized directory prefix list. The object identity identifiers include at least one or more of the following: device identifier, inode identifier, and mount point identifier. During the execution of the supplementary audit node, after the path to be accessed is normalized to an absolute path, its object identity identifier is first parsed and its consistency is verified with the object identity identifier recorded at the authorization boundary. After the object identity consistency verification is passed, the system calls the directory open interface to obtain and maintain the directory file descriptor of the corresponding directory prefix, so as to form an authorization benchmark anchored to the underlying system kernel.
[0036] When generating the supplementary audit node insertion request, a single execution authorization ticket corresponding to each supplementary audit node insertion request is simultaneously generated. The supplementary audit node insertion request identifier is determined by the current execution context fingerprint and the candidate audit instruction digest. The single execution authorization ticket is bound to the supplementary audit node insertion request identifier, the initial execution context fingerprint, the candidate audit instruction digest, and a random number, and optionally to the compact authorization directory prefix list digest, timestamp, and validity period. Before the supplementary audit node is instantiated, the single execution authorization ticket is validated. The supplementary audit node is allowed to enter the instantiation process only if the ticket has not been consumed, the ticket binding information is consistent with the current supplementary audit node insertion request, and the ticket validation passes. After the validation passes, the single execution authorization ticket is marked as consumed, deleted, or invalid.
[0037] After acquiring and maintaining the directory file descriptor, the system continues to perform path resolution chain semantic verification on the path to be accessed. In the path resolution chain semantic verification and subsequent actual file access operations, the system forces relative path traversal and access based on the maintained directory file descriptor. The path resolution chain semantic verification includes detecting whether symbolic link jumps, binding mount jumps, mount namespace switching, and cross mount point jumps occur in the resolution chain based on the relative path resolution. When the resolution chain crosses the authorized root represented by the compact authorized directory prefix list, crosses the preset allowed mount boundary, or enters an unauthorized mount point, the execution of the candidate audit instruction is directly blocked.
[0038] A read-only execution system for intelligent agents to supplement audit nodes includes: a result receiving module, used to obtain the execution results of the previous audit nodes, which include anomaly markers, candidate audit instructions, and a set of directories accessed by the previous audit nodes; The triggering module is used to generate a supplementary audit node insertion request when the abnormality marker indicates an abnormal state and the command family to which the candidate audit instruction belongs is within a preset audit command family set; The context verification module is used to generate and verify the execution context fingerprint before the supplementary audit node is instantiated, and to cancel the startup of the supplementary audit node in case of mismatch. The authorization boundary generation module is used to generate a compact authorization directory prefix list when performing context fingerprint matching, and to allocate a read-only permission set containing the compact authorization directory prefix list to the supplementary audit node; The path verification module is used to uniformly extract the set of path entries to be verified corresponding to the parameter segment after the termination option mark, the path parameters, and the redirection target before the supplementary audit node executes the candidate audit instruction, and to perform path verification and path parsing chain semantic verification based on the compact authorized directory prefix list. The blocking module is used to block the execution of the candidate audit instruction or block the instantiation of the supplementary audit node when there is an unauthorized path entry, the candidate audit instruction contains output redirection, the input redirection target verification fails, or the single execution authorization ticket verification fails.
[0039] The authorization boundary generation module is also used to record the object identity identifier corresponding to the compact authorization directory prefix list. The context verification module is also used to extract high-risk environment variables containing executable file search paths and dynamic link library loading paths, and perform filtering, elimination, or rewriting based on the compact authorization directory prefix list, and verify the validity of the single execution authorization ticket that corresponds one-to-one with the supplementary audit node insertion request. The path verification module is also used to obtain and maintain the directory file descriptor after the path prefix matching is successful and the object identity is consistent, and initiate relative path resolution based on the directory file descriptor to detect whether symbolic link jumps, mount point crossings, or object identity drifts occur in the path resolution chain. The filtering, elimination, or rewriting of the high-risk environment variables, as well as the acquisition of the directory file descriptor and subsequent relative path resolution, are all based on the authorization boundary represented by the compact authorization directory prefix list.
[0040] A computer-readable storage medium storing a computer program thereon, characterized in that, when the computer program is executed by a processor, it implements a read-only execution control method for supplementing audit nodes of an intelligent agent.
[0041] This invention does not use context information as a common authorization judgment field for comparison. Instead, it recalculates the execution context fingerprint before the supplementary audit node is instantiated and the read-only permission set is constructed at runtime. It uses whether the fingerprint matches as a pre-gating condition for whether the supplementary audit node can enter the subsequent execution chain. This technical choice involves forward control of the supplementary node startup sequence and resource allocation process, which is significantly different from the conventional judgment timing of existing technologies.
[0042] This invention does not directly use the preset read-only directory whitelist, nor does it simply inherit the set of directories already accessed by the predecessor node. Instead, it performs absolute path normalization, deduplication, and sorting on the two types of directory sets respectively, and then finds their intersection. The intersection result is then subjected to prefix coverage deduplication to obtain a compact authorized directory prefix list specific to the current supplementary audit node. This technical choice reflects the idea of dynamically narrowing the authorization boundary around the task context of the current supplementary node, rather than static directory inheritance or general policy allowance.
[0043] Instead of establishing separate distributed verification branches for explicit path parameters, parameter segments after termination option marking, and redirection targets, this invention extracts different source paths into a unified set of path entries to be verified. After deduplication by normalizing the path keys, only one absolute path normalization and one prefix matching verification are performed on each normalized unique path entry. This technical choice not only reduces redundant calculations but also ensures consistent judgment results for the same path in the same candidate audit instruction.
[0044] In this invention, the dynamic authorization boundary is not only used for subsequent path prefix matching, but also serves as the common basis for the active purification of high-risk environment variables and the anchoring of kernel objects for subsequent out-of-bounds judgments. This ensures that subsequent control actions are all constrained by the same task boundary, rather than depending on each other's independent static rules.
[0045] The four core features mentioned above are not isolated, but form a continuous defense loop with a clear sequential dependency and interlocking beginning and end. The verification result of the timing locking link determines whether the dynamic authorization boundary can be generated. The generation result of the dynamic authorization boundary further constitutes the common authorization basis for the active purification of environmental variables and the anchoring of kernel objects. Therefore, the subsequent links are not parallel additions to the results of the preceding links, but rather take the output of the preceding links as a premise for their validity.
[0046] After the dynamic authorization boundary is generated, this invention not only records a compact authorization directory prefix list, but also further records the file system object identity identifier of the directory prefix corresponding to the compact authorization directory prefix list. The object identity identifier may include at least one or more of the following: device identifier, inode identifier, and mount point identifier. During the execution of the supplementary audit node, after the absolute path normalization of the path to be accessed is completed, in addition to performing directory prefix matching, it further parses the corresponding object identity identifier and performs consistency verification with the object identity identifier recorded in the authorization boundary. Thus, the authorization basis is expanded from a simple path string boundary to an authorization structure jointly defined by the path boundary and the object identity boundary.
[0047] After the dynamic authorization boundary is generated, this invention also obtains and maintains the directory file descriptor for the directory prefix in the compact authorization directory prefix list, so that the resolution of the subsequent access path is based on the anchored directory object. During the execution of the supplementary audit node, not only is the path prefix checked to see if it is consistent with the object identity, but also relative path resolution and subsequent access control are performed on the access path based on the directory file descriptor, thereby reducing the race window between "object identity verification completed" and "actual access occurs".
[0048] This invention generates a single-execution authorization ticket simultaneously when a supplementary audit node insertion request is generated. This single-execution authorization ticket is bound to the supplementary audit node insertion request identifier, initial execution context fingerprint, candidate audit instruction digest, and random number. Optionally, it may also be bound to a compact authorization directory prefix list digest, timestamp, and validity period. Validity is verified before the supplementary audit node is instantiated and before the read-only permission set is constructed. The supplementary audit node can only enter the instantiation process if the ticket is not expired, not consumed, and matches the current supplementary audit node insertion request. Once the ticket passes verification, it is written to a consumed state, deleted, or marked as invalid, thereby suppressing replay of old requests and repeated instantiation.
[0049] Before instantiating the supplementary audit node, this invention not only involves the set of environment variables in the generation of the execution context fingerprint, but also further extracts path values from PATH, LD_LIBRARY_PATH, LD_PRELOAD, or other high-risk environment variables. Filtering, intersection, elimination, or rewriting are then performed using the compact authorized directory prefix list as the boundary. The cleaned set of environment variables is then delivered to the supplementary audit node to reduce the risk of injecting unauthorized execution paths or dynamic library paths through high-risk environment variables. Therefore, the purification scale of the proactive environment variable purification is not pre-set by static rules, but directly limited by the generation result of the dynamic authorization boundary.
[0050] This invention not only eliminates the "." and ".." path traversal symbols during the path resolution phase, but also performs semantic-level detection on symbolic link jumps, binding mount jumps, mount namespace switching, cross-device switching, and cross-mount point switching after path prefix matching and object identity consistency verification have passed. When the resolution chain crosses the authorized root represented by the compact authorized directory prefix list, crosses the preset allowed mount boundary, enters an unauthorized mount point, or causes the object identity identifier corresponding to the matched path to drift, the execution of candidate audit instructions is directly blocked. Thus, this invention elevates path verification from text-level path normalization to file system semantic-level object resolution and boundary control. Furthermore, the acquisition of directory file descriptors and subsequent relative path resolution are based on the common premise of dynamic authorization boundary generation and successful object identity consistency verification. If any of these key steps are missing, the overall control effect cannot be achieved.
[0051] Specifically, in the timing locking stage, before the supplementary audit node is instantiated at runtime and the read-only permission set is constructed, the system verifies the context fingerprint of the preceding audit node by combining the single execution authorization ticket. If a mismatch occurs, it is directly blocked. This stage serves as the front-end gating of the entire control chain, completely resolving the risk of permission drift and old request replay caused by race conditions in a concurrent environment.
[0052] In the dynamic boundary stage, the system can only enter after the timing lock is passed. It intersects and deduplicates the set of directories accessed by the previous audit node with the preset read-only directory set, and generates a compact authorized directory prefix list. This stage provides a deterministic boundary basis directly related to the current audit task for subsequent processes.
[0053] In the proactive cleanup phase, the system uses the compact authorization directory prefix list as a dynamic authorization boundary to perform prefix matching and out-of-bounds removal on path values in high-risk environmental variables. This phase limits the cleanup scale to dynamic authorization boundaries, ensuring that nodes do not inherit dangerous execution environments with backdoors.
[0054] In the kernel object anchoring phase, after the object identity consistency verification passes, the system obtains and maintains the kernel file descriptor (FD) of the authorized directory. After uniformly extracting multiple source paths, the system initiates relative path resolution and semantic verification based on the directory file descriptor in subsequent access control. This phase not only uses the subsequent actual access action to carry over the object identity consistency verification result, but also uses the dynamic authorization boundary as the basis for judging whether the relative path resolution exceeds the boundary, thereby blocking the underlying vulnerability where the boundary and cleaning results are breached by the race condition (TOCTOU) at the moment of final access.
[0055] The four control chains mentioned above are interdependent and interconnected, together forming a complete and continuous defense closed loop for supplementary audit node scenarios in this invention.
[0056] It should be noted that, in the context of this technical solution, during the timing locking phase, before the system instantiates the supplementary audit node at runtime and constructs the read-only permission set, it verifies the context fingerprint of the preceding audit node by combining the single execution authorization ticket. If a mismatch occurs, it directly blocks the process. This phase serves as the preceding gating of the entire control chain, completely resolving the risk of permission drift and replay of old requests caused by race conditions in a concurrent environment.
[0057] In the dynamic boundary phase, the system can only enter after the timing lock is passed. It intersects the set of directories accessed by the previous audit node with the preset read-only directory set and removes duplicates to generate a compact authorized directory prefix list.
[0058] This step provides a definite boundary basis for subsequent processes that is directly related to the current audit task.
[0059] In the proactive cleanup phase, the system uses the compact authorization directory prefix list as a dynamic authorization boundary to perform prefix matching and out-of-bounds removal on path values in high-risk environmental variables. This phase limits the cleanup scale to dynamic authorization boundaries, ensuring that nodes do not inherit dangerous execution environments with backdoors.
[0060] In the kernel object anchoring phase, after the object identity consistency verification passes, the system obtains and maintains the kernel file descriptor (FD) of the authorized directory. After uniformly extracting multiple source paths, the system initiates relative path resolution and semantic verification based on the directory file descriptor in subsequent access control. This phase not only uses the subsequent actual access action to carry over the object identity consistency verification result, but also uses the dynamic authorization boundary as the basis for judging whether the relative path resolution exceeds the boundary, thereby blocking the underlying vulnerability where the boundary and cleaning results are breached by the race condition (TOCTOU) at the moment of final access.
[0061] It should be noted that, within the context of this technical solution, during the timing locking phase, before the system instantiates the supplementary audit node at runtime and constructs the read-only permission set, By verifying the context fingerprint of the preceding audit node using a single execution authorization ticket, and directly blocking it upon mismatch, this stage serves as the preceding gating of the entire control chain... In the dynamic boundary phase, the system can only enter after the timing lock is passed. It intersects the set of directories accessed by the previous audit node with the preset read-only directory set and removes duplicates to generate a compact authorized directory prefix list.
[0062] This step provides a definite boundary basis for subsequent processes that is directly related to the current audit task.
[0063] In the proactive cleanup phase, the system uses the compact authorized directory prefix list as the dynamic authorization boundary to perform prefix matching and out-of-bounds removal on path values in high-risk environmental variables...
[0064] Example 1: Overall Process Example (Normal Success Scenario) In one embodiment, the system receives the execution result of the front-end audit node, the execution result including at least anomaly flags, candidate audit instructions, and a set of accessed directories; When the anomaly marker indicates an abnormal state and the command family to which the candidate audit instruction belongs is within a preset audit command family set, the system generates a supplementary audit node insertion request. The preset audit command family set is preferably a read-only audit command family set. Before the supplementary audit node is instantiated at runtime, the system normalizes the executed instruction sequence and the absolute path of the current working directory of the previous audit node, concatenates them according to the preset field order and performs one-way digest encoding to form an execution context fingerprint. Then, the system matches the recalculated execution context fingerprint with the execution context fingerprint carried in the supplementary audit node insertion request. If the two do not match, the system directly cancels the startup of the supplementary audit node without constructing a read-only permission set, thus preventing the supplementary audit node from continuing to enter the permission derivation, parameter parsing and path verification process. If the match is successful, the system will perform absolute path normalization, deduplication, and sorting on the visited directory set and the preset read-only directory set respectively. Then, the system will find the intersection of the two and delete the lower directory entries that are covered by the shorter upper directory prefix to obtain a compact authorized directory prefix list. Compared with the uncompressed directory set, the compact authorized directory prefix list has fewer entries, so fewer directory prefix entries need to be compared when a single path enters the prefix matching process. Before the supplementary audit node executes the candidate audit instruction, the system performs structured parsing on the candidate audit instruction, breaking it down into command name, option parameters, parameter segment after the termination option mark, path parameters, and redirection target. Then, the system extracts the set of path entries to be verified from the parameter segment after the termination option mark, path parameters, and redirection target. For duplicate path entries, the system retains only one copy according to the normalized path key to participate in absolute path normalization and prefix matching. In this way, the number of times the same path is repeatedly converted and repeatedly verified in a single command can be reduced. If there are path entries in the path entries to be verified that exceed the compact authorized directory prefix list, or if the candidate audit instruction contains output redirection, the system will directly block the execution of the candidate audit instruction; if the candidate audit instruction contains input redirection, the system will add the input redirection target to the set of path entries to be verified, and allow execution to continue if the verification passes, and block execution if the verification fails.
[0065] Example 2: Parsing of Parameter Segments After Termination Option Marking In one embodiment, the candidate audit instruction includes a termination option flag. When parsing, the system first identifies the termination option flag and then processes the subsequent parameter segment as a position parameter segment separately, instead of continuing to interpret it as an option parameter. For example, when the candidate audit instruction is preceded by a command name and several option parameters, and the strings following the termination option mark are paths or filenames, the system treats these strings as a location parameter segment. For the relative paths that appear in it, the system expands them into absolute paths based on the current working directory and then merges them into the set of path entries to be verified. If the same relative path appears in both the location parameter segment and other path parameters, the system retains only one path entry to be verified after merging to participate in subsequent normalization and matching. In one implementation, the system parses and eliminates the "." and ".." path traversal symbols during path normalization, and performs normalized expansion on path fragments such as ". / ", ".. / ", and ".. / .. / ", to prevent attackers from bypassing directory authorization boundaries or circumventing prefix matching checks by traversing paths. Example 3: Compact Authorized Directory Prefix List Generation Example In one embodiment, the set of directories accessed by the pre-audit node includes multiple directory entries, and the preset read-only directory set also includes multiple directory entries. The system performs absolute path normalization, deduplication, and sorting on the directory entries in both sets. Then, the system finds the intersection of the two sets and sorts them by directory prefix length. If a shorter directory prefix already covers a longer lower-level directory entry, the system retains the shorter directory prefix and deletes the covered longer directory entry to obtain a compact authorized directory prefix list. This reduces the number of prefix comparisons during subsequent path matching and the storage space of the directory prefix list. If the intersection result is empty, the supplementary audit node will not inherit directory access permissions, or the startup of the supplementary audit node will be blocked directly. In this way, the supplementary audit node will not obtain directory read-only permissions that are unrelated to the current abnormal object. Example 4: Execution Context Fingerprint Generation Example In one embodiment, the sequence of executed instructions of the pre-audit node is as follows: 1. cd / repo / service; 2. `cat .. / service / config / app.yaml`; 3.grep error . / logs / app.log; grep keyword . / config / app.yaml.
[0066] The absolute path of the current working directory is / repo / service; The system first performs normalization processing on the above context items. The normalization of the executed command sequence includes: maintaining the command execution order; normalizing the relative path .. / service / config / app.yaml to / repo / service / config / app.yaml; normalizing the relative path . / logs / app.log to / repo / service / logs / app.log; and eliminating irrelevant whitespace differences in the commands. The normalized context term can be represented as: cmd1=cd / repo / service; cmd2=cat / repo / service / config / app.yaml; cmd3=greperror / repo / service / logs / app.log; cwd= / repo / service; The system concatenates the "executed instruction sequence + absolute path of the current working directory" according to a preset field order to form a context description string: cmd1=cd / repo / service;cmd2=cat / repo / service / config / app.yaml;cmd3=greperror / repo / service / logs / app.log;cwd= / repo / service; Subsequently, the system performs one-way digest encoding on the context description string. In one example, the SHA-256 digest algorithm can be used to generate an execution context fingerprint. Thus, the supplementary audit node insertion request can carry the initial execution context fingerprint generated based on the above context description string. When the supplementary audit node is ready to start, the system repeats the same normalization, concatenation, and digest encoding operations on the currently acquired context, and matches the newly obtained current execution context fingerprint with the initial execution context fingerprint. When the current working directory changes from / repo / service to / repo / tools, or when the executed instruction sequence of the preceding audit node changes, the system's regenerated current execution context fingerprint will mismatch with the initial execution context fingerprint. In this case, the system cancels the startup of the supplementary audit node without instantiating the supplementary audit node or constructing a read-only permission set. In big data scheduling, container orchestration, or high-concurrency auditing scenarios, there may be a millisecond-level time difference between the generation of the supplementary audit node insertion request and the actual startup of the supplementary audit node. This implementation suppresses context drift and permission inheritance distortion caused by race conditions within this time window by fixing the initial execution context fingerprint when the request is generated and recalculating the current execution context fingerprint in real time before the node is loaded.
[0067] Example 5: Code Repository Audit Scenario Example In one embodiment, the object to be audited is the code repository. The pre-audit node first performs a preliminary audit of the code repository directory structure, key configuration files, and difference files. When an anomaly is found in a certain configuration directory or script directory, the system generates a corresponding candidate audit instruction and triggers a supplementary audit node. Before the supplementary audit node is instantiated at runtime, the system normalizes the executed instruction sequence and absolute path of the code repository root directory of the preceding node, generates execution context fingerprints according to the preset field order and performs matching. If a mismatch occurs, the supplementary node startup is canceled directly without constructing a read-only permission set. If a match is successful, the set of directories accessed by the preceding node is intersected with the preset set of read-only directories of the code repository, and redundant directory entries covered by the prefix of the parent directory are deleted to obtain a compact list of authorized directory prefixes. The supplementary audit node can then only execute read-only commands in the audit command whitelist within the compact authorized directory prefix list. For path parameters, location parameter segment paths, and redirection targets that appear repeatedly in the same command, the system retains only one path entry to be verified for subsequent path normalization and prefix matching. If there are unauthorized path entries, unauthorized input redirection targets, or output redirections, the system will directly block execution.
[0068] Example 6: Host Inspection Scenario Example In one embodiment, the object to be audited is the host system. The front-end audit node first performs a preliminary inspection of the log directory, configuration directory, and status information directory. When an abnormal alarm or configuration conflict is found in a specific directory, the system generates a candidate audit instruction and triggers a supplementary audit node. Before the audit node is instantiated at runtime, the system normalizes the sequence of executed instructions and the absolute path of the current working directory of the front node, and generates an execution context fingerprint according to the preset field order. After the match is successful, the system intersects the set of directories accessed by the front node with the preset set of read-only directories on the host and compresses them to obtain a compact list of authorized directory prefixes. During subsequent execution, the supplementary audit node can only access log files or status information files within the scope of the compact authorized directory prefix list; if a command contains output redirection or unauthorized path entries, it will be blocked immediately; if a command contains input redirection, it will only be allowed to continue execution if the input redirection target passes validation.
[0069] Example 7: Normal Audit Scenario Example (Normal Pass Scenario) In one embodiment, the pre-audit node performs a preliminary check under the code repository directory / repo / service. The executed instruction sequence of the pre-audit node is as follows: 1. cd / repo / service; 2. `cat . / config / app.yaml`; 3. grep error. / logs / app.log; grepkeyword . / config / app.yaml.
[0070] The current working directory's absolute path is / repo / service, and the set of directories accessed by the preceding audit node is: { / repo / service, / repo / service / config, / repo / service / logs}; The default set of read-only directories is: { / repo / service, / repo / service / config, / repo / service / logs, / repo / docs}; The candidate audit instructions generated by the current front-end audit node are: grepkeyword. / config / app.yaml--. / logs / app.log<. / config / input.txt; When generating a supplementary audit node insertion request, the system normalizes the above-mentioned executed instruction sequence and the absolute path of the current working directory, where: . / config / app.yaml should be standardized to / repo / service / config / app.yaml; . / logs / app.log is standardized to / repo / service / logs / app.log; The current working directory remains / repo / service; The system concatenates the "executed instruction sequence + absolute path of the current working directory" into a context description string according to the preset field order, and performs one-way digest encoding on the context description string, such as using SHA-256 to generate the initial execution context fingerprint; Before the supplementary audit node is started, the system re-acquires the current sequence of executed instructions and the absolute path of the current working directory, and generates the current execution context fingerprint in the same normalized way. Since the current working directory and command chain have not changed, the current execution context fingerprint matches the initial execution context fingerprint. After a successful match, the system performs absolute path normalization, deduplication, and sorting on the set of directories accessed by the preceding audit node and the preset read-only directory set, and then performs an intersection calculation. The intersection result is as follows: { / repo / service, / repo / service / config, / repo / service / logs}; Subsequently, the system performs prefix overwrite deduplication on the above intersection results. Since / repo / service can overwrite / repo / service / config and / repo / service / logs, the overwritten subdirectory entries are deleted, generating a compact list of authorized directory prefixes: { / repo / service}; The system uses the compact list of authorized directory prefixes as the directory authorization boundary for the verification of subsequent candidate audit command paths of the current supplementary audit node, and assigns a set of read-only permissions to the supplementary audit node that includes the directory authorization boundary and the audit command whitelist; Next, the system performs structured parsing on the candidate audit instructions, extracting the path sources including: Path parameter: . / config / app.yaml; The path to the parameter section after the termination option marker is . / logs / app.log; Input redirection target: . / config / input.txt; The system extracts the above paths into a unified set of path entries to be verified, and performs absolute path normalization based on the current working directory / repo / service, resulting in: { / repo / service / config / app.yaml, / repo / service / logs / app.log, / repo / service / config / input.txt}; Since the above paths all fall within the directory authorization boundary represented by the compact authorized directory prefix list / repo / service, and the input redirection target validation is successful, the candidate audit instruction does not contain output redirection, therefore the system allows the candidate audit instruction to be executed.
[0071] Example 8: Example of an attack or anomaly blocking scenario (context mismatch blocking scenario) In one embodiment, the sequence of executed instructions when the pre-audit node is initially triggered is as follows: 1. cd / repo / service; 2. `cat . / config / app.yaml`; The current working directory's absolute path is / repo / service, and an initial execution context fingerprint is generated based on this and then carried in the supplementary audit node insertion request; When the supplementary audit node is about to start, the system re-acquires the current context and finds that the preceding node executed the following instructions during this period: 3. cd / tmp; At this point, the absolute path of the current working directory becomes / tmp. The system re-normalizes the currently acquired sequence of executed instructions and the absolute path of the current working directory and generates the current execution context fingerprint. Since the current working directory has changed from / repo / service to / tmp, the current execution context fingerprint does not match the initial execution context fingerprint. In this case, the system cancels the startup of the supplementary audit node without instantiating the supplementary audit node or constructing a read-only permission set, thereby preventing the mismatched supplementary audit node from entering the subsequent directory authorization boundary generation and candidate audit instruction path verification process; In another abnormal scenario (path out-of-bounds blocking scenario), assuming the execution context fingerprint matching passes, and the compact authorized directory prefix list corresponding to the current supplementary audit node is: { / repo / service / config, / repo / service / logs}; The candidate audit instructions are: cat. / config / app.yaml--.. / .. / etc / passwd> / tmp / out.txt; After the system performs structured parsing on the candidate audit instruction, the extracted path sources include: Path parameter: . / config / app.yaml; The path to the parameter section after the termination option marker is .. / .. / etc / passwd; Output redirection target: / tmp / out.txt; The system performs normalization on each path based on the current working directory / repo / service, resulting in: / repo / service / config / app.yaml; / etc / passwd; / tmp / out.txt; If / etc / passwd exceeds the directory authorization boundary represented by the current compact authorized directory prefix list, and the candidate audit instruction contains output redirection (output redirection blocking scenario), the system determines that the candidate audit instruction has an unauthorized access risk and blocks the execution of the candidate audit instruction.
[0072] Example 9: Directory Compression and Path Aggregation Validation Example In one embodiment, the set of directories accessed by the front-end audit node is: { / repo, / repo / service, / repo / service / config, / repo / service / logs}; The default set of read-only directories is: { / repo, / repo / service / config, / repo / service / logs, / repo / docs}; The system first performs absolute path normalization, deduplication, and sorting on the above directory sets respectively. Then, it performs intersection calculation on the two sets, and the intersection result is: { / repo, / repo / service / config, / repo / service / logs}; Subsequently, the system performs prefix overwrite deduplication on the intersection results. Since the directory prefix / repo can override / repo / service / config and / repo / service / logs, the overwritten subdirectory entries are deleted. The resulting compact list of authorized directory prefixes is as follows: { / repo}; In one example of a candidate audit instruction: Grep keyword . / config / app.yaml -- . / logs / app.log < . / config / input.txt; The current working directory is / repo / service; After the system performs structured parsing on the candidate audit instructions, the extracted path sources include: Path parameter: . / config / app.yaml; The path to the parameter section after the termination option is marked is .. / service / logs / app.log; Input redirection target input.txt; The system extracts the above paths into a set of path entries to be verified: {. / config / app.yaml,.. / service / logs / app.log,input.txt}; Subsequently, the system normalizes each path using the current working directory as an absolute path, resulting in: { / repo / service / config / app.yaml, / repo / service / logs / app.log, / repo / service / input.txt}; If duplicate paths exist after normalization, the system retains only one copy of the normalized path key for subsequent verification. After deduplication, the system ensures that each normalized unique path entry is matched with the prefix of the compact authorized directory prefix list only once.
[0073] Example 10: Performance Comparison Example To more clearly illustrate the performance optimization effect of the present invention, specific performance test data are used for explanation below.
[0074] To verify the technical effectiveness of the present invention in a resource-constrained environment, this embodiment conducted performance tests on an audit terminal prototype system based on the Aarch64 architecture and equipped with a Linux kernel.
[0075] Test scenario: A code repository auditing system has a set of accessed directories for the front-end audit node containing 100 directory entries and a set of read-only directories containing 150 directory entries.
[0076] Comparison with Option A (without using a compact license directory prefix list): The system directly uses 150 directory entries from a preset set of read-only directories as the authorization boundary for supplementary audit nodes. When a supplementary audit node executes a candidate audit instruction, each path to be verified needs to be prefix-matched with each of the 150 directory entries. In a test sample of 1,000 candidate audit instructions, each instruction contains an average of 3.2 path entries to be verified, requiring a total of 1,000 × 3.2 × 150 = 480,000 prefix-matching operations. In the above Aarch64 Linux audit terminal prototype system test environment, the average verification time for a single instruction is approximately 8.6 milliseconds.
[0077] This invention solution (using a compact license directory prefix list): The system first performs an intersection operation on the set of directories accessed by the previous audit node (100 items) and the preset set of read-only directories (150 items), resulting in 85 directory items. Then, the system performs prefix coverage deduplication on the intersection result, deleting redundant directory items covered by the prefix of the parent directory. After compression, the compact authorized directory prefix list contains only 12 directory items. When the supplementary audit node executes the candidate audit instruction, each path to be verified only needs to be prefix matched with 12 directory items. At the same time, through normalized path key deduplication, the average number of path entries to be verified per instruction is reduced from 3.2 to 1.8. A total of 1000 × 1.8 × 12 = 21600 prefix matching operations are required. Under the same test environment, the average verification time for a single instruction is about 1.2 milliseconds. Performance Improvement Analysis: Prefix matching count: reduced from 480,000 to 21,600, a decrease of 95.5%; Single instruction verification time: reduced from 8.6 milliseconds to 1.2 milliseconds, a reduction of 86.0%; Number of entries in the authorization boundary table: reduced from 150 to 12, a decrease of 92.0%; Test results show that by applying the compact authorization directory prefix generation mechanism described in this invention, the system successfully reduced the number of authorization boundary table entries by 92.0% and the total latency of a single path verification by approximately 86.0% when processing an audit task containing 1000 discrete paths. The above performance improvement comes not only from the compression of the directory prefix list but also from the deduplication of the path entries to be verified. The two work together to significantly improve the path verification efficiency of the supplementary audit nodes.
[0078] Example 11: Comparative Example To more clearly illustrate the control effect of the present invention, several comparative schemes are described below.
[0079] In contrast to Solution 1, the system uses a fixed directory whitelist as the authorization boundary for supplementary audit nodes. For example, a pre-configured directory set is set as { / repo / service, / repo / service / config, / repo / service / logs, / repo / docs, / tmp}. When a supplementary audit node starts, the system directly uses this fixed directory set as the directory authorization boundary, without considering the range of directories actually accessed by the preceding audit node in the current audit task. Under this solution, even if the preceding audit node only accesses / repo / service / config and / repo / service / logs, the supplementary audit node may still access directories such as / repo / docs or / tmp that are not directly related to the current verification task, resulting in an overly broad authorization boundary. At the same time, when the working directory changes after the preceding audit node triggers the supplementary audit node, this solution cannot prevent the mismatched node from continuing to enter the subsequent process before the supplementary audit node starts. In contrast to Solution 2, when the system performs permission checks on the supplementary audit node, it reads the current working directory, environment variables, or other context information and dynamically adjusts access permissions based on the context information. Although this solution introduces context factors, the supplementary audit node has usually already been instantiated and entered the initial permission construction process. Even if context inconsistency is found later, access requests can only be denied during the execution phase. This cannot avoid the resource overhead of the instantiation phase, nor can it block mismatched nodes from the start of the process. In contrast to Scheme 3, the system only verifies the explicit path parameters in the candidate audit instructions to determine whether they are within the authorization boundary. This scheme lacks a unified processing mechanism for implicit path sources such as parameter segments after the termination option mark, input redirection targets, or output redirection targets, which is prone to missed detections. At the same time, when the same path appears repeatedly in the same candidate audit instruction in different forms, this scheme usually normalizes and verifies them separately, resulting in duplicate processing. Compared with the above comparative schemes, the present invention performs execution context fingerprint matching and verification before the supplementary audit node is instantiated. After the matching is successful, a compact authorized directory prefix list is dynamically generated based on the set of directories accessed by the previous audit node and the preset read-only directory set. During the execution of the supplementary audit node, multi-source paths are uniformly extracted, deduplicated, and verified once. It can be seen that in the supplementary audit node scenario, the present invention has better control effect in terms of context consistency guarantee, authorization boundary convergence, and path verification integrity.
[0080] Example 12: System Implementation A read-only execution control system for supplementing audit nodes by an intelligent agent, comprising: The result receiving module is used to receive the execution results of the front-end audit node; The triggering module is used to generate a supplementary audit node insertion request when the exception flag and command family conditions are met; The context verification module is used to generate and verify the execution context fingerprint before the supplementary audit node is instantiated at runtime, and to cancel the startup of the supplementary audit node without constructing a read-only permission set in case of mismatch. The authorization boundary generation module is used to calculate the intersection of the set of directories accessed by the front-end audit node and the preset set of read-only directories and compress the directory entries to generate a compact list of authorized directory prefixes and a set of read-only permissions. The path verification module is used to extract the set of path entries to be verified, and to perform absolute path normalization and prefix matching on the path entries after deduplication by normalized path key; The blocking module is used to block the execution of candidate audit instructions when there is an unauthorized path entry, an unauthorized input redirection target, or an output redirection. The above modules can be implemented in software or in a combination of software and hardware.
[0081] Example 13: Detailed Implementation of Standardization Processing To more clearly illustrate the specific implementation of the normalization process in this invention, the following is a detailed explanation through specific examples.
[0082] In one embodiment, when the system normalizes the executed instruction sequence and the absolute path of the current working directory, the following situations need to be handled: (1) Repeated forward slash processing: Convert multiple consecutive forward slashes in the path into a single forward slash. For example, normalize / repo / / service / / / config to / repo / service / config. This solves the problem of path format differences that may be caused by different command generation tools. (2) Consistent handling of trailing forward slashes: uniformly delete trailing forward slashes at the end of the path, or uniformly retain trailing forward slashes at the end of the path. For example, unify / repo / service / and / repo / service to / repo / service. This ensures that different representations of the same directory generate the same execution context fingerprint. (3) Path traversal symbol elimination: Parse and eliminate the "." and ".." symbols in the path. For example, normalize / repo / service / . / config / .. / logs to / repo / service / logs. This prevents bypassing directory authorization boundaries by traversing the path. (4) Environment variable sorting and high-risk environment variable cleaning: When the context item includes a set of environment variables, the system sorts the environment variables in lexicographical order of variable names before concatenation. For example, the environment variable set {PATH= / usr / bin,HOME= / root,USER=admin} is normalized to HOME= / root;PATH= / usr / bin;USER=admin. This solves the problem of inconsistent hash values caused by random order of environment variables and ensures that the same set of environment variables generates the same execution context fingerprint. Furthermore, for high-risk environment variables such as PATH, LD_LIBRARY_PATH, and LD_PRELOAD, the system extracts their path values and filters, intersects, eliminates, or rewrites them with the compact authorized directory prefix list, thereby reducing the number of execution paths or library paths that exceed the authorized boundaries from entering the supplementary audit node environment. (5) Space and tab normalization: Convert consecutive spaces or tabs in the command to a single space. For example, normalize "cat\tfile.txt" to "cat file.txt". This eliminates the impact of command format differences on the execution context fingerprint. Through the above standardization process, the system can ensure that the recalculated execution context fingerprint remains consistent with the initial execution context fingerprint when the execution context of the preceding audit node has not changed substantially; however, if the execution context has changed substantially, the recalculated execution context fingerprint will mismatch with the initial execution context fingerprint, thereby triggering the supplementary audit node start cancellation mechanism.
[0083] Example 14: Storage Medium Example A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, causes the processor to perform the method steps in any of the above embodiments.
[0084] Example 15: File Object Identity Binding and Directory File Descriptor Anchoring Example In one embodiment, after the system performs context fingerprint matching and generates a compact authorized directory prefix list, it further parses the object identity identifier of the directory prefix in the compact authorized directory prefix list, and obtains and maintains the directory file descriptor for the directory prefix. In the Linux file system environment, the object identity identifier may include at least the device identifier, the inode identifier, and the mount point identifier. For example, the compact authorized directory prefix list contains the directory prefix " / repo / service / config". During the authorization boundary generation phase, the system records the device identifier, inode identifier and mount point identifier of the directory object corresponding to the directory prefix, and obtains the file descriptor of the corresponding directory, and writes it into the read-only permission set or authorization boundary metadata. When the supplementary audit node subsequently executes the candidate audit commands "cat . / config / app.yaml, cd / tmp, cat . / config / app.yaml -- .. / .. / etc / passwd > / tmp / out.txt", the system first normalizes ". / config / app.yaml" to " / repo / service / config / app.yaml", then parses the object identity of its directory and performs a consistency check between this object identity and the object identity of the corresponding record in " / repo / service / config". If the path prefix matches and the object identity is consistent, the system no longer relies solely on the absolute path string for continued access. Instead, it performs subsequent parsing and access control on the relative path "app.yaml" based on the maintained directory file descriptor. In this way, even if an attacker attempts to replace the directory entry using a very short time window between object identity verification and actual access, the system can still reduce the risk caused by the separation of time checks and actual use by leveraging the directory file descriptor anchoring mechanism.
[0085] Example 16: Single Execution Authorization Ticket Example In one embodiment, when generating a supplementary audit node insertion request, the system simultaneously generates a single execution authorization ticket. The ticket is bound to a supplementary audit node insertion request identifier, an initial execution context fingerprint, a candidate audit instruction digest, and a random number, and optionally includes a compact authorization directory prefix list digest, a timestamp, and a validity period. For example, the system generates an insert request at time T1. The request includes an insert request identifier R1, a candidate audit instruction "grepkeyword . / config / app.yaml", an initial execution context fingerprint F1, and a random number N1. The system concatenates the above fields in a preset order and performs one-way digest encoding to generate a ticket digest, which is then bound to the supplementary audit node insert request as a single execution authorization ticket. When a supplementary audit node is about to start, the system checks whether the current time has exceeded the validity period of the ticket, whether the random number is repeated, and whether the ticket has been consumed. It then recalculates the current execution context fingerprint and candidate audit instruction digest, and compares them with the information bound in the ticket. Only if the ticket has not expired, has not been consumed, and matches the current supplementary audit node's insertion request, is the supplementary audit node allowed to enter the instantiation process before the construction of the read-only permission set. After the verification is successful, the system immediately writes the ticket to the consumed state. If the same ticket is submitted again later, it will be directly blocked because the ticket has been consumed.
[0086] Example 17: High-Risk Environmental Variable Cleaning and Reconstruction Example In one embodiment, the environment variable set of the front-end audit node includes PATH= / repo / service / bin: / tmp / bin, LD_LIBRARY_PATH= / repo / service / lib: / opt / lib, and LD_PRELOAD= / tmp / inject.so. After the system passes the execution context fingerprint matching and generates a compact authorized directory prefix list { / repo / service, / repo / service / lib}, it further extracts the path values from the above-mentioned high-risk environment variables and uses the compact authorized directory prefix list as the authorization boundary for filtering. For example, the system retains the path segment located at / repo / service / bin in PATH and removes / tmp / bin; it retains the path segment located at / repo / service / lib in LD_LIBRARY_PATH and removes / opt / lib; if LD_PRELOAD points to / tmp / inject.so, it will be deleted or rewritten to an empty value because it is not within the authorized boundary. The cleaned set of environment variables is then delivered to the supplementary audit node to reduce the risk of execution poisoning through unauthorized program paths or dynamic library paths.
[0087] Example 18: Symbolic Link and Mount Point Cross-Blocking Example In one embodiment, the candidate audit command is "cat . / config / app.yaml -- . / logs / app.log", the current working directory is " / repo / service", and the compact authorized directory prefix list is "{ / repo / service / config, / repo / service / logs}". The system first performs absolute path normalization on the above paths and completes directory prefix matching and object identity consistency verification. Then, the system continues to perform file system semantic level detection on the path resolution chain, including: whether symbolic link jumps occur, whether binding mount points are crossed, whether different mount namespaces are entered, and whether cross-device switching occurs. If it is detected that " / repo / service / config" is actually a symbolic link directory pointing to " / mnt / external / config", and this jump causes the resolution chain to cross the authorized root, enter an unauthorized mount point, or cause the identity of the object corresponding to the matched path to drift, then even if the system sees that " / repo / service / config / app.yaml" satisfies the prefix match at the string prefix level, it will still determine that there is a risk of mount or link crossing, and block the execution of candidate audit instructions. In this way, the system can prevent attackers from using mount switching, directory replacement, or symbolic link jumps to keep the surface path text unchanged while the underlying objects have been moved to an unauthorized area. Example data of beneficial effects The following data are exemplary test results illustrating the technical effects of the present invention. Those skilled in the art can obtain different test values based on different software and hardware environments, directory size, and command sample complexity.
[0088] Example of a test environment: Operating system: Linux x86_64; CPU: Quad-core processor; Memory: 16GB; Number of candidate audit instructions: 1000; Sample characteristics: include at least one of the following: relative path, parameter segment path after termination option mark, input redirection target, and output redirection target.
[0089] Table 1 Comparison of Exemplary Processing Effects
[0090] Table 2 provides an exemplary comparison with traditional combined control methods.
[0091] Among them, the traditional combined control method refers to a scheme that introduces context-aware control, path boundary control and parameter verification control into the command execution process but does not form a continuous control chain of pre-blocking, dynamic boundary generation and unified path deduplication verification.
[0092] As can be seen from the above comparison, the technical effect of this invention is not a simple summation of the local effects in the prior art, but rather relies on the complete implementation of a continuous defense closed loop composed of four control chains: "timing locking, dynamic boundary, active purification, and kernel object anchoring." Specifically: (1) If only execution context fingerprint verification is used without dynamic authorization boundary generation, the supplementary audit node can be blocked when the context mismatch occurs, but it will still inherit the excessively wide static directory whitelist when the context is matched. It cannot converge the authorization boundary to the range of directories actually accessed by the front node, resulting in the average number of entries in the directory authorization boundary remaining at a high level, and the number of subsequent prefix matching cannot be effectively reduced.
[0093] (2) If only dynamic authorization boundary generation is used without execution context fingerprint pre-verification, the supplementary audit node can obtain a compact authorization directory prefix list. However, when the execution context of the pre-node drifts, the supplementary audit node will still be instantiated and enter the permission construction process. It cannot block the mismatched node before startup, so the metric "the situation of entering the subsequent process after context mismatch" cannot be improved.
[0094] (3) If only the unified path entry deduplication verification is used without dynamic authorization boundary generation, the supplementary audit node can reduce the number of times duplicate paths are normalized. However, since the authorization boundary is still a static directory whitelist, the average number of entries in the directory authorization boundary remains at a high level, which means that the average number of prefix matching times for a single instruction cannot be effectively reduced, and the overall verification efficiency is limited.
[0095] Therefore, the four control chains of this invention constitute an inseparable continuous defense closed loop, and the overall technical effect of this invention cannot be achieved without any one of the links.
[0096] In summary, this method and system for read-only execution control of supplementary audit nodes for intelligent agents connects execution context fingerprint and ticket verification, dynamic compact authorization directory prefix generation, proactive environmental variable purification, and relative path verification based on kernel file descriptors into a complete continuous defense closed loop, forming four major control chain schemes: timing locking, dynamic boundary, proactive purification, and kernel object anchoring.
[0097] The technical features disclosed above are not limited to the combinations of the disclosed features with other features. Those skilled in the art can also make other combinations of the technical features according to the purpose of the invention to achieve the purpose of the invention.
Claims
1. A method for read-only execution control of an agent-auditing node, characterized in that, include: Obtain the execution results of the preceding audit nodes; When the exception flag meets the triggering conditions, a supplementary audit node insertion request is generated. Generate and match execution context fingerprints before instantiating supplementary audit nodes, and cancel startup if a mismatch occurs; During matching, the set of directories accessed by the preceding audit node and the preset set of read-only directories are processed to obtain a compact authorized directory prefix list, and a set of read-only permissions containing the compact authorized directory prefix list is assigned to the supplementary audit node; Before executing the candidate audit instruction, the parameter segment after the termination option is marked, the path parameter and the redirection target are uniformly extracted into a set of path entries to be verified, and path verification is performed based on the compact authorized directory prefix list; Execution will be blocked if an unauthorized path entry exists or output is redirected. When input redirection exists, perform path validation on the input redirection target. If the validation passes, execution is allowed to continue; if the validation fails, execution is blocked. 2.The read-only execution control method of an intelligent agent supplementary auditing node according to claim 1, wherein, The normalization process for the executed instruction sequence and the absolute path of the current working directory includes at least one of the following: eliminating irrelevant space differences, unifying the path separator format, expanding relative paths into absolute paths by combining them with the corresponding working directory, and unifying the directory end separator format; the relative paths in the candidate audit instructions are converted into absolute paths by combining them with the current working directory before participating in path verification, and the "." and ".." path traversal symbols are parsed and eliminated during the path normalization process.
3. The read-only execution control method for supplementary audit nodes of an intelligent agent according to claim 1, characterized in that, The context items involved in generating the current execution context fingerprint and the initial execution context fingerprint also include a set of environment variables, which are sorted by variable name before being concatenated. Before the supplementary audit node is instantiated and after the compact licensed directory prefix list is generated, the system uses the compact licensed directory prefix list as the dynamic license boundary to actively clean high-risk environment variables in the execution environment. The active cleaning includes: extracting high-risk environment variables in the execution environment, which at least include executable file search paths and dynamic link library loading paths; extracting path entries contained in the high-risk environment variables, and using the dynamic license boundary represented by the compact licensed directory prefix list as the basis for filtering, eliminating, or rewriting for matching and verification. Path entries that exceed the license boundary represented by the compact licensed directory prefix list during the matching and verification will be forcibly filtered, eliminated, or rewritten from the high-risk environment variables.
4. The read-only execution control method for supplementary audit nodes of an intelligent agent according to claim 1, characterized in that, The compact authorized directory prefix list is generated by performing absolute path normalization, deduplication, and sorting on the set of directories accessed by the pre-audit node and the preset read-only directory set, then finding their intersection, and deleting redundant directory entries covered by the parent directory prefix.
5. The read-only execution control method for supplementary audit nodes of an intelligent agent according to claim 1, characterized in that, After the compact authorized directory prefix list is generated, the system further records object identity identifiers for the directory prefixes in the compact authorized directory prefix list. The object identity identifiers include at least one or more of the following: device identifier, inode identifier, and mount point identifier. During the execution of the supplementary audit node, after the path to be accessed is normalized to an absolute path, its object identity identifier is first parsed and its consistency is verified with the object identity identifier recorded at the authorization boundary. After the object identity consistency verification is passed, the system calls the directory open interface to obtain and maintain the directory file descriptor of the corresponding directory prefix, so as to form an authorization benchmark anchored to the underlying system kernel.
6. The read-only execution control method for supplementary audit nodes of an intelligent agent according to claim 1, characterized in that, When generating the supplementary audit node insertion request, a single execution authorization ticket corresponding to each supplementary audit node insertion request is generated simultaneously. The supplementary audit node insertion request identifier is determined by the current execution context fingerprint and the candidate audit instruction digest. The single execution authorization ticket is bound to the supplementary audit node insertion request identifier, the initial execution context fingerprint, the candidate audit instruction digest, and a random number, and optionally bound to the compact authorization directory prefix list digest, timestamp, and validity period. Before the supplementary audit node is instantiated, the single execution authorization ticket is validated. The supplementary audit node is allowed to enter the instantiation process only if the ticket has not been consumed, the ticket binding information is consistent with the current supplementary audit node insertion request, and the ticket validation passes. After the validation passes, the single execution authorization ticket is marked as consumed, deleted, or invalid.
7. The read-only execution control method for supplementary audit nodes of an intelligent agent according to claim 5, characterized in that, After acquiring and maintaining the directory file descriptor, the system continues to perform path resolution chain semantic verification on the path to be accessed. In the path resolution chain semantic verification and subsequent actual file access operations, the system forces relative path traversal and access based on the maintained directory file descriptor. The path resolution chain semantic verification includes detecting whether symbolic link jumps, binding mount jumps, mount namespace switching, and cross mount point jumps occur in the resolution chain based on the relative path resolution. When the resolution chain crosses the authorized root represented by the compact authorized directory prefix list, crosses the preset allowed mount boundary, or enters an unauthorized mount point, the execution of the candidate audit instruction is directly blocked.
8. A read-only execution system for an agent supplementary audit node, used to run a read-only execution control method for an agent supplementary audit node according to any one of claims 1-7, characterized in that, include: The result receiving module is used to obtain the execution results of the previous audit node, which includes anomaly markers, candidate audit instructions, and the set of directories accessed by the previous audit node. The triggering module is used to generate a supplementary audit node insertion request when the abnormality marker indicates an abnormal state and the command family to which the candidate audit instruction belongs is within a preset audit command family set; The context verification module is used to generate and verify the execution context fingerprint before the supplementary audit node is instantiated, and to cancel the startup of the supplementary audit node in case of mismatch. The authorization boundary generation module is used to generate a compact authorization directory prefix list when performing context fingerprint matching, and to allocate a read-only permission set containing the compact authorization directory prefix list to the supplementary audit node; The path verification module is used to uniformly extract the set of path entries to be verified corresponding to the parameter segment after the termination option mark, the path parameters, and the redirection target before the supplementary audit node executes the candidate audit instruction, and to perform path verification and path parsing chain semantic verification based on the compact authorized directory prefix list. The blocking module is used to block the execution of the candidate audit instruction or block the instantiation of the supplementary audit node when there is an unauthorized path entry, the candidate audit instruction contains output redirection, the input redirection target verification fails, or the single execution authorization ticket verification fails.
9. A read-only execution system for supplementing audit nodes of an intelligent agent according to claim 8, characterized in that, The authorization boundary generation module is also used to record the object identity identifier corresponding to the compact authorization directory prefix list. The context verification module is also used to extract high-risk environment variables containing executable file search paths and dynamic link library loading paths, and perform filtering, elimination, or rewriting based on the compact authorization directory prefix list, and verify the validity of the single execution authorization ticket that corresponds one-to-one with the supplementary audit node insertion request. The path verification module is also used to obtain and maintain the directory file descriptor after the path prefix matching is successful and the object identity is consistent, and initiate relative path resolution based on the directory file descriptor to detect whether symbolic link jumps, mount point crossings, or object identity drifts occur in the path resolution chain. The filtering, elimination, or rewriting of the high-risk environment variables, as well as the acquisition of the directory file descriptor and subsequent relative path resolution, are all based on the authorization boundary represented by the compact authorization directory prefix list.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements a read-only execution control method for supplementary audit nodes of an intelligent agent as described in any one of claims 1 to 7.