← All techniques
High Server-Side / Tool Backend

Secrets in argv / Environment

After code execution, secrets are usually trivially readable - flags passed as a command-line argument, API keys in the environment, tokens in PID 1's environ.

Credential / Secret Theft
LLM02ASI03T3CWE-214CWE-522

Tells spot it before you commit

  • » You have a code-execution or file-read primitive on the tool backend.
  • » The service was launched with secrets on its command line or in env vars.
  • » The /proc filesystem is readable and process argv/environ are exposed.

Method

  1. Dump the environment and the launching command line.
  2. Read PID 1's argv/environ - flags are often passed as an argument to the server process.
  3. Grep the collected output for flag/secret/token/key patterns.

Payloads templates - adapt to authorized scope

Read secrets after RCE bash
env
cat /proc/1/cmdline
cat /proc/1/environ
cat /proc/self/environ
ls -la / /app
cat /flag* /app/flag* /root/flag* 2>/dev/null

Why it works

Process arguments and environment variables are visible to any code running in the container, and /proc/<pid>/environ|cmdline expose them verbatim. Passing a secret as argv or env makes it readable the moment code execution exists.

Impact

Direct theft of API keys, database credentials, session tokens, or flags - often the final step after deserialization/SSTI/RCE.

Defenses

  • Never pass secrets on the command line; prefer secret managers / mounted files with tight perms.
  • Scrub env for child processes that don't need it; restrict /proc (hidepid) and drop capabilities.
  • Run tools least-privilege in isolated sandboxes; rotate any secret that could be exposed.

Mappings

OWASP LLM
LLM02 - Sensitive Information Disclosure
OWASP ASI
ASI03 - Identity & Privilege Abuse
Agentic Threats
T3 - Privilege Compromise
CWE
CWE-214 - Invocation of Process Using Visible Sensitive InformationCWE-522 - Insufficiently Protected Credentials

References

Related