T09 · Insecure Skill Coding Practices
- Location
scripts/curl.py:45- Finding
Basic Authentication Credentials Can Be Exposed Through Insecure Transport and Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/curl.py:45-52andscripts/curl.py:93
Vulnerability Type: Plaintext sensitive-data exposure
Risk Level: MediumVulnerable Code
python # Basic auth if user: if ':' in user: username, password = user.split(':', 1) else: username, password = user, '' credentials = base64.b64encode(f'{username}:{password}'.encode()).decode() req.add_header('Authorization', f'Basic {credentials}')python parser.add_argument('-u', '--user', help='Basic auth (user:password)')Technical Analysis
Base64 encoding is required by the HTTP Basic authentication scheme, but it does not encrypt credentials. Anyone who obtains the
Authorizationheader can trivially recover the username and password.Basic authentication is part of the Skill's documented functionality, and the code sends credentials only to the caller-selected destination. Therefore, this is not evidence of a covert exfiltration channel. However, the implementation permits Basic credentials to be sent to an unencrypted
http://URL without rejection or warning. On such connections, a network observer can capture and decode the Authorization header.The password is also accepted directly through the
--user user:passwordcommand-line argument. Depending on the operating environment, command-line values can be exposed through process listings, shell history, diagnostic logs, audit records, or Agent execution transcripts.Attack Path
- A user invokes the Skill with credentials, for example:
bash curl-tool -u victim:secret http://example.test/private - The complete credential string may be retained in shell history, process metadata, logs, or an Agent transcript.
- The implementation Base64-encodes
victim:secretand adds it to the HTTPAuthorizationheader. - Because the destination uses unencrypted HTTP, an attacker capa ...[truncated 1261 chars]
- A user invokes the Skill with credentials, for example:
- Remediation
View remediation
Remediation Suggestions
- Reject Basic authentication for non-HTTPS URLs by default:
python parsed = urllib.parse.urlparse(url) if user and parsed.scheme.lower() != 'https': raise ValueError('Basic authentication requires HTTPS') - Apply the same HTTPS requirement when callers provide an
Authorizationheader manually. - If insecure transport must be supported for exceptional development scenarios, require an explicit option such as
--allow-insecure-authand display a prominent warning. - Avoid accepting passwords directly on the command line. Accept only the username and retrieve the password with
getpass.getpass(), or use a protected credential source such as a restricted file descriptor or operating-system secret store. - Ensure credentials are never included in normal output, exception messages, debug logs, or saved response files.
- Document that HTTP Basic authentication is safe only when protected by properly validated TLS and that credentials should not be reused across services.
- Reject Basic authentication for non-HTTPS URLs by default:
