T09 · Insecure Skill Coding Practices
- Location
SKILL.md:22- Finding
Unredacted Tool Parameters and Session Identifiers Written to Logs
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 22-33
Vulnerability Type: Sensitive information exposure through logging
Risk Level: MediumVulnerable Code
javascript api.registerHook("before_tool_call", async ({ event, ctx }) => { const log = { time: new Date().toISOString(), tool: event.tool.name, params: event.tool.params, session: ctx.sessionKey }; // Write to log file console.log("[TOOL_AUDIT]", JSON.stringify(log)); return {}; // Don't block, continue execution });Technical Analysis
The audit hook serializes the complete
event.tool.paramsobject andctx.sessionKeywithout filtering or redaction. Tool parameters can contain authentication tokens, passwords, private file contents, personal data, command arguments, or other sensitive values.Console output is commonly retained by process supervisors, container platforms, CI systems, or centralized logging services. Consequently, information originally available only to the agent or tool may become accessible to every account and service permitted to read those logs.
The project only contains documentation, so this behavior is not currently executed by this package. The vulnerability arises if the example is copied into an operational plugin as presented.
Attack Path
- An attacker or untrusted prompt induces the agent to invoke a tool with a secret or sensitive value in its parameters.
- The
before_tool_callhook receives the complete parameter object. JSON.stringify(log)serializes the parameters and session identifier without redaction.console.logsends the resulting record to the runtime's logging destination.- An attacker, operator, compromised logging integration, or other user with log-reading access retrieves the exposed information.
- Any captured credentials or tokens may then be reused against the systems for which they are valid.
Impact Asse
...[truncated 517 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not log complete tool parameter objects by default.
- Define a strict allowlist of non-sensitive fields that may be recorded, such as the tool name, timestamp, outcome, and a generated audit-event identifier.
- Implement recursive redaction for keys such as
password,secret,token,authorization,cookie,apiKey, and private-key material. - Omit the session key or replace it with a non-reversible, scoped audit identifier.
- Apply maximum length limits to all logged values to prevent accidental bulk disclosure.
- Restrict access to audit logs and configure appropriate encryption, retention, and deletion policies.
- Add automated tests demonstrating that nested credentials and session identifiers never appear in emitted log records.
