T09 · Insecure Skill Coding Practices
- Location
scripts/iex_cloud_cli.sh:224- Finding
IEX API Token Exposed Through Process Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/iex_cloud_cli.sh:108-111,scripts/iex_cloud_cli.sh:224-231
Vulnerability Type: API credential disclosure through process arguments
Risk Level: MediumVulnerable Code
bash --token) [[ $# -ge 2 ]] || die "--token requires a value" TOKEN="$2" shift 2 ;;bash curl_args=( --silent --show-error --fail-with-body --max-time "$TIMEOUT" --get "$URL" --data-urlencode "token=$TOKEN" )Technical Analysis
The CLI accepts an API token through the
--token TOKENcommand-line option. This exposes the token in the CLI process's command line and may also preserve it in shell history.Regardless of whether the token originates from the command line or an environment variable, the script then embeds it in a
curlargument:bash --data-urlencode "token=$TOKEN"Consequently, the spawned
curlprocess contains the plaintext credential in its argument vector. Depending on operating-system process visibility and monitoring configuration, the argument may be observable through process inspection interfaces or process-monitoring tools.Although IEX Cloud requires query-parameter authentication, the token does not need to be passed from the script to
curlas a visible command-line argument. This issue is limited to local credential exposure; the audited code restricts the network destination to the declared IEX API hosts.Attack Path
- A user executes the CLI with a valid IEX token, either through
--token TOKENor a supported environment variable. - If
--tokenis used, the plaintext token appears in the original CLI command line and may be recorded in shell history. - The script constructs the
curl_argsarray withtoken=$TOKEN. - The script launches
curl, placing the plaintext token in the child process's argument vector. - A local user, privileged monitoring service, diagnostic collector, or other process with permission to inspect process ...[truncated 848 chars]
- A user executes the CLI with a valid IEX token, either through
- Remediation
View remediation
Remediation Suggestions
- Remove or deprecate the
--token TOKENoption because it directly exposes credentials in command history and the CLI process command line. - Obtain tokens from an approved secret-management mechanism or a protected input channel. For interactive use, support silent input with
read -r -s. - Avoid placing the token in the spawned
curlargument vector. Supply sensitive curl configuration through protected standard input or a securely managed file descriptor, such as invokingcurl --config -and sending the sensitive option through standard input. - If a temporary configuration file is unavoidable, create it with permissions restricted to the current user, prevent symbolic-link attacks, and delete it reliably with a shell
trap. - Ensure tokens remain excluded from warnings, error messages, debugging traces, telemetry, and request logs.
- Document that environment-variable injection through the platform's SecretRef mechanism is preferred, while noting that environment visibility should also be restricted through appropriate operating-system process controls.
- Add an automated regression test that inspects the spawned
curlcommand line and fails if the token appears in its argument vector.
- Remove or deprecate the
