T09 · Insecure Skill Coding Practices
- Location
scripts/_common.sh:103- Finding
API Key Exposed Through Process Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/_common.sh, lines 103–104
Vulnerability Type: Credential exposure through command-line arguments
Risk Level: MediumVulnerable Code:
bash local out http out=$(mktemp) http=$(curl -sS -G -o "$out" -w '%{http_code}' "${base}/${path}?${qs}" || true)The
qsvariable includes the encoded API credential:bash local qs="serviceKey=${enc_key}&type=json"Technical Analysis
The complete request URL, including
serviceKey, is passed tocurlas a command-line argument. Whilecurlis running, operating-system process inspection interfaces such aspsor/proc/<pid>/cmdlinemay expose that argument to other local users, monitoring agents, or diagnostic tooling.URL encoding does not protect the credential from disclosure because an observer can decode and reuse the captured value.
Attack Path
- A victim exports a valid
G2B_SERVICE_KEYand invokes one of the CLI scripts. g2b_getURL-encodes the key and embeds it inqs.- The function launches
curlwith the full URL in its argument vector. - A local process observer captures the command line while
curlis active. - The observer extracts, decodes, and reuses the API key against data.go.kr.
Exploitation requires local process-observation access or access to tooling that records process command lines.
Impact Assessment
A successful attacker obtains the victim's data.go.kr API credential. This may allow unauthorized API requests under the victim's quota, service disruption through quota exhaustion, and access to any other approved API operations associated with that key. The issue does not directly grant operating-system privileges or modify procurement data because the wrapped services are read-only.
- A victim exports a valid
- Remediation
View remediation
Remediation Suggestions
Avoid placing secrets in process arguments. Provide the sensitive request configuration to
curlthrough standard input or another channel that does not expose it in the argument vector.For example, use a curl configuration supplied on standard input while keeping only a non-sensitive fixed argument in
argv. Carefully escape configuration values before doing so. If a temporary configuration file is necessary:- Create it with permissions restricted to the current user, such as mode
0600. - Install an
EXIT,INT, andTERMtrap immediately after creation. - Remove the file on every success and failure path.
- Do not enable verbose curl output or request tracing where the URL could be logged.
- Rotate any API key suspected of prior command-line exposure.
- Create it with permissions restricted to the current user, such as mode
