T09 · Insecure Skill Coding Practices
- Location
scripts/fetch.sh:61- Finding
TinyFish API Key Exposed Through Process Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/fetch.sh:61-64
Related Documentation:SKILL.md:27-30
Vulnerability Type: API credential exposure through process arguments
Risk Level: MediumVulnerable Code
scripts/fetch.sh:61-64:bash exec curl -s -X POST "https://api.fetch.tinyfish.ai" \ -H "X-API-Key: ${TINYFISH_API_KEY}" \ -H "Content-Type: application/json" \ -d "$BODY"SKILL.md:27-30documents the same insecure pattern:bash curl -X POST "https://api.fetch.tinyfish.ai" \ -H "X-API-Key: $TINYFISH_API_KEY" \ -H "Content-Type: application/json" \ -d '{Technical Analysis
The shell expands
TINYFISH_API_KEYbefore startingcurl. Consequently, the complete authentication header, including the secret API key, is placed in thecurlprocess argument vector.On systems where process command lines are visible to other users, privileged monitoring agents, diagnostic utilities, or process-accounting systems, the credential may be recovered while the request is running. Potential observation mechanisms include process-listing utilities and operating-system process metadata.
Transmitting the API key to the documented TinyFish HTTPS endpoint is necessary for the Skill's declared functionality. Exposing the key through local command-line arguments is not necessary and exceeds the minimum information exposure required to authenticate the request.
No evidence was found that the Skill intentionally sends the key to an unrelated endpoint. The destination is statically set to the documented
https://api.fetch.tinyfish.aiservice.Attack Path
- A victim configures
TINYFISH_API_KEYand invokesscripts/fetch.sh. - The shell expands the environment variable inside the
-Hargument. - The resulting
curlprocess containsX-API-Key: <secret>in its argument vector. - An attacker or monitoring component with sufficient local pro ...[truncated 867 chars]
- A victim configures
- Remediation
View remediation
Remediation Suggestions
Avoid placing secret-bearing headers directly in command-line arguments.
- Supply the authentication header through a protected curl configuration stream, file descriptor, or temporary configuration file rather than through
-Hon the command line. - If a temporary file is used:
- Create it with permissions restricted to the current user, such as
0600. - Use a securely generated unpredictable path, for example through
mktemp. - Register a cleanup trap so the file is removed on normal exit, errors, and signals.
- Do not place it in a shared location with permissive access.
- Create it with permissions restricted to the current user, such as
- Ensure debugging and shell tracing are disabled around all credential handling so the key is not written to logs.
- Update the example in
SKILL.mdso users are not instructed to reproduce the vulnerable command-line pattern. - Rotate any API key suspected of having appeared in process listings, diagnostic captures, or process-accounting logs.
- Where supported by TinyFish, use narrowly scoped credentials, usage limits, expiration, and key-rotation policies to reduce the impact of disclosure.
- Supply the authentication header through a protected curl configuration stream, file descriptor, or temporary configuration file rather than through
