T09 · Insecure Skill Coding Practices
- Location
scripts/set-token.cjs:9- Finding
Bearer Token Exposed Through Command-Line Arguments
- Content
View full analysis
'); process.exit(1); } const envPath = path.join(__dirname, '..', '.env'); fs.writeFileSync(envPath, `ELASTOLINK_TOKEN=${token}\n`); ``` The documented workflow explicitly places the token in the command: ```markdown 1. Run `node D:\workspace\demo\elastolink\scripts\get-token.cjs` 2. If the output is `NO_TOKEN`, ask the user to enter a token and save it: - User enters a token in the format `sk-xxx` - Run `node D:\workspace\demo\elastolink\scripts\set-token.cjs ` ``` ### Technical Analysis The script receives the bearer token through `process.argv`. Command-line arguments may be exposed through operating-system process inspection, shell history, terminal telemetry, agent execution traces, audit systems, and command logging. This is especially relevant in an AI-agent workflow because the agent must interpolate the user-provided secret into a command string. That command may consequently be retained independently of the destination `.env` file. ### Attack Path 1. A user provides an Elastolink bearer token to the agent. 2. The agent invokes `set-token.cjs` with the token embedded in the command line. 3. The command or process arguments are captured by shell history, process-monitoring tools, agent logs, or execution telemetry. 4. A local user or log reader obtains the exposed token. 5. The attacker submits the token as an `Authorization: Bearer` credential to the configured MCP endpoint. 6. Subject to the token's server-side privileges, the attacker can access meeting-service operations available to that credential. ### Impact Assessment Successful exploitation discloses the Elastolink bearer token. An ...[truncated 330 chars]- Remediation
View remediation
