T09 · Insecure Skill Coding Practices
- Location
scripts/save.sh:38- Finding
Bearer API Token May Be Transmitted over Plaintext HTTP
- Content
View full analysis
Vulnerability Details
File Location:
scripts/save.sh, lines 38–41
Vulnerability Type: Missing transport security enforcement
Risk Level: Highbash RESPONSE=$(curl -s -X POST "${KARAKEEP_URL}/api/v1/bookmarks" \ -H "Authorization: Bearer ${KARAKEEP_API_KEY}" \ -H "Content-Type: application/json" \ -d "$BODY")Technical Analysis
The script constructs the API endpoint directly from the user-configurable
KARAKEEP_URLenvironment variable without validating its URL scheme. Although the documentation shows an HTTPS example, the implementation accepts anhttp://endpoint.If HTTP is configured,
curltransmits the bearer API key in theAuthorizationheader without transport encryption. The bookmark URL and optional note are also exposed in plaintext. The use of shell quoting prevents this value from becoming direct shell command injection, but it does not provide transport confidentiality or server authentication.Attack Path
- The user or deployment configuration sets
KARAKEEP_URLto an endpoint beginning withhttp://. - The user invokes
scripts/save.shwith a bookmark URL and, optionally, a note. - The script places
KARAKEEP_API_KEYin the HTTPAuthorization: Bearerheader. curlsends the request over an unencrypted network connection.- An attacker with a network position—such as one controlling a shared network, gateway, or compromised routing infrastructure—captures the API token and bookmark data.
- The attacker reuses the captured token against the Karakeep API within the token's assigned permissions.
Impact Assessment
A successful attack exposes the Karakeep API key, submitted bookmark URLs, and associated notes. The attacker can impersonate the token holder and perform any API operation authorized for that token. The exact privilege and data scope depend on the server-side permissions assigned to the compromised key; this script does not itsel ...[truncated 38 chars]
- The user or deployment configuration sets
- Remediation
View remediation
Remediation Suggestions
- Parse and validate
KARAKEEP_URLbefore issuing the request, rejecting every scheme excepthttps://. - If plaintext HTTP is necessary for local development, require an explicit opt-in setting and restrict it to loopback addresses such as
127.0.0.1orlocalhost. - Normalize the configured base URL and validate its hostname to reduce configuration errors.
- Add appropriate
curlprotections, including--fail-with-body,--proto '=https', connection and total-operation timeouts, and a redirect policy that prevents credentials from being forwarded to an unintended host. - Do not disable TLS certificate verification. Use a correctly configured trusted CA bundle for private deployments.
- Rotate the API key immediately if it may previously have been transmitted over HTTP.
- Parse and validate
