T09 · Insecure Skill Coding Practices
- Location
SKILL.md:138- Finding
SerpAPI Credential Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:138-148,SKILL.md:166-175, andSKILL.md:189-199
Vulnerability Type: API credential exposure through process arguments
Risk Level: MediumVulnerable Code
bash # Ground transport (trains, buses, ferries) python3 scripts/search_transport.py \ --from "City A, Country" --to "City B, Country" \ --key $SERPAPI_KEY # Domestic flights python3 scripts/search_flights.py \ --from [IATA_A] --to [IATA_B] --date YYYY-MM-DD \ --adults N --class economy --currency GBP \ --key $SERPAPI_KEYThe same insecure argument is also included in the single-destination flight and hotel examples:
bash python3 scripts/search_flights.py \ --from [IATA] --to [IATA] \ --date YYYY-MM-DD [--return-date YYYY-MM-DD] \ --adults N [--children N] \ --class economy|premium_economy|business|first \ --currency GBP \ --key $SERPAPI_KEYbash python3 scripts/search_hotels.py \ --location "[CITY] [preference]" \ --check-in YYYY-MM-DD --check-out YYYY-MM-DD \ --adults N [--children N] \ [--stars N] [--amenities "pool,beach"] \ --sort highest_rating \ --currency GBP \ --key $SERPAPI_KEYTechnical Analysis
Shell expansion replaces
$SERPAPI_KEYwith the plaintext credential before starting the Python process. The resulting API key may therefore appear in process argument listings, command auditing systems, diagnostic output, execution logs, or shell traces.These instructions directly contradict the Skill's stated credential-handling policy and the scripts' implementation, which load the key from the environment or designated credential files. The Python argument parsers do not define a
--keyoption, meaning the documented commands will also terminate with an unrecognized-argument error after the shell has already expanded and exposed the secret.Attack Path
- A user or Agent follows o ...[truncated 850 chars]
- Remediation
View remediation
Remediation Suggestions
-
Remove every
--key $SERPAPI_KEYargument fromSKILL.md. -
Invoke the scripts without putting the key on the command line. Their existing
load_api_key()functions already retrieve it fromSERPAPI_KEY,~/.serpapi_credentials, or~/.travel_agent_config. -
Update the examples to use commands such as:
bash python3 scripts/search_transport.py \ --from "City A, Country" --to "City B, Country" -
Add automated documentation checks that reject examples containing
--key,api_key=, or direct credential interpolation. -
Rotate the SerpAPI key if any of the documented commands have previously been executed in an environment with command auditing, shell tracing, or untrusted local users.
-
Restrict credential-file permissions to the owning user, for example with mode
0600.
-
