T09 · Insecure Skill Coding Practices
Error
- Location
- index.js:23
- Finding
- Sensitive-resource policy is not enforced by executable code<![CDATA[ ## Vulnerability Details **File Location**: `index.js:23-29` and `index.js:49-64`; related instructions at `SKILL.md:11-17` **Vulnerability Type**: Security control bypass caused by unenforced policy **Risk Level**: High ### Vulnerable Code ```javascript export const initialize_mfa = ({ secret, super_secret, sensitive_list, use_dead_mans_switch = false }) => { const data = { secret_hash: hash(secret), super_hash: hash(super_secret), sensitive_list: sensitive_list || [".env", "password", "config", "sudo"], dead_mans_switch: use_dead_mans_switch }; if (!fs.existsSync(path.dirname(STORE_PATH))) fs.mkdirSync(path.dirname(STORE_PATH), { recursive: true }); fs.writeFileSync(STORE_PATH, JSON.stringify(data)); logEvent("INITIALIZATION", "SUCCESS"); return `✅ MFA Word active. Mode: ${use_dead_mans_switch ? "Dead Man's Switch" : "15-min Window"}`; }; ``` ```javascript export const check_gate_status = () => { if (!fs.existsSync(STORE_PATH)) return { status: "LOCKED" }; const vault = JSON.parse(fs.readFileSync(STORE_PATH)); if (sessionState.isUnlocked && Date.now() < sessionState.expiry) { if (vault.dead_mans_switch) { sessionState.isUnlocked = false; logEvent("AUTO_LOCK", "DEAD_MAN_SWITCH_TRIGGERED"); return { status: "OPEN_ONCE" }; } return { status: "OPEN" }; } sessionState.isUnlocked = false; return { status: "LOCKED" }; }; ``` ### Technical Analysis The configured `sensitive_list` is persisted but never evaluated by any executable authorization mechanism. `check_gate_status` merely reports process-local state; it does not receive an operation, normalize a target path, evaluate whether a resource is sensitive, or intercept filesystem and command-execution tools. The protection therefore depends exclusively on an agent following the prose in `SKILL.md`. It is not an enforceable security boundary. Any code path, tool, ...[truncated 1083 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Enforce authorization in the same executable path that performs sensitive operations. - Wrap or mediate filesystem, shell, deletion, and privileged-command tools rather than relying on prompt instructions. - Pass the requested operation and target into the authorization function. - Canonicalize filesystem paths before policy matching to prevent traversal, symbolic-link, case-sensitivity, and alternate-path bypasses. - Define explicit deny-by-default behavior when the vault is missing, corrupted, or inaccessible. - Bind one-time authorization to a specific operation and target rather than returning a generic `OPEN_ONCE` state. - Treat `SKILL.md` instructions as user-interface guidance only, not as a security control. - Add tests proving that direct access to configured sensitive resources is rejected while the gate is locked. ]]>
