T09 · Insecure Skill Coding Practices
- Location
scripts/_common.sh:19- Finding
API Credentials Exposed Through Request URLs and Process Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/_common.sh, lines 19–26
Vulnerability Type: API credential exposure
Risk Level: MediumVulnerable Code
bash local key="${KAMIS_CERT_KEY:-TEST}" local id="${KAMIS_CERT_ID:-TEST}" local url="${KAMIS_BASE}?action=${action}&p_cert_key=${key}&p_cert_id=${id}&p_returntype=json" for arg in "$@"; do url+="&${arg}"; done curl -sS --max-time 30 \ -H "User-Agent: Mozilla/5.0 (kamis-cli)" \ -H "Accept: application/json" \ "$url"Technical Analysis
The helper embeds
KAMIS_CERT_KEYandKAMIS_CERT_IDdirectly into the request URL and then supplies that URL as acurlcommand-line argument. When real credentials replace the defaultTESTvalues, they may be visible through local process inspection while the request is active.Query-string credentials can also be retained by endpoint access logs, HTTP proxies, debugging output, monitoring products, or shell tracing. TLS protects the request in transit but does not prevent credential disclosure through local process metadata or URL logging at either endpoint.
Attack Path
- A victim exports valid
KAMIS_CERT_KEYandKAMIS_CERT_IDvalues. - The victim runs any network-backed command such as
scripts/daily.sh. kamis_callcreates a URL containing both credentials.- The complete URL is passed to
curlas a process argument. - A local user with sufficient process-inspection access, or a monitoring/logging component, captures the URL.
- The captured credentials are reused against the KAMIS API.
Impact Assessment
An attacker may obtain the victim's KAMIS API identity and key, make requests under that account, consume its API quota, and access any API functionality authorized to those credentials. This does not directly grant operating-system privileges, and exploitation through process inspection generally requires local access or access to relevant logs.
- A victim exports valid
- Remediation
View remediation
Remediation Suggestions
- Use an authorization header or request body for credentials if the KAMIS API supports either mechanism.
- If query-string authentication is mandatory, avoid passing the complete authenticated URL directly as a command-line argument. Use a protected
curlconfiguration or input mechanism where practical. - Ensure shell tracing is disabled around authenticated requests.
- Configure application, proxy, and monitoring logs to redact
p_cert_keyandp_cert_id. - Document that KAMIS query-string authentication may expose credentials in server-side URL logs.
- Use narrowly scoped credentials and rotate any credentials suspected of being recorded or disclosed.
