T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/gate.py:437- Finding
Protected-target validation can be bypassed through inconsistent artifact paths
- Content
View full analysis
Vulnerability Details
File Location:
scripts/gate.py:74-76andscripts/gate.py:437-446
Vulnerability Type: Inconsistent authorization target validation
Risk Level: HighVulnerable Code:
python target = execution.get("result", {}).get("rollback_pointer", {}).get("target_path", "") if target.endswith(".py"): import py_compilepython category = candidate.get("category") target_path = candidate.get("target_path") keep_eligible = ( recommendation == "accept_for_execution" and category in KEEP_CATEGORIES and candidate.get("risk_level") == "low" and not protected_target(target_path) and execution_result.get("status") in {"success", "no_change"} )Technical Analysis
The gate consumes two independently controlled representations of the modified target:
candidate["target_path"], used byprotected_target()to make the authorization decision.execution["result"]["rollback_pointer"]["target_path"], used by the compile and rollback logic.
The implementation does not canonicalize these paths and require them to identify the same file. Consequently, the protection check can be applied to a harmless declared path while the execution artifact references a different, protected target.
This is a confused-deputy and artifact-binding failure. A security decision must be made against the actual modified resource rather than an unverified claim in a separate artifact.
Attack Path
- Construct a ranking artifact containing a candidate categorized as a low-risk documentation, reference, or guardrail change.
- Set the candidate's
target_pathto a harmless unprotected file. - Construct the corresponding execution artifact with
statusset tosuccessorno_change. - Set the execution artifact's rollback target to a different protected file that was actually modified.
- Ensure the candidate receives
accept_for_executionand pass ...[truncated 638 chars]
- Remediation
View remediation
Remediation Suggestions
- Canonicalize both candidate and execution target paths before validation.
- Require the canonical candidate target to exactly equal the canonical execution target.
- Reject missing, mismatched, relative, or ambiguous target paths.
- Verify that the target resides under an explicit repository or workspace allowlist.
- Apply
protected_target()to the canonical target obtained from trusted execution metadata. - Bind ranking and execution artifacts using the run ID, candidate ID, target path, and a trusted integrity mechanism.
- Add tests for mismatched paths, symlink targets, traversal components, and protected execution targets paired with harmless candidate targets.
