T09 · Insecure Skill Coding Practices
- Location
scripts/generate.py:14- Finding
Bearer Token Exfiltration Through Unvalidated AWS Region
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is a real AWS Bedrock image generator, but its credential handling has a concrete token-leak risk and its documentation encourages unsafe secret use.
Review before installing. Prefer AWS profiles, SSO, IAM roles, or environment-based credentials managed outside command transcripts. Avoid passing AWS secrets or bearer tokens on the command line, and do not let untrusted text control --region. The skill should validate regions or use an AWS SDK endpoint resolver before it is used with bearer tokens.
scripts/generate.py:14Bearer Token Exfiltration Through Unvalidated AWS Region
scripts/generate.py:116Sensitive AWS Credentials Accepted and Documented as Command-Line Arguments
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
req = urllib.request.Request(url, data=body.encode(), headers=headers, method="POST")
try:
with urllib.request.urlopen(req, timeout=120) as resp:
return json.loads(resp.read())
except urllib.error.HTTPError as e:
err_body = e.read().decode() if e.fp else ""
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
|--------|------------|
| **Bearer token** | `AWS_BEARER_TOKEN_BEDROCK` env var or `--bearer-token` |
| **Environment variables** | Set `AWS_ACCESS_KEY_ID` + `AWS_SECRET_ACCESS_KEY` |
| **Credentials file** | Configure `~/.aws/credentials` |
| **Named profile** | `--profile my-profile` or `AWS_PROFILE` env var |
| **Direct keys** | `--access-key AKIA... --secret-key ...` |
| **Temporary credentials** | Add `--session-token` with direct keys |
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
|--------|------------|
| **Bearer token** | `AWS_BEARER_TOKEN_BEDROCK` env var or `--bearer-token` |
| **Environment variables** | Set `AWS_ACCESS_KEY_ID` + `AWS_SECRET_ACCESS_KEY` |
| **Credentials file** | Configure `~/.aws/credentials` |
| **Named profile** | `--profile my-profile` or `AWS_PROFILE` env var |
| **Direct keys** | `--access-key AKIA... --secret-key ...` |
| **Temporary credentials** | Add `--session-token` with direct keys |
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
|--------|------------|
| **Bearer token** | `AWS_BEARER_TOKEN_BEDROCK` env var or `--bearer-token` |
| **Environment variables** | Set `AWS_ACCESS_KEY_ID` + `AWS_SECRET_ACCESS_KEY` |
| **Credentials file** | Configure `~/.aws/credentials` |
| **Named profile** | `--profile my-profile` or `AWS_PROFILE` env var |
| **Direct keys** | `--access-key AKIA... --secret-key ...` |
| **Temporary credentials** | Add `--session-token` with direct keys |
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
|--------|------------|
| **Bearer token** | `AWS_BEARER_TOKEN_BEDROCK` env var or `--bearer-token` |
| **Environment variables** | Set `AWS_ACCESS_KEY_ID` + `AWS_SECRET_ACCESS_KEY` |
| **Credentials file** | Configure `~/.aws/credentials` |
| **Named profile** | `--profile my-profile` or `AWS_PROFILE` env var |
| **Direct keys** | `--access-key AKIA... --secret-key ...` |
| **Temporary credentials** | Add `--session-token` with direct keys |
The skill describes capabilities that rely on environment access and outbound network access to AWS Bedrock, but it does not declare an explicit tool scope or allowed-tools boundary. That omission increases the chance of over-broad execution context, accidental access to local secrets, or use of network-enabled tooling beyond what is necessary for image generation.
The trigger phrases are broad and common, so the skill may activate for generic image-related requests even when the user did not intend to use AWS-backed generation. Unintended activation can expose prompts to external services, incur cloud costs, and cause the agent to use credentials or network actions in situations where a simpler or safer response was expected.
The documentation normalizes passing direct AWS credentials on the command line and via multiple exposed channels without warning about secret-handling risks. Command-line secrets may be leaked through shell history, process listings, logs, screenshots, or copied transcripts, making credential compromise more likely in normal use.
The file directs users to 'Craft a detailed English prompt' and repeats that 'Detailed English prompts yield best results'. This is a language preference presented as workflow guidance without offering the user a language choice or framing English as optional, which can violate language/locale policy expectations.
No suspicious patterns detected.