T09 · Insecure Skill Coding Practices
- Location
scripts/check_nzbget.sh:16- Finding
NZBGet Credentials Exposed Through Plaintext HTTP and Command-Line URL
- Content
View full analysis
Vulnerability Details
File Location:
scripts/check_nzbget.sh, lines 16–22
Vulnerability Type: Plaintext credential transmission and command-line credential exposure
Risk Level: Highbash URL="http://${USER}:${PASS}@${HOST}/jsonrpc" # Helper function to make NZBGet API calls nzbget_api() { local method="$1" curl -s -X POST -H "Content-Type: application/json" \ -d "{\"method\": \"${method}\", \"id\": 1}" \ "$URL" 2>/dev/null }Technical Analysis
The script embeds
NZBGET_USERandNZBGET_PASSdirectly in an HTTP URL. Because the URL explicitly useshttp://, neither the credentials nor the returned NZBGet data are protected by transport encryption. A network-positioned attacker can inspect or modify traffic between the script and the NZBGet service.Passing the credential-bearing URL as a
curlcommand-line argument can also expose it through process-list or process-inspection interfaces to local users with sufficient visibility while the request is running. Suppressing standard error with2>/dev/nulldoes not protect the credentials and can conceal transport or authentication errors.The destination is derived from
NZBGET_HOST. If an attacker can alter the execution environment or its configuration, the script will send the supplied NZBGet credentials to the attacker-selected host over plaintext HTTP.Attack Path
- A user configures valid
NZBGET_USER,NZBGET_PASS, andNZBGET_HOSTvalues and invokes the Skill. - The script constructs a URL containing the plaintext username and password.
- The URL is supplied to
curlas a process argument, creating a potential local observation window. curlsends the request to NZBGet without TLS protection.- A network-positioned attacker captures the authentication data or tampers with API responses. Alternatively, a sufficiently privileged local observer reads the credential-bearing process ...[truncated 749 chars]
- A user configures valid
- Remediation
View remediation
Remediation Suggestions
- Require HTTPS for all NZBGet API communication:
bash URL="https://${HOST}/jsonrpc" - Keep credentials out of the URL and pass them through curl's authentication option:
bash curl --fail --silent --show-error \ --user "$USER:$PASS" \ --header "Content-Type: application/json" \ --data "{\"method\": \"${method}\", \"id\": 1}" \ "$URL" - Do not disable TLS certificate validation. Configure the system trust store or use
--cacertwith a trusted CA certificate when NZBGet uses a private certificate authority. - Validate
NZBGET_HOSTagainst an expected hostname or explicit allowlist. Reject values containing schemes, user-information components, paths, control characters, or unexpected ports. - Replace unconditional error suppression with
--fail --show-errorand return a clear failure without printing credentials. - Use a dedicated, least-privileged NZBGet account where supported and rotate the currently configured password because it may already have been exposed.
- Restrict access to the environment or secret store containing the credentials and avoid logging command invocations or expanded environment values.
- Require HTTPS for all NZBGet API communication:
