T05 · Unauthorized Access and Privilege Escalation
- Location
SKILL.md:8- Finding
Undeclared and Unnecessary Command-Execution Capability
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 8–12 and 20–23
Vulnerability Type: Least-privilege violation through undeclared shell execution
Risk Level: MediumVulnerable Code
yaml metadata: permissions: - file:read - file:writemarkdown 1. Use `exec` to check whether the configuration file exists: ```bash cat ~/.openclaw/workspace/.contract-review-config.json 2>/dev/null || echo "NOT_FOUND"text ### Technical Analysis The Skill declares only file-read and file-write permissions, but its mandatory initialization gate explicitly directs the Agent to invoke the general-purpose `exec` capability. Checking whether a fixed configuration file exists and reading its contents can be performed with a file API, so shell execution is unnecessary for the stated function. This creates a mismatch between the advertised permission boundary and the actual capability requested during operation. A user or policy engine relying on the metadata could authorize the Skill believing it only accesses files, while the runtime instructions cause it to enter a substantially broader command-execution channel. The reviewed command is static and does not interpolate user-controlled input. Therefore, the current package does not contain a confirmed command-injection primitive or a path to arbitrary attacker-selected command execution. The vulnerability is the undeclared and excessive capability itself. ### Attack Path 1. A user invokes the Skill to review a contract. 2. The mandatory initialization gate instructs the Agent to use `exec`. 3. The Agent requests or exercises shell execution despite the Skill declaring only file-read and file-write permissions. 4. The fixed `cat` command reads the configuration file and suppresses errors. 5. No further privilege escalation is demonstrated by the reviewed content; exploitation beyond obtaining an unnecessarily broad execution channel would require an additional weakness or poli ...[truncated 641 chars]- Remediation
View remediation
Remediation Suggestions
- Replace the
execcommand with the platform’s native file-read or file-existence API. - Treat a file-not-found result from that API as the trigger for initialization.
- Keep the configuration path fixed and normalized; do not construct it from contract content or other untrusted input.
- If shell execution is genuinely required, explicitly declare the corresponding permission in the Skill metadata and document why file APIs are insufficient.
- Where supported, constrain execution with an allowlist limited to the required operation rather than granting unrestricted shell access.
- Add a validation test that compares all tools used by Skill instructions against the permissions declared in metadata.
- Replace the
