T09 · Insecure Skill Coding Practices
- Location
scripts/init_prd.py:20- Finding
Project Path Traversal Allows File Writes Outside the Intended Workspace
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This PRD-writing skill is not clearly malicious, but it asks the agent to run local scripts and mutate OpenClaw/workspace state with weaker path controls and operational side effects than its stated purpose supports.
Install only if you are comfortable with a PRD helper running local scripts, writing under OpenClaw workspace paths, and participating in SDLC state commits. Review and constrain init_prd.py path handling before use, avoid running preflight.sh on untrusted filenames, and treat deploy/rollback scripts as administrative operations that can replace installed skill files and restart the gateway.
scripts/init_prd.py:20Project Path Traversal Allows File Writes Outside the Intended Workspace
preflight.sh:27Command Injection Through Test Filenames Executed with eval
scripts/build_release.sh:10Release Denylist Can Include Sensitive Local Files in Distribution Artifacts
The skill claims the agent must only obtain a safe path and then author the PRD, but it also mandates execution of a local initializer that creates or reuses files via fixed filesystem conventions. This is a real description/behavior mismatch because the skill is not merely guiding writing; it compels state-changing script execution on the local system, increasing trust in opaque helper code.
The skill claims the agent must only obtain a safe path and then author the PRD, but it also mandates execution of a local initializer that creates or reuses files via fixed filesystem conventions. This is a real description/behavior mismatch because the skill is not merely guiding writing; it compels state-changing script execution on the local system, increasing trust in opaque helper code.
The skill claims the agent must only obtain a safe path and then author the PRD, but it also mandates execution of a local initializer that creates or reuses files via fixed filesystem conventions. This is a real description/behavior mismatch because the skill is not merely guiding writing; it compels state-changing script execution on the local system, increasing trust in opaque helper code.
The skill claims the agent must only obtain a safe path and then author the PRD, but it also mandates execution of a local initializer that creates or reuses files via fixed filesystem conventions. This is a real description/behavior mismatch because the skill is not merely guiding writing; it compels state-changing script execution on the local system, increasing trust in opaque helper code.
The skill claims the agent must only obtain a safe path and then author the PRD, but it also mandates execution of a local initializer that creates or reuses files via fixed filesystem conventions. This is a real description/behavior mismatch because the skill is not merely guiding writing; it compels state-changing script execution on the local system, increasing trust in opaque helper code.
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
mv -T "$TMP_DIR" "$PROD_DIR"
rm -rf "$OLD_DIR"
ls -dt "$RELEASES_DIR"/backup_*.tar.gz 2>/dev/null | tail -n +4 | xargs -r rm -f
echo "✅ $SLUG deployed."
if [ -z "$HOME_MOCK" ] && [ "$NO_RESTART" != "true" ]; then
The skill directs the agent to read and write PRD files but does not declare an explicit tool scope such as allowed-tools or permissions. That omission weakens least-privilege controls and makes it harder to constrain or review what filesystem operations the skill is expected to perform.
The invocation guidance is broad enough that the skill may activate whenever the agent is asked to discuss or generate a PRD, without clear user-consented boundaries. Overbroad triggers increase the chance the agent will unnecessarily execute local scripts or write files in contexts where the user only wanted advice, not filesystem changes.
The skill uses mandatory language such as 'must and only' and 'must strictly' to force a specific workflow without user opt-in. This reduces user control and can pressure the agent into executing scripts and writing files even when the user may prefer a different process or only wants a draft in-chat.
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
## Documentation Discipline (CRITICAL)
- **BDD Acceptance Criteria:** In the Acceptance Criteria section, you MUST use BDD format (Given/When/Then) to define black-box behaviors. DO NOT write granular unit tests or implementation code here.
- **Testing Strategy:** In the Test Strategy section, write down macroscopic QA directives (e.g., "Mock the DB", "Use E2E Sandbox"). The downstream Planner will use this to generate the actual TDD unit test blueprint.
- **Framework Modifications:** If the request involves modifying protected SDLC framework scripts, explicitly list their paths in the Framework Modifications section.
The skill requires executing additional local scripts for auditing and baseline/commit operations after document writing. This expands the trust boundary from simple documentation editing into arbitrary local code execution and state mutation, which is dangerous because the scripts could perform unintended privileged actions unrelated to PRD generation.
The planned 'Web search fallback for unknown archetypes' expands the skill beyond its declared local PRD-path discovery and file-writing workflow. This capability introduces external data access and prompt-injection exposure that are not necessary for the stated purpose, increasing the attack surface and creating opportunities for untrusted content to influence generated PRDs or downstream actions.
Web search is not justified by the documented PM/architect PRD-writing role, so adding it creates unnecessary capability creep. In this context, externally sourced content can be adversarial, misleading, or instruction-bearing, making the skill more dangerous because it is supposed to perform a bounded local workflow rather than consume untrusted internet data.
The script forcefully removes temporary/old directories with rm -rf but provides no user-facing warning, confirmation prompt, or explanatory comment about the deletion. Although this is a deploy script, the destructive cleanup action is not clearly disclosed beyond generic deployment messages.
The script moves the current production directory aside, replaces it, and then permanently deletes the old directory with rm -rf, but only prints generic deployment status messages. There is no explicit warning, confirmation, or inline explanation that the previous live install will be removed after replacement.
The design explicitly expands the skill from a constrained local PRD-generation workflow into an internet-enabled agent by mandating web_search for unknown archetypes. This increases the attack surface, allows external content to influence generated PRDs, and can leak user/project details to third parties without being necessary for the core file-compilation task.
The web search capability is not aligned with the stated purpose of a tightly constrained PM skill that should follow a fixed PRD-writing process. Unjustified capabilities are risky because they violate least privilege and can be repurposed to fetch prompt-injection content, broaden data exposure, or bypass local governance controls.
Mandating web_search without a privacy or data-transmission warning is dangerous because user requirements, internal project details, or proprietary technology choices may be sent to external services. In this skill context, the PM may process early-stage product ideas, making unintended disclosure particularly sensitive.
The rollback script forcefully deletes the entire production skill directory and restores it from a tarball, which is a broader filesystem modification capability than the skill’s declared PRD-writing purpose. Even if intended for maintenance, this mismatch expands the blast radius: if the backup path or archive contents are tampered with, arbitrary files under the skills directory could be replaced or restored unexpectedly.
Restarting the openclaw gateway gives this skill operational control over a broader service environment that is unrelated to PM/PRD generation. In the context of a narrowly scoped authoring skill, service restart capability is dangerous because it can disrupt availability, apply unauthorized changes immediately, or help conceal other modifications by reloading altered skill contents.
The script invokes openclaw gateway restart, which is a subprocess affecting system/service state, but the only surrounding output is a generic deployment success message. There is no explicit notice that deployment may restart the gateway unless --no-restart is used.
The document requires use of the write tool to save PRDs but provides no user-facing notice, confirmation, or overwrite safeguards. In an agent setting, silent file creation or overwriting can cause accidental data loss, repository pollution, or unauthorized persistence of generated content.