T09 · Insecure Skill Coding Practices
- Location
scripts/speckit-reassign.sh:50- Finding
Bearer Credential Disclosure Through an Unrestricted API Destination
- Content
View full analysis
Vulnerability Details
File Location:
scripts/speckit-reassign.sh, lines 50–57
Vulnerability Type: Unvalidated credential destination and potential plaintext credential transmission
Risk Level: MediumVulnerable Code
bash if [ -n "${PAPERCLIP_API_KEY:-}" ] && [ -n "${PAPERCLIP_API_URL:-}" ]; then HTTP_CODE=$(curl -sS -o /dev/null -w "%{http_code}" -X PATCH \ -H "Authorization: Bearer $PAPERCLIP_API_KEY" \ -H "Content-Type: application/json" \ -d "{\"assigneeAgentId\":\"$AGENT_ID\"}" \ "$PAPERCLIP_API_URL/api/issues/$ISSUE_ID")Technical Analysis
The fallback API request obtains both its bearer credential and destination URL from environment variables. Although the script checks that these variables are nonempty, it does not validate the URL scheme or destination host before attaching
PAPERCLIP_API_KEYto theAuthorizationheader.Consequently, a malicious or mistakenly configured
PAPERCLIP_API_URLcan direct the credential to an attacker-controlled server. The absence of an HTTPS requirement also permits transmission over plaintext HTTP to a remote destination, exposing the API key to network interception. No redirect policy or protocol restriction is specified explicitly.Exploitation requires the attacker to influence the script's environment or configuration, or otherwise convince an operator to execute it with an unsafe
PAPERCLIP_API_URLwhile a validPAPERCLIP_API_KEYis present.Attack Path
- The attacker influences
PAPERCLIP_API_URL, setting it to an attacker-controlled endpoint or a remote plaintext HTTP endpoint. - A valid Paperclip API key is present in
PAPERCLIP_API_KEY. - The CLI path is unavailable or fails, causing execution to reach the
curlfallback. - The script sends a PATCH request carrying
Authorization: Bearer $PAPERCLIP_API_KEYto the configured destination. - The attacker receives the bearer credential directly, o ...[truncated 621 chars]
- The attacker influences
- Remediation
View remediation
Remediation Suggestions
- Parse and validate
PAPERCLIP_API_URLbefore using it. Reject malformed URLs, embedded user information, unexpected ports, and unapproved hosts. - Require HTTPS for every non-loopback destination. Permit HTTP only for explicitly recognized loopback addresses if local development requires it.
- Maintain an explicit allowlist of trusted Paperclip API hostnames rather than accepting arbitrary destinations.
- Restrict curl protocols and redirect protocols for remote requests, for example with
--proto '=https' --proto-redir '=https'. If redirects are unnecessary, disable or avoid following them. - Separate trusted endpoint configuration from attacker-influenced process environments where possible, and protect the configuration file with appropriate ownership and permissions.
- Use a narrowly scoped, short-lived API credential and rotate it immediately if exposure is suspected.
- Fail closed when destination validation fails, without issuing any request containing the Authorization header.
- Parse and validate
