root_cause stringclasses 3
values | remediation stringclasses 3
values | source_code stringclasses 3
values | command_flow stringclasses 3
values | defect_evidence stringclasses 3
values | defect_location stringclasses 3
values | impact_assessment stringclasses 3
values | authorization_analysis stringclasses 3
values | state_transition_analysis stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|
The reset routine commits the state transition before validating the condition required for reset completion. The start routine treats the state label as the sole precondition even though the controller separately tracks an active trip condition. | Validate all reset preconditions before changing state, and leave the controller in FAULT when a trip is active. Clear trip_active only through the appropriate successful fault-clear procedure. Make _start reject an active trip independently of the state label, and test that failed resets leave state and trip flags con... | class UnitController:
def __init__(self, authz):
self.authz = authz
self.state = 'READY'
self.trip_active = False
def trip(self):
self.trip_active = True
self.state = 'FAULT'
def handle(self, principal, command):
op = command.get('op')
if not self.au... | The handler obtains the operation, checks the principal's authorization, and dispatches start or reset. start invokes _start; reset invokes _reset. Unsupported operations are rejected. trip sets both the trip flag and the state to FAULT. | After trip sets trip_active to true and state to FAULT, _reset changes state to READY and then raises RuntimeError when trip_active is true. The exception does not roll back the assignment. _start subsequently accepts READY and does not inspect trip_active. | UnitController._reset assigns READY before testing trip_active. UnitController._start checks state but does not check trip_active, allowing the inconsistent state left by a failed reset to pass its start guard. | A failed reset can leave the controller reporting READY while a trip remains active. Because start relies only on the state label, a later authorized start request can transition the controller to RUNNING with trip_active still true. The snippet does not establish the physical response of downstream equipment. | The handler calls authz.allowed before dispatching either recognized operation, so both start and reset are covered in this snippet. The principal is passed to that check, and no alternate command path is shown. | start requires READY and changes the state to RUNNING. reset requires FAULT, but it assigns READY before checking trip_active. If the trip remains active, reset raises an exception after changing the state, leaving trip_active true while state is READY. A subsequent start checks only state and can therefore proceed des... |
Authorization is embedded in selected branches of the dispatcher rather than enforced at a common boundary for every state-changing operation. State-transition rules are likewise applied selectively: start has a prior-state guard, while stop and set_target do not account for the FAULT state. | Apply authorization to every command before dispatch, with permissions mapped by operation. Define and enforce allowed state transitions centrally; preserve FAULT until an explicit fault-clearing procedure succeeds. Reject target changes in states where they are not safe, and add tests for unauthorized set_target reque... | class Controller:
def __init__(self, authz):
self.authz = authz
self.state = 'READY'
self.target = 0.0
def trip(self):
self.state = 'FAULT'
def handle(self, principal, command):
op = command.get('op')
if op in {'start', 'stop'}:
if not self.authz... | The handler reads the operation, authorizes start and stop, and passes those commands to _apply. The set_target branch calls the same executor directly, where the value is converted to a float and stored. Unsupported operations are rejected. | A set_target command is dispatched directly to _apply, which executes self.target = float(command['value']) without checking principal or state. Separately, after trip sets state to FAULT, a stop command reaches the unconditional self.state = 'STOPPED' assignment and erases the fault state. | Controller.handle, in the set_target branch before the call to _apply, omits the authorization check applied to start and stop. Controller._apply also assigns STOPPED unconditionally in the stop branch, including from FAULT. | A caller not authorized to change the target may alter it. A stop command can also replace a visible FAULT state with STOPPED, potentially obscuring the fault from code or operators that rely on the state value. The snippet does not establish what downstream actions follow these values. | Authorization is checked only for start and stop. The set_target path reaches _apply without consulting authz, so any caller that can invoke handle may attempt to change the target. The code does not show another authorization check in the executor. | start is accepted only in READY and changes the state to RUNNING. stop changes the state to STOPPED without checking the prior state, including when trip has set the state to FAULT. set_target leaves the state unchanged and is not restricted by state, so it can also alter the target while the controller is in FAULT. |
The implementation conflates a role claim in request data with identity and authorization established by a trusted authentication context. The check is syntactically present but relies on a value controlled by the command sender. | Derive permissions from a trusted authenticated principal or server-side authorization service, never from a role field in the command. Reject missing or unrecognized identities and authorize each operation against the verified principal before execution. Add tests showing that changing the request role alone cannot gr... | class ModeController:
def __init__(self):
self.state = 'READY'
self.mode = 'LOCAL'
def handle(self, principal, command):
op = command.get('op')
claimed_role = command.get('role')
if op in {'start', 'stop', 'set_mode'}:
if claimed_role not in {'operator', 'mai... | The handler reads op and role from the command, checks the supplied role for each supported operation, and then calls _execute. The executor guards start with a READY-state check, sets stop to STOPPED, and assigns the requested mode for set_mode. | For any recognized operation, the code accepts either operator or maintainer as the value of command['role']; it does not call an authorization service or compare the role with principal. A command carrying one of those role strings therefore passes this check regardless of the principal value shown to the handler. | ModeController.handle assigns claimed_role from the command and uses it in the permission test, while principal is never referenced. The vulnerable check precedes dispatch to _execute and covers start, stop, and set_mode only through an untrusted role claim. | If callers can submit commands directly to this handler, a caller can claim an allowed role and reach start, stop, or set_mode without the code verifying that the principal has that role. The resulting operation may change controller state or operating mode; effects beyond these assignments are not shown. | The apparent role check uses command.get('role), a value supplied in the same command, and does not use the principal argument. Thus the check does not establish the caller's authenticated role. It applies to all three recognized operations, but its input is caller-controlled in this code. | start requires READY and transitions to RUNNING. stop sets STOPPED without checking the prior state. set_mode changes mode without changing state or checking a state-dependent condition. No trip or fault state is defined in this snippet, so conclusions about those states cannot be drawn from it. |
OT Control Command Authorization and State Logic Analysis Dataset
This dataset provides analysis samples based on OT control software source code, covering command receipt, validation, dispatch, and execution, along with authorization checks and device state transitions. Samples address defect locations and evidence, root causes, potential impacts, and remediation recommendations, supporting the identification of missing or bypassed authorization checks and inconsistent state handling. It is suited to OT vulnerability debugging, code review, root-cause analysis, and code SFT.
Technical Specifications
| Field | Type | Description |
|---|---|---|
| root_cause | string | Explains the implementation-level causes of missing authorization checks, inconsistent state handling, or other control logic defects. |
| remediation | string | Provides code fixes or safeguards that address the underlying causes of the defect. |
| source_code | string | The OT control software source code snippet under analysis, preserved as provided. |
| command_flow | string | Describes the key steps a control command follows from receipt and validation through dispatch and execution. |
| defect_evidence | string | Quotes or summarizes code logic and triggering conditions that support the defect assessment. |
| defect_location | string | Identifies the affected function, code region, or key statement and explains its relationship to the control flow. |
| impact_assessment | string | Describes potential consequences, such as unauthorized control, incorrect state transitions, or other impacts on OT operations. |
| authorization_analysis | string | Analyzes authorization checks before command execution, including their locations, coverage, and potential gaps or bypasses. |
| state_transition_analysis | string | Describes relevant device states and transition conditions, and assesses potential omissions or inconsistencies in state handling. |
Compliance Statement
| Authorization Type | CC-BY-NC-SA 4.0 (Attribution–NonCommercial–ShareAlike) |
| Commercial Use | Requires exclusive subscription or authorization contract (monthly or per-invocation charging) |
| Privacy and Anonymization | No PII, no real company names, simulated scenarios follow industry standards |
| Compliance System | Compliant with China's Data Security Law / EU GDPR / supports enterprise data access logs |
Source & Contact
- Downloads last month
- -