T09 · Insecure Skill Coding Practices
- Location
references/auth-setup.md:7- Finding
Persistent Plaintext Storage of an API Credential
- Content
View full analysis
Vulnerability Details
File Location:
references/auth-setup.md, lines 7–10 and 29–32
Vulnerability Type:T09: Insecure Skill Coding Practices
Risk Level: MediumVulnerable Documentation:
markdown ## Step 0 — how to store an env var on this system Figure out the correct way to persist an environment variable on this machine so it is available in every future session (a shell profile, or a config/env file managed by your agent runtime). The variable name is `STAYINGAPI_KEY`.bash ## Step 2 — store it export STAYINGAPI_KEY="stay_live_…" # or stay_test_… for the sandboxTechnical Analysis
The setup instructions direct the agent to persist
STAYINGAPI_KEYacross future sessions, potentially in a plaintext shell profile or agent-managed configuration file. The guidance does not require an operating-system keychain, runtime secret manager, owner-only file permissions, log redaction, shell-history protection, or periodic credential rotation.Environment variables are not inherently secure storage. Persisting a live bearer credential in a broadly readable profile or configuration file may expose it to other local users, compromised processes, backup systems, diagnostic collection, or tools that inspect configuration files. Because the key is used directly as an authorization bearer token, possession may be sufficient to perform API operations attributed to the victim's account.
Attack Path
- A user or agent follows the setup guide and obtains a live StayingAPI key.
- The key is persisted in a shell profile or agent runtime configuration as instructed.
- The selected file has insufficient access restrictions, is included in backups, or is readable by another local process or user.
- An attacker extracts the plaintext
STAYINGAPI_KEY. - The attacker submits API requests using
Authorization: Bearer <stolen-key>. - Those requests are processed under the affected ...[truncated 561 chars]
- Remediation
View remediation
Remediation Suggestions
- Store the credential in the agent runtime's dedicated secret manager or an operating-system keychain instead of a shell profile or general configuration file.
- Prefer session-scoped secret injection when cross-session persistence is not necessary.
- If file-backed storage is unavoidable, use a dedicated secrets file owned by the relevant account and restrict its permissions to owner read/write access.
- Ensure secret values are excluded from source control, backups where unnecessary, telemetry, command traces, debug output, and shell history.
- Avoid placing literal credentials directly in commands that may be recorded. Provide runtime-specific secure setup procedures instead.
- Document key revocation and rotation procedures, and recommend separate sandbox and live credentials with the minimum required privileges.
- Add explicit warnings that bearer credentials must never be printed, shared, committed, or included in support logs.
