T09 · Insecure Skill Coding Practices
- Location
bin/_kipris_common.sh:5- Finding
KIPRIS API Key Transmitted Through Plaintext HTTP and Exposed in the Process Command Line
- Content
View full analysis
&2; exit 1; } require_key() { local k="${KIPRIS_PLUS_KEY:-${KIPRIS_KEY:-}}" if [ -n "${OVERRIDE_KEY:-}" ]; then k="$OVERRIDE_KEY"; fi if [ -z "$k" ]; then die "missing API key. Set KIPRIS_PLUS_KEY or pass --key. Get one at https://plus.kipris.or.kr" fi printf '%s' "$k" } # urlencode a single string. Pure Python (no extra deps). urlencode() { python3 -c "import urllib.parse,sys; print(urllib.parse.quote(sys.argv[1], safe=''))" "${1:-}" } # Call a KIPRIS Plus REST endpoint. # args: # Emits raw XML to stdout, exits 0 on HTTP success regardless of resultCode. kipris_get() { local path="$1" qs="${2:-}" local key; key="$(require_key)" local sep="?" [ -n "$qs" ] && sep="?${qs}&" local url="${KIPRIS_BASE}/${path}${sep}ServiceKey=${key}" curl -sS --fail-with-body -m 30 -A "kipris-cli/0.1.0" "$url" } ``` ### Technical Analysis The default KIPRIS endpoint uses `http://`, so TLS does not protect the API key, search parameters, or server response. The code appends the credential to the URL as `ServiceKey=${key}` and passes the complete URL to `curl` as a command-line argument. This creates several exposure channels: 1. A network observer can read or modify the plaintext HTTP request. 2. A local process observer may obtain the complete URL, including the key, from process inspection facilities while `curl` is running. 3. HTTP proxies, debugging systems, shell tracing, and URL-oriented request logs may record the credential. 4. Because `KIPRIS_BASE` is accepted from the environment without scheme or host validation, a manipulated execution environment can direct the key ...[truncated 1659 chars]- Remediation
View remediation
