A method, system, and medium for intelligent detection of semantic vulnerabilities in industrial control protocols.
By constructing a persistent state effect contract with response conditionation, and collecting and determining persistent state snapshots of industrial control protocols, the problem of silent logic vulnerabilities that are difficult to detect in existing technologies, where the device has not crashed but its state has been corrupted, is solved, thus achieving efficient semantic vulnerability detection.
Patent Information
- Application Number
- CN202611514887.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-28
- Publication Date
- 2026-11-17
AI Technical Summary
Existing technologies struggle to detect silent logic vulnerabilities in industrial control protocols where devices have not crashed but their persistent state has been corrupted, and lack a mechanism to determine the consistency between actual response semantics and persistent state effects.
A persistent state effect contract with response conditionalization is constructed. By deploying state acquisition probes in the target protocol operation, persistent state snapshots before and after the operation are collected. Based on the response semantics, the set of allowed modifications and the state effect predicate are selected to determine the consistency between the response and the state effect.
Without crashing the target device, it automatically discovers silent logic vulnerabilities where persistent state is corrupted, improving the ability to discover semantic-level vulnerabilities where the device is alive but its state is corrupted, and has good accuracy and applicability.
Smart Images

Figure CN123122992A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial control protocol security testing and vulnerability detection technology, and in particular to an intelligent detection method, system and medium for semantic vulnerabilities in industrial control protocols. Background Technology
[0002] In industrial control systems, industrial control protocols such as BACnet, IEC 61850 / MMS, IEC 60870-5-104, Modbus / TCP, and EtherNet / IP are responsible for the interaction of device status information and control commands, and are widely deployed in critical infrastructures such as building automation, industrial control, and power automation. Defects in the implementation of these protocols, especially semantic-level logical defects that "do not cause process crashes but disrupt persistent state," can lead to uncontrolled industrial equipment or data loss. How to discover such silent logical vulnerabilities without causing device crashes has become a pressing technical problem to be solved in the security testing of industrial control protocols.
[0003] Currently, fuzz testing of industrial control protocols mainly employs methods based on crash criteria and code coverage feedback. These schemes typically use observable faults such as process crashes, suspensions, and memory safety violations as the basis for defect judgment, and use signals such as code coverage and protocol state coverage to drive seed scheduling and mutation energy allocation. However, while these mechanisms are effective for memory corruption vulnerabilities, their ability to identify silent logic vulnerabilities—where the response appears normal, the device remains alive, but the persistent state has been corrupted—is limited. On the one hand, pure crash criteria are insufficient to expose data corruption or state errors that do not accompany abnormal exits; on the other hand, existing solutions generally lack mechanisms to determine the consistency of state effects among the protocol response, the persistent state before the operation, and the persistent state after the operation.
[0004] In 2020, Pham et al. published a paper titled "AFLNET: A Greybox Fuzzer for Network Protocols" at the ICST conference, proposing a fuzzing method for stateful protocols based on protocol state feedback. This method extends traditional coverage feedback mechanisms by inferring protocol state using server response codes and combining code coverage with protocol state feedback to guide the fuzzing process. However, the feedback information in this method is mainly used for state space exploration and test scheduling; vulnerability discovery still relies primarily on abnormal behaviors such as crashes. No contractual determination mechanism between protocol responses and persistent state effects has been established, making it difficult to identify silent logic vulnerabilities where responses are normal but persistent states are abnormal. In 2022, Natella published a paper titled "StateAFL: Greybox Fuzzing for StatefulNetwork Servers" in the journal *Empirical Software Engineering*, proposing to snapshot and fuzz-hash long-lived memory regions of stateful network services, and use this to infer protocol state and guide coverage exploration. This work points out that response codes alone may not accurately represent the internal protocol state of the server. However, its state snapshots are mainly used for protocol state inference and fuzz test guidance. No response conditional contract defining "actual response → expected persistent side effects" is found, nor are there any sets of allowed modifications and state effect predicates for the corresponding responses.
[0005] The existing invention patent CN116805928A, "A Method and System for Differential Fuzzing of Stateful Protocols Guided by Behavioral Differences," discloses a method for guiding differential fuzzing of stateful protocols by comparing the behavioral differences of multiple protocol implementations for the same input. This scheme can discover logical or semantic differences between different implementations, but its judgment relies on the inconsistency of behavior among multiple implementations, rather than judging whether the "actual response is consistent with its own persistent state side effects" for a single protocol implementation. It does not establish a persistent state effect contract conditionalized for the response. The invention patent CN119071083A, "A Protocol Vulnerability Analysis System and Method Based on State Saving / Restoration," discloses a scheme that uses a snapshot mechanism to save the protocol execution state and compares the differences in memory, register, and network states in different snapshots to determine the inputs leading to state transitions and identify potential vulnerabilities or unstable behavioral patterns. This scheme has introduced state snapshots and differential analysis mechanisms, but its differential analysis is mainly used to identify state transitions and abnormal patterns. It does not select the corresponding allowed modification set and state effect predicate based on the actual protocol response category, nor does it further determine whether the actual persistent state change exceeds the allowed side effects range of the response. Another invention patent, CN119645883A, entitled "A Fuzzy Testing Method and System for Stateful Protocols Based on Response Information," discloses a fuzzy testing method that further subdivides protocol states using response codes and response header fields in the response results, and adjusts state selection, seed value, and mutation positions in conjunction with coverage information. This scheme enhances the role of response information in protocol state identification and test scheduling; however, the response information is mainly used for "response → state identification → test scheduling," without mapping different response semantics to different permissible state effect spaces, or further determining whether actual side effects conform to response semantics through object-level persistent state differences before and after operations.
[0006] In summary, existing technologies have conducted research on protocol state feedback, long-lifecycle state snapshots, multi-implementation differential, state preservation and snapshot differential, and response-driven protocol state identification. However, existing solutions generally fail to fully establish a combined mechanism of "industrial control protocol operation + request context + actual response semantic classification + response conditional effect template + allowed modification set corresponding to the response + state effect predicate + object-level persistent state differential + stable observation and effect attribution + silent logic vulnerability determination." In particular, a detection mechanism is still lacking, which selects the corresponding allowed side effect space based on the actual response semantics and then judges whether the response and state effect are consistent through changes in the actual persistent state at the object level. Summary of the Invention
[0007] The purpose of this invention is to overcome the shortcomings of the prior art and provide an intelligent detection method, system and medium for semantic vulnerabilities in industrial control protocols, thereby solving the deficiencies of the prior art.
[0008] The objective of this invention is achieved through the following technical solution: an intelligent detection method for semantic vulnerabilities in industrial control protocols, the method comprising:
[0009] S1. Construct a persistent state effect contract with response conditionalization for the target protocol operation and its request semantics; identify persistent state objects related to the target protocol operation from the target program source code, and deploy state acquisition probes at the entry and exit points of the processing functions, while configuring observation strategies corresponding to various response semantics; execute the pre-message sequence generated by fuzzing to establish the protocol pre-state required by the target operation;
[0010] S2. Collect a persistent state snapshot before the target operation is executed. and according to Request semantics of the target operation For predefined state premise predicates Make a judgment; if If the preconditions are met, proceed to the target operation execution step; if If the target operation request semantics are not executed, the preceding message sequence is re-executed to establish a protocol state that satisfies the preceding conditions, or the current test sequence is terminated and the next test sequence is scheduled.
[0011] S3. Execute the request semantics of the target operation I. After executing the request semantics of the target operation, perform crash judgment and response parsing.
[0012] S4. Based on the observation strategy corresponding to the response semantics, determine whether a stable observation point has been reached; if so, collect a persistent state snapshot. If the maximum observation time is exceeded If a stable observation point has not yet been reached, the observation result will be recorded as... It will not be included in the subsequent effect assessment;
[0013] S5. Normalize the snapshots before and after the operation for each object and calculate the object-level differences, based on the response semantics. Select the corresponding allowed modification set and state effect predicate, and perform response legality judgment, out-of-bounds modification judgment and effect judgment;
[0014] S6. If S5 determines that the state effect is inconsistent and the target has not collapsed, then mark it as a semantic vulnerability candidate and feed the determination result back to the fuzz test scheduler; otherwise, continue scheduling according to the normal coverage / risk feedback.
[0015] In S1, the probe only collects the normalized semantic values and value summaries of persistent state objects related to the contract. The normalized semantic values are used for state effect predicate determination, and the value summaries are used to efficiently determine whether the object has changed.
[0016] The crash detection and response analysis includes:
[0017] Determine whether the target has crashed by monitoring the running status and abnormal exit information of the target process, service instance, or container;
[0018] If the target process exits abnormally, is terminated by an abnormal signal, or the corresponding service instance stops running, it is determined to be a crash, recorded as a crash-type vulnerability, and enters the defect analysis.
[0019] If the target is still running, the response observation results are parsed and classified according to the target protocol's message format and the preset response semantic mapping rules to obtain the response semantics. ;
[0020] If the target is still running but does not receive a valid response within the preset response waiting time, it will be handled according to the timeout / no response semantics.
[0021] The contract in S1 describes the target protocol operation under what preconditions, for what kind of request, and what kind of response should be returned, and under each type of response semantics, which persistent state objects are allowed to be modified and what state effects should be satisfied.
[0022] The persistent state effect contract for constructing response conditionalization of the target protocol operation and its request semantics specifically includes:
[0023] A1. Define the response conditional state effect contract, the contract This is a six-tuple where Pre represents the state prerequisite predicate that must be satisfied before the operation is executed, Op represents the protocol operation identifier, Req represents the request semantic description of the target protocol operation, Resp represents the set of response semantic categories for the operation, and A represents the allowed response set function. Indicates by response semantics A set of state effect templates for categorization;
[0024] A2. Define the response semantic classification and response conditional state effect template, and let the response observation results... Represents the observation results after the target operation is executed, and the response semantics. By classification function Effect on response observation results get ,when When processing the actual response message, the protocol fields representing the operation execution result, such as response type, status code, and error code, are parsed, and the corresponding response semantics are determined according to preset response semantic mapping rules. If the response is TIMEOUT or NO_RESPONSE, it is categorized into the corresponding timeout / no response semantics; for each type of response semantics... Define the corresponding state effect template ,when When it is a success semantic, Successful postpredicate ,when When it is a failure semantic, Take failure rollback predicate ;when When the semantics are timeout / no response, they are not simply equated with failure; instead, the observation strategy corresponding to that timeout / no response semantics is selected. Supplementary queries are performed on the persistent state of the target, and after a stable observation point is reached, the state effect template corresponding to the response semantics is used. A judgment is made, in which... This refers to the set of persistent state objects that are allowed to be modified under this response semantics. The state effect predicate that should be satisfied under this response semantics. The observation strategy corresponding to this response semantics;
[0025] A3. According to the allowed response set function in the contract Regarding the state before operation With request semantics Determine the set of allowed responses ;
[0026] A4. Define the effect predicate of idempotent operations. For operations that are defined as idempotent by the contract, the first execution yields... and judge Whether it is true or not, when At that time, with To obtain the result, perform the same operation again on the previous state, and get... ,when In this case, no idempotency determination is performed; during semantically relevant state projection... Above comparison and If they are inconsistent, it is determined that the idempotency has been violated.
[0027] S5 specifically includes the following:
[0028] S501. Normalize the persistent state snapshots before and after the operation for each object to form an object-level summary. ;
[0029] S502. Calculate the set of persistent state objects whose values have actually changed based on object-level digests. ;
[0030] S503. By associating the execution or operation context identifier with the write event through a single-trial isolation method, a corresponding execution context identifier is associated with each persistent state write event, making... This represents the set of execution context identifiers associated with the current target operation, resulting in the set of effect objects belonging to the target operation. When using operation context identifiers for state effect attribution, state changes that are unrelated to the execution context of the current target operation are not included in subsequent out-of-bounds modification determination and state effect predicate determination.
[0031] S504, Determine the actual response semantics Does it belong to the allowed response set? If it does not belong to the category, then a response legality defect is found.
[0032] S505, Based on response semantics Select the corresponding template Determine the set of actual changed objects belonging to the target operation. Does it go beyond the set that is allowed to be modified under the semantics of this response? If it goes beyond the bounds, the hit will be modified to avoid the boundary.
[0033] S506. Determine the state effect predicate under the semantics of this response. Does it meet the requirements? , where the symbol Indicates the NOT operation. Representing response semantics The corresponding state effect predicate, when the state effect predicate is not satisfied, i.e. If the hit effect is abnormal, the state effect predicate is only judged for contract-related state changes that belong to the execution context of the current target operation. State changes that are not related to the current target operation are not included in the calculation of the predicate. If the state effect predicate is not satisfied, the hit effect is missing.
[0034] S507, combining response legality judgment, out-of-bounds modification judgment and effect judgment. When any judgment is hit, it is determined that the test sequence has triggered state effect inconsistency. If the target does not crash at the same time, it is marked as a semantic vulnerability candidate.
[0035] S508. For operations specified as idempotent by the contract, perform the same operation twice as in step A4 and compare the semantically relevant state projections, based on... Perform an idempotency test, where, This indicates the result of the idempotency anomaly determination. Indicates whether the target operation is an idempotent operation. This indicates whether the state after the first execution meets the preconditions for executing the operation again. and These represent the semantically related state projections after the first and second executions, respectively. AND operation, Indicates inequality, when When this occurs, an idempotency violation is determined, and the vulnerability is marked as a semantic vulnerability candidate. As Supplementary semantic judgment in addition to comprehensive judgment.
[0036] An intelligent detection system for semantic vulnerabilities in industrial control protocols, the system comprising: a response conditional state effect contract construction module, a persistent state object identification and stable observation module, a protocol response semantic parsing module, an object-level state difference and effect determination module, and a fuzzy test closed-loop feedback module;
[0037] The response-conditional state effect contract construction module constructs a response-conditional state effect contract for the target protocol operation, defines an allowed response set function A, and defines a corresponding allowed modification set, state effect predicate and observation strategy for each type of response semantics. After persistent storage, it serves as the basis for subsequent consistency determination.
[0038] The persistent state object identification and stable observation module identifies persistent state objects that the protocol operation will read and write from the target program source code, and deploys state acquisition probes at the entry and exit of the protocol operation processing function. At the same time, after receiving the target response or reaching the preset response waiting threshold and determining that it is timed out / no response, it implements stable observation according to the corresponding observation strategy.
[0039] The protocol response semantic parsing module: under the premise that the target has not crashed, according to the message format and protocol specifications of the target industrial control protocol, parses the response type, status code and error code in the response message, and according to the preset response semantic mapping rules, classifies the response observation results into the semantic categories of success, failure, timeout / no response waiting, and outputs the response semantic r.
[0040] The object-level state difference and effect determination module takes the pre-operation state snapshot, response semantic tag, post-operation state snapshot and response conditional state effect contract as input. It first normalizes the pre-operation and post-operation states on an object-by-object basis and calculates the object-level difference. Then it performs response legality determination, out-of-bounds modification determination and effect determination to determine whether the actual side effect belongs to the effect space allowed by the response semantic.
[0041] The fuzzy testing closed-loop feedback module receives the output of the object-level state difference and effect determination module. When a test sequence is determined to be non-collapsed but with inconsistent state and effect, it is recorded as a semantic vulnerability candidate, and the determination result is used as a feedback signal to adjust the priority and mutation energy allocation of the corresponding seed.
[0042] A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of an intelligent detection method for semantic vulnerabilities in industrial control protocols.
[0043] The present invention has the following advantages:
[0044] 1. This invention improves the ability to detect semantic-level vulnerabilities where the device is alive but its persistent state is corrupted by performing semantic consistency determination based on response-conditional persistent state effect contracts. By collecting the state difference before and after object-level operations under the same operational context, and selecting the corresponding allowed modification set and state effect constraints according to the actual response semantics, this invention can automatically detect silent logic vulnerabilities where the persistent state is corrupted even when the target device does not crash and the response appears normal.
[0045] 2. Using response legality judgment, object-level state difference and the out-of-bounds relationship of the allowed modification set under the response semantics, and whether the state effect predicate is satisfied as the judgment criteria, it is more specific and engineerable than simply "checking whether the state is legal". The judgment result can locate the specific out-of-bounds object and the unsatisfied effect predicate.
[0046] 3. Only one target implementation is needed to complete the judgment, without relying on the comparison of behavioral differences between multiple implementations. It is suitable for industrial control protocol scenarios with only a single target implementation. At the same time, the normative expected behavior is defined by the protocol specification and security policy. The target implementation source code is only used for mapping the abstract state to the observable object, avoiding the existing defects in the target implementation from affecting the definition of the normative expected behavior and reducing the risk of contract pollution caused by incorrect implementation.
[0047] 4. By using a stable observation strategy and semantically related state projection, Ming effectively suppresses false alarms caused by asynchronous database writing, delayed submission, and background thread updates, and eliminates interference from legitimate auxiliary state changes such as timestamps, audit logs, and access counters, thereby improving the accuracy of semantic vulnerability determination.
[0048] 5. It possesses good versatility and scalability, and can be adapted to various stateful industrial control protocols such as BACnet, IEC 61850 / MMS, IEC 60870-5-104, Modbus / TCP, and EtherNet / IP. At the same time, this invention uses the semantic consistency determination result as a feedback signal to feed back into the seed scheduling and mutation energy allocation stage of fuzzy testing, forming a closed loop of "testing-determination-directional scheduling" to improve testing efficiency. Attached Figure Description
[0049] Figure 1 This is an architecture diagram of the system of the present invention.
[0050] Figure 2 This is a flowchart illustrating the method of the present invention. Detailed Implementation
[0051] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the detailed description of the embodiments of this application provided below with reference to the accompanying drawings is not intended to limit the scope of protection of the claimed application, but merely represents selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application. The present invention will be further described below with reference to the accompanying drawings.
[0052] This invention aims to automatically detect silent logic vulnerabilities in industrial control protocol implementations where "equipment survives but its persistent state is corrupted," requiring only a single objective to be achieved. The intelligent detection is achieved through automatic parsing of protocol response semantics, automatic determination of object-level persistent state differences and state effects, and fuzzy testing closed-loop feedback scheduling. This invention establishes a "response-conditional persistent state effect contract" for stateful industrial protocol operations. It collects state differences before and after object-level operations within the same operational context and selects the corresponding allowed modification set and post- / rollback constraints based on the actual response semantics, thereby detecting inconsistencies between the response result and the actual persistent side effects. The persistent state refers to a state whose lifecycle spans the target protocol operation and influences subsequent protocol behavior. It does not necessarily need to be located on a non-volatile medium and specifically includes device object databases, data models and datasets, register and coil mappings, file content, and on-heap session / connection structures whose lifecycles span protocol operations. The persistent state object can be refined into independent semantic state units such as variables, records, attributes, fields, and register units to avoid treating the entire database as a single object. In the judgment process, the crash criterion serves as the first layer of judgment, determining whether the target has terminated abnormally based on the running status and abnormal exit information of the target process, service instance, or container; the state effect criterion serves as the second layer of judgment if the target is still alive. By using the effect consistency judgment result as a feedback signal to feed back into the seed scheduling and mutation energy allocation stage of fuzzing, this invention can achieve targeted discovery of silent logic vulnerabilities without crashing the target device, and is applicable to security testing of stateful industrial control protocols such as BACnet, IEC 61850 / MMS, IEC 60870-5-104, Modbus / TCP, and EtherNet / IP.
[0053] like Figure 1 As shown, one embodiment of the present invention relates to an intelligent detection system for semantic vulnerabilities in industrial control protocols, which specifically includes the following:
[0054] The Response Conditioned State Effect Contract Construction Module is a module that defines prescriptive expected behavior based on protocol specifications and security policies, and whose target implementation source code is used only to map abstract states in the contract to concrete observable objects (variables, objects, files, database records, etc.). This module constructs a response conditioned state effect contract for the target protocol operation and defines allowed response set functions. For each type of response semantics, a corresponding set of allowed modifications, state effect predicates, and observation strategies are defined and persistently stored as the basis for subsequent consistency determination.
[0055] Persistent State Object Identification and Stable Observation Module: This module identifies persistent state objects that the protocol operation will read and write from the target program source code, deploys state acquisition probes at the entry and exit points of the protocol operation processing function, and implements stable observation according to the corresponding observation strategy after receiving the target response or reaching the preset response waiting threshold and determining that it is timed out / no response.
[0056] Protocol Response Semantic Parsing Module: This module, assuming the target has not crashed, parses the response type, status code, error code, and other fields in the response message according to the message format and protocol specifications of the target industrial control protocol. Based on preset response semantic mapping rules, it categorizes the response observation results into response semantic categories such as success, failure, timeout / no response, and outputs the response semantics. The module.
[0057] Object-level state difference and effect determination module: The object-level state difference and effect determination module is a module that takes the state snapshot before operation, the response semantic tag, the state snapshot after operation, and the response conditional state effect contract as input. It first normalizes the state before and after operation on an object-by-object basis and calculates the object-level difference. Then it performs response legality determination, out-of-bounds modification determination, and effect determination to determine whether the actual side effect belongs to the effect space allowed by the response semantic.
[0058] Fuzzy Testing Closed-Loop Feedback Module: The fuzzy testing closed-loop feedback module receives the output of the object-level state difference and effect determination module. When a test sequence is determined to be "not collapsed but state effect inconsistent", it is recorded as a semantic vulnerability candidate and the determination result is used as a feedback signal to adjust the priority and mutation energy allocation of the corresponding seed.
[0059] like Figure 2As shown, another embodiment of the present invention relates to an intelligent detection method for semantic vulnerabilities in industrial control protocols, specifically including the following steps:
[0060] Step 1: Constructing a response-conditional state effect contract: Construct a response-conditional persistent state effect contract for the target protocol operation and its request semantics. The contract describes the operation under what preconditions, for what request, and what response should be returned, and under each type of response semantics, which persistent state objects are allowed to be modified and what state effects should be satisfied.
[0061] Furthermore, step 1 specifically includes the following:
[0062] Step 101: Define the response-conditional state-effect contract. Contract It is a six-tuple, where Pre represents the state prerequisite predicate that must be satisfied before the operation is executed, and its state snapshot before the operation. With request semantics Make a judgment above; when When, allow entry into the target operation execution step; when If the current state does not meet the applicable prerequisites of the contract, the target operation will not be executed, and the preceding state will be re-established or the current test sequence will end; Op is the protocol operation identifier; Req is the request semantic description of the target protocol operation; Resp is the set of response semantic categories for this operation; A is the allowed response set function, used to determine the response set based on the preceding state. With request semantics Determine the set of response semantic categories allowed by the protocol in the current context. ,in ; To be based on response semantic category A set of state effect templates for category classification. Let This represents the request semantics of the actual target operation executed, i.e., the running instance of Req in the contract. The prescriptive expected behavior is defined by the protocol specification and security policy; the target implementation source code is only used to map abstract states to concrete observable objects and is not the source of the expected correct behavior.
[0063] Step 102: Define the response semantic classification and response conditional state effect template. Let the response observation results... This represents the observation result after the target operation is executed. Its value range includes the actual response message and the case where no valid response message is received. The actual response message is denoted as ResponseMessage, the case where no valid response is received after a preset response waiting time is denoted as TIMEOUT, and the case where the target does not return a response message is denoted as NO_RESPONSE. Therefore, the response observation result satisfies... ∈ ResponseMessage ∪ {TIMEOUT, NO_RESPONSE}; Response semantics By classification function Effect on response observation results get The classification function Pre-established based on the message format and protocol specifications of the target industrial control protocol: When When processing the actual response message, the protocol fields in the response message that can characterize the operation execution result, such as the response type, status code, and error code, are parsed, and the corresponding response semantics are determined according to the preset response semantic mapping rules; when If the response is TIMEOUT or NO_RESPONSE, it is categorized into the corresponding timeout / no response semantics. For each type of response semantics... Define the corresponding state effect template ,in, This refers to the set of persistent state objects that are allowed to be modified under this response semantics. The state effect predicate that should be satisfied under this response semantics ( Semantics of the request Compared with the state before operation change, This is the observation strategy corresponding to the semantics of the response. When it is a success semantic, Successful postpredicate ;when When it is a failure semantic, Take failure rollback predicate ;when When the semantics are timeout / no response, they are not simply equated with failure; instead, the observation strategy corresponding to that timeout / no response semantics is selected. Supplementary queries are performed on the persistent state of the target, and after a stable observation point is reached, the state effect template corresponding to the response semantics is used. Make a judgment.
[0064] Step 103: Determine the allowed response set. Based on the allowed response set function in the contract. Regarding the state before operation With request semantics Determine the set of allowed responses , indicating in The set of response semantic categories allowed by the protocol in the context, where If the actual response semantics Not belonging to If so, the response itself constitutes a semantic defect in the protocol.
[0065] Step 104: Define the effect predicate of the idempotent operation. For an operation that is idempotent according to the contract, the first execution yields... and judge Whether it is true; when At that time, with To obtain the result, perform the same operation again on the previous state, and get... ;when In this case, no idempotency determination is performed. This is done during semantically relevant state projection. Above comparison and If they are inconsistent, it is determined to be an idempotency violation, where semantically related state projections... Exclude auxiliary states that are allowed to change, such as timestamps, audit logs, and access counters.
[0066] Step 2, Persistent State Object Identification and Stable Observation Deployment: Identify persistent state objects related to the target protocol operation from the target program source code, and deploy state acquisition probes at the entry and exit points of the processing functions. At the same time, configure observation strategies corresponding to various response semantics. The probes only collect normalized semantic values and value summaries of persistent state objects related to the contract. The normalized semantic values are used for state effect predicate determination, and the value summaries are used to efficiently determine whether the object has changed.
[0067] Step 3: Execute the pre-state sequence to establish the pre-state: Execute the pre-state sequence generated by the fuzz test to establish the protocol pre-state required for the target operation; the pre-state sequence is used to establish the pre-state and is not part of the target operation.
[0068] Step 4: Confirm prerequisites and collect a snapshot of the state before the operation: Collect a persistent snapshot of the state before the target operation is executed. and according to Request semantics of the target operation For predefined state premise predicates Make a judgment; if If the preconditions are met, proceed to the target operation execution step; if If the target operation request semantics are not executed, the preceding message sequence is re-executed to establish a protocol state that satisfies the preceding conditions, or the current test sequence is terminated and the next test sequence is scheduled.
[0069] Step 5: Execute the target operation: The request semantics for executing the target operation. .
[0070] Step 6: Crash Assessment and Response Parsing: After executing the request semantics of the target operation, the system monitors the running status and abnormal exit information of the target process, service instance, or container to determine if the target has crashed. If the target process exits abnormally, is terminated by an abnormal signal, or the corresponding service instance stops running, it is determined to be a crash, recorded as a crash-type vulnerability, and enters defect analysis. If the target is still running, the protocol response semantic parsing module parses and classifies the response observation results according to the message format of the target protocol and the preset response semantic mapping rules to obtain the response semantic label. If the target is still running but does not receive a valid response within the preset response waiting time, it will be handled according to the timeout / no response semantics.
[0071] Step 7: Stabilize observations and collect post-operation state snapshots: Based on the observation strategy corresponding to the response semantics, determine whether a stable observation point has been reached; if so, collect a persistent state snapshot. If the maximum observation time is exceeded If a stable observation point has not yet been reached, the observation result will be recorded as... If the result is not included in the subsequent effect assessment, it will be marked as a pending candidate and submitted for manual review.
[0072] Step 8: Object-level state difference and response conditionation effect determination: Normalize the snapshots before and after the operation for each object and calculate the object-level difference, based on the response semantics. Select the corresponding allowed modification set and state effect predicate, and perform response legality judgment, out-of-bounds modification judgment, and effect judgment.
[0073] Furthermore, the specific implementation process of step 8 is as follows:
[0074] Step 801, Object-level Summary. Normalize the persistent state snapshots before and after the operation for each object to form an object-level summary. ,in, For object identification, This is for normalized semantic values (used for performance state effect predicate determination). This is a value summary (used to efficiently determine whether an object has changed).
[0075] Step 802: Object-level state differentiation. Calculate the set of persistent state objects whose values have actually changed based on the object-level summary. ,in For object-by-object normalized projection.
[0076] Step 803, State Effect Attribution. By isolating the execution or operation context identifier and associating it with the write event through a single trial, associate each persistent state write event with a corresponding execution context identifier (session_id / request_id / thread_id); let... Representing the set of execution context identifiers associated with the current target operation (a single context identifier, or multiple associated context identifiers in the case of asynchronous writes across threads), we obtain the set of effect objects belonging to the target operation. ,in, This indicates the execution context identifier that caused the change in object o. When using the operation context identifier for state effect attribution, state changes unrelated to the current target operation's execution context are not included in subsequent out-of-bounds modification determination and state effect predicate determination.
[0077] Step 804: Response Legality Determination. (Passed) Determine the actual response semantics Does it belong to the allowed response set? If it does not belong to the category, then a legality defect in the response is hit.
[0078] Step 805: Out-of-bounds modification judgment. Based on the response semantics. Select the corresponding template ,pass Determine the set of actual changed objects belonging to the target operation. Does it go beyond the set that is allowed to be modified under the semantics of this response? If it goes beyond the boundary, the hit will be modified.
[0079] Step 806, Effect Determination. (Through...) Determine the state effect predicate under the semantics of this response. Does it satisfy, where, symbol Indicates the NOT operation. Representing response semantics The corresponding state effect predicate; when the state effect predicate is not satisfied, i.e. If the hit effect is abnormal, the state effect predicate is only used to determine the contract-related state changes that belong to the execution context of the current target operation. State changes that are not related to the current target operation are not included in the calculation of the predicate. If the state effect predicate is not satisfied, the hit effect is missing.
[0080] Step 807, Comprehensive Judgment. Pass. The comprehensive response includes legality assessment, boundary violation modification assessment, and effect assessment. Among these, the symbol... Represents a logical OR operation; This indicates the inconsistency in the overall state effect determination. This indicates the result of the legality determination of the response. This indicates that the judgment result has been modified due to exceeding the boundary. This indicates the result of the state effect determination. When... , and If any of the judgment results is true, then If the test sequence triggers a state effect inconsistency, and the target does not crash at the same time, it is marked as a semantic vulnerability candidate.
[0081] Step 808, Idempotency Determination. For operations defined as idempotent by the contract, perform the same operation twice as in step 104 and compare the semantically related state projections, based on... Perform an idempotency test, where, This indicates the result of the idempotency anomaly determination. Indicates whether the target operation is an idempotent operation. This indicates whether the state after the first execution meets the preconditions for executing the operation again. and These represent the semantically related state projections after the first and second executions, respectively; symbols AND operation, This indicates that they are not equal. When When this occurs, an idempotency violation is determined and the vulnerability is marked as a semantic vulnerability candidate. As Supplementary semantic judgment in addition to comprehensive judgment.
[0082] Step 9, Feedback and Scheduling: If Step 8 determines that the state effect is inconsistent and the target has not collapsed, then mark it as a semantic vulnerability candidate and feed the determination result back to the fuzz test scheduler; otherwise, continue scheduling according to the normal coverage / risk feedback.
[0083] Another embodiment of the present invention relates to a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of an intelligent detection method for semantic vulnerabilities in industrial control protocols.
[0084] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the method of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0085] The above description is merely a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the forms disclosed herein and should not be construed as excluding other embodiments. It can be used in various other combinations, modifications, and improvements, and can be altered within the scope of the concept described herein through the above teachings or related technologies or knowledge. Modifications and variations made by those skilled in the art that do not depart from the spirit and scope of the present invention should be within the protection scope of the appended claims.
Claims
1. A method for intelligent detection of semantic vulnerabilities in industrial control protocols, characterized in that: The method includes: S1. Construct a persistent state effect contract with response conditionalization for the target protocol operation and its request semantics; identify persistent state objects related to the target protocol operation from the target program source code, and deploy state acquisition probes at the entry and exit points of the processing functions, while configuring observation strategies corresponding to various response semantics; execute the pre-message sequence generated by fuzzing to establish the protocol pre-state required by the target operation; S2. Collect a persistent state snapshot before the target operation is executed. and according to Request semantics of the target operation For predefined state premise predicates Make a judgment; if If the preconditions are met, proceed to the target operation execution step; if If the target operation request semantics are not executed, the preceding message sequence is re-executed to establish a protocol state that satisfies the preceding conditions, or the current test sequence is terminated and the next test sequence is scheduled. S3. Execute the request semantics of the target operation I. After executing the request semantics of the target operation, perform crash judgment and response parsing. S4. Based on the observation strategy corresponding to the response semantics, determine whether a stable observation point has been reached; if so, collect a persistent state snapshot. If the maximum observation time is exceeded If a stable observation point has not yet been reached, the observation result will be recorded as... It will not be included in the subsequent effect assessment; S5. Normalize the snapshots before and after the operation for each object and calculate the object-level differences, based on the response semantics. Select the corresponding allowed modification set and state effect predicate, and perform response legality judgment, out-of-bounds modification judgment and effect judgment; S6. If S5 determines that the state effect is inconsistent and the target has not collapsed, then mark it as a semantic vulnerability candidate and feed the determination result back to the fuzz test scheduler; otherwise, continue scheduling according to the normal coverage / risk feedback.
2. The intelligent detection method for semantic vulnerabilities in industrial control protocols according to claim 1, characterized in that: In S1, the probe only collects the normalized semantic values and value summaries of persistent state objects related to the contract. The normalized semantic values are used for state effect predicate determination, and the value summaries are used to efficiently determine whether the object has changed.
3. The intelligent detection method for semantic vulnerabilities in industrial control protocols according to claim 1, characterized in that: The crash detection and response analysis includes: Determine whether the target has crashed by monitoring the running status and abnormal exit information of the target process, service instance, or container; If the target process exits abnormally, is terminated by an abnormal signal, or the corresponding service instance stops running, it is determined to be a crash, recorded as a crash-type vulnerability, and enters the defect analysis. If the target is still running, the response observation results are parsed and classified according to the target protocol's message format and the preset response semantic mapping rules to obtain the response semantics. ; If the target is still running but does not receive a valid response within the preset response waiting time, it will be handled according to the timeout / no response semantics.
4. The intelligent detection method for semantic vulnerabilities in industrial control protocols according to claim 1, characterized in that: The contract in S1 describes the target protocol operation under what preconditions, for what kind of request, and what kind of response should be returned, and under each type of response semantics, which persistent state objects are allowed to be modified and what state effects should be satisfied.
5. The intelligent detection method for semantic vulnerabilities in industrial control protocols according to claim 1, characterized in that: The persistent state effect contract for constructing response conditionalization of the target protocol operation and its request semantics specifically includes: A1. Define the response conditional state effect contract, the contract This is a six-tuple where Pre represents the state prerequisite predicate that must be satisfied before the operation is executed, Op represents the protocol operation identifier, Req represents the request semantic description of the target protocol operation, Resp represents the set of response semantic categories for the operation, and A represents the allowed response set function. Indicates by response semantics A set of state effect templates for categorization; A2. Define the response semantic classification and response conditional state effect template, and let the response observation results... Represents the observation results after the target operation is executed, and the response semantics. By classification function Effect on response observation results get ,when When processing the actual response message, the protocol fields representing the operation execution result, such as response type, status code, and error code, are parsed, and the corresponding response semantics are determined according to preset response semantic mapping rules. If the response is TIMEOUT or NO_RESPONSE, it is categorized into the corresponding timeout / no response semantics; for each type of response semantics... Define the corresponding state effect template ,when When it is a success semantic, Successful postpredicate ,when When it is a failure semantic, Take failure rollback predicate ;when When the semantics are timeout / no response, they are not simply equated with failure; instead, the observation strategy corresponding to that timeout / no response semantics is selected. Supplementary queries are performed on the persistent state of the target, and after a stable observation point is reached, the state effect template corresponding to the response semantics is used. A judgment is made, in which... This refers to the set of persistent state objects that are allowed to be modified under this response semantics. The state effect predicate that should be satisfied under this response semantics. The observation strategy corresponding to this response semantics is as follows: TIMEOUT indicates that no valid response has been received after the preset response waiting time has expired, and NO_RESPONSE indicates that the target has not returned a response message. A3. According to the allowed response set function in the contract Regarding the state before operation With request semantics Determine the set of allowed responses ; A4. Define the effect predicate of idempotent operations. For operations that are defined as idempotent by the contract, the first execution yields... and judge Whether it is true or not, when At that time, with To obtain the result, perform the same operation again on the previous state, and get... ,when In this case, no idempotency determination is performed; during semantically relevant state projection... Above comparison and If they are inconsistent, it is determined that the idempotency has been violated.
6. The intelligent detection method for semantic vulnerabilities in industrial control protocols according to claim 5, characterized in that: S5 specifically includes the following: S501. Normalize the persistent state snapshots before and after the operation for each object to form an object-level summary. ; S502. Calculate the set of persistent state objects whose values have actually changed based on object-level digests. ; S503. By associating the execution or operation context identifier with the write event through a single-trial isolation method, a corresponding execution context identifier is associated with each persistent state write event, making... This represents the set of execution context identifiers associated with the current target operation, resulting in the set of effect objects belonging to the target operation. When using operation context identifiers for state effect attribution, state changes that are unrelated to the execution context of the current target operation are not included in subsequent out-of-bounds modification determination and state effect predicate determination. S504, Determine the actual response semantics Does it belong to the allowed response set? If it does not belong to the category, then a response legality defect is found. S505, Based on response semantics Select the corresponding template Determine the set of actual changed objects belonging to the target operation. Does it go beyond the set that is allowed to be modified under the semantics of this response? If it goes beyond the bounds, the hit will be modified to avoid the boundary. S506. Determine the state effect predicate under the semantics of this response. Does it meet the requirements? , where the symbol Indicates the NOT operation. Representing response semantics The corresponding state effect predicate, when the state effect predicate is not satisfied, i.e. If the hit effect is abnormal, the state effect predicate is only judged for contract-related state changes that belong to the execution context of the current target operation. State changes that are not related to the current target operation are not included in the calculation of the predicate. If the state effect predicate is not satisfied, the hit effect is missing. S507, combining response legality judgment, out-of-bounds modification judgment and effect judgment. When any judgment is hit, it is determined that the test sequence has triggered state effect inconsistency. If the target does not crash at the same time, it is marked as a semantic vulnerability candidate. S508. For operations specified as idempotent by the contract, perform the same operation twice as in step A4 and compare the semantically relevant state projections, based on... Perform an idempotency test, where, This indicates the result of the idempotency anomaly determination. Indicates whether the target operation is an idempotent operation. This indicates whether the state after the first execution meets the preconditions for executing the operation again. and These represent the semantically related state projections after the first and second executions, respectively. AND operation, Indicates inequality, when When this occurs, an idempotency violation is determined, and the vulnerability is marked as a semantic vulnerability candidate. As Supplementary semantic judgment in addition to comprehensive judgment.
7. An intelligent detection system for semantic vulnerabilities in industrial control protocols, characterized in that: The system includes: a response conditional state effect contract construction module, a persistent state object identification and stable observation module, a protocol response semantic parsing module, an object-level state difference and effect determination module, and a fuzzy test closed-loop feedback module; The response-conditional state effect contract construction module constructs a response-conditional state effect contract for the target protocol operation, defines an allowed response set function A, and defines a corresponding allowed modification set, state effect predicate and observation strategy for each type of response semantics. After persistent storage, it serves as the basis for subsequent consistency determination. The persistent state object identification and stable observation module identifies persistent state objects that the protocol operation will read and write from the target program source code, and deploys state acquisition probes at the entry and exit of the protocol operation processing function. At the same time, after receiving the target response or reaching the preset response waiting threshold and determining that it is timed out / no response, it implements stable observation according to the corresponding observation strategy. The protocol response semantic parsing module: under the premise that the target has not crashed, according to the message format and protocol specifications of the target industrial control protocol, parses the response type, status code and error code in the response message, and according to the preset response semantic mapping rules, classifies the response observation results into the semantic categories of success, failure, timeout / no response waiting, and outputs the response semantic r. The object-level state difference and effect determination module takes the pre-operation state snapshot, response semantic tag, post-operation state snapshot and response conditional state effect contract as input. It first normalizes the pre-operation and post-operation states on an object-by-object basis and calculates the object-level difference. Then it performs response legality determination, out-of-bounds modification determination and effect determination to determine whether the actual side effect belongs to the effect space allowed by the response semantic. The fuzzy testing closed-loop feedback module receives the output of the object-level state difference and effect determination module. When a test sequence is determined to be non-collapsed but with inconsistent state and effect, it is recorded as a semantic vulnerability candidate, and the determination result is used as a feedback signal to adjust the priority and mutation energy allocation of the corresponding seed.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the intelligent detection method for semantic vulnerabilities in industrial control protocols as described in any one of claims 1-6.
Citation Information
Patent Citations
Stateful protocol difference fuzzy test method and system based on behavior difference guidance
CN116805928A
Protocol vulnerability analysis system and method based on state storage / recovery
CN119071083A
Stateful protocol fuzzy test method and system based on response information
CN119645883A
