T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:10
- Finding
- Execution of an Unverified External PowerShell Script with Execution Policy Bypass<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:10-14` and duplicated in `clawhub/SKILL.md:10-14` **Vulnerability Type**: Unverified external script execution with PowerShell security controls bypassed **Risk Level**: Medium ### Vulnerable Code ```text Use `system.run` on node `My Windows Node`. Execute: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "C:\Users\AlenZhu\.openclaw\scripts\sshot.ps1" Wait until the command finishes and return stdout (screenshot file path). ``` ### Technical Analysis The Skill delegates its substantive behavior to `C:\Users\AlenZhu\.openclaw\scripts\sshot.ps1`, which is outside the audited package. The PowerShell script was not included in the project, so its contents, integrity, and actual behavior cannot be verified. The command also uses `-ExecutionPolicy Bypass`. Although PowerShell execution policy is not a complete security boundary, bypassing it removes a defense-in-depth control that might otherwise prevent an unsigned or untrusted script from running. The script resides under a user profile and no signature, cryptographic hash, trusted installation procedure, or restrictive permission requirement is specified. The same unsafe instruction is duplicated in `SKILL.md` and `clawhub/SKILL.md`. No evidence establishes that the referenced script is currently malicious; the vulnerability is that the Skill unconditionally trusts mutable code outside the reviewed package. ### Attack Path 1. An attacker or compromised local process obtains write access to `C:\Users\AlenZhu\.openclaw\scripts\sshot.ps1`. 2. The attacker replaces or modifies the script so that it performs additional commands beyond taking a screenshot. 3. A user invokes `/sshot`. 4. The Agent calls `system.run` on the hard-coded node named `My Windows Node`. 5. PowerShell launches the modified script using `-ExecutionPolicy Bypass`. 6. The injected commands execute with the permissions of the account run ...[truncated 883 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Include `sshot.ps1` inside the reviewed Skill package so its implementation is versioned and auditable. 2. Remove `-ExecutionPolicy Bypass`. Use the organization's configured PowerShell execution policy and require appropriately signed scripts where possible. 3. Verify the script before every execution using an approved Authenticode signature or a pinned cryptographic hash. 4. Install the script in a protected application directory rather than a mutable user-profile path, and restrict write permission to trusted administrators or the deployment mechanism. 5. Execute the screenshot operation using a dedicated least-privileged account with only the filesystem and desktop-session access required for screenshot capture. 6. Avoid hard-coded user-specific paths and node names. Resolve a trusted package-relative path or use validated configuration. 7. Return only the expected screenshot path and validate that stdout conforms to an approved local path format before presenting or consuming it. 8. Keep the duplicate Skill definitions synchronized or consolidate them into a single authoritative file to prevent security fixes from being applied to only one copy. ]]>
