T09 · Insecure Skill Coding Practices
- Location
SKILL.md:106- Finding
PowerShell Execution Policy Is Unnecessarily Bypassed
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 106–107
Vulnerability Type: PowerShell security-control bypass
Risk Level: MediumVulnerable Code
powershell PowerShell -ExecutionPolicy Bypass -File scripts/scan.ps1 PowerShell -ExecutionPolicy Bypass -File scripts/scan.ps1 -DeepThe same invocation pattern also appears in usage comments at
scripts/scan.ps1, lines 2–3:powershell # 用法:powershell -ExecutionPolicy Bypass -File scan.ps1 快速扫描 # powershell -ExecutionPolicy Bypass -File scan.ps1 -Deep 深度诊断(大文件 + node_modules)Technical Analysis
The documented commands start PowerShell with
ExecutionPolicyset toBypass. This suppresses execution-policy checks for the new PowerShell process, even though the bundled diagnostic script only performs ordinary read-only operations and has no demonstrated requirement for this setting.PowerShell execution policy is not a complete security boundary, but it can enforce organizational script-signing or provenance requirements and prevent accidental execution of untrusted scripts. Explicitly overriding it defeats that defense-in-depth control. The risk becomes exploitable if
scripts/scan.ps1is modified or replaced after review but before invocation.The audit found no malicious behavior in the current script: it does not download payloads, establish persistence, transmit information, or execute destructive commands. The vulnerability concerns the insecure invocation mechanism rather than the present script contents.
Attack Path
- An attacker gains write access to the project directory or otherwise replaces
scripts/scan.ps1. - The attacker inserts PowerShell commands that execute with the invoking user's privileges.
- The user or Agent follows the instructions in
SKILL.md. - PowerShell starts with execution-policy checks bypassed.
- The tampered script executes without the signing or policy restriction that might otherwise have blocked or ...[truncated 778 chars]
- An attacker gains write access to the project directory or otherwise replaces
- Remediation
View remediation
Remediation Suggestions
- Remove
-ExecutionPolicy Bypassfrom all documented commands:
powershell PowerShell -File scripts/scan.ps1 PowerShell -File scripts/scan.ps1 -Deep- Resolve and validate the script path before execution so an unintended working directory cannot select another file:
powershell $script = (Resolve-Path ".\scripts\scan.ps1").Path PowerShell -File $script-
For managed environments, sign the script with a trusted code-signing certificate and retain the organization's configured execution policy, such as
AllSigned. -
Verify the script's publisher or cryptographic hash before invoking it when distributed outside a trusted package channel.
-
Remove the bypass examples from
scripts/scan.ps1, lines 2–3, to prevent users from continuing to follow the unsafe pattern. -
Avoid automatically elevating execution. If a future operation requires administrator privileges, isolate that operation, explain why elevation is needed, and request explicit authorization.
- Remove
