Back to skill

Security audit

Strands Agents SDK

Security checks for vulnerabilities and agentic risk

Overview

This skill is for building AI agents, but its default scaffold gives generated agents broad file and shell access without enough guardrails or warning.

Review carefully before installing or using this skill. If used, run generated agents only in a sandbox or disposable workspace, avoid giving them access to real credentials or private files, inspect generated Python before execution, pin dependency and MCP server versions, and do not use untrusted agent names, model IDs, prompts, or MCP servers.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/create-agent.py:61
Finding

Generated agents expose unrestricted filesystem and shell-command capabilities

Content
View full analysis
str: """Read the contents of a file. Args: path: Path to the file to read. """ with open(path) as f: return f.read() @tool def write_file(path: str, content: str) -> str: """Write content to a file, creating it if it doesn't exist. Args: path: Path to the file to write. content: Content to write to the file. """ from pathlib import Path Path(path).parent.mkdir(parents=True, exist_ok=True) with open(path, "w") as f: f.write(content) return f"Wrote {{len(content)}} bytes to {{path}}" @tool def run_command(command: str) -> str: """Run a shell command and return its output. Args: command: Shell command to execute. """ import subprocess result = subprocess.run(command, shell=True, capture_output=True, text=True, timeout=60) output = result.stdout if result.stderr: output += f"\\nSTDERR: {{result.stderr}}" if result.returncode != 0: output += f"\\nExit code: {{result.returncode}}" return output ``` ```python agent = Agent( model=model, system_prompt="""You are {name}, a helpful AI agent. Be direct and efficient. You have access to tools for reading/writing files and running commands. Use them as needed to accomplish tasks. ... """, tools=[read_file, write_file, run_command], ) ``` ### Technical Analysis Every scaffolded agent receives tools that can read arbitrary paths, create or overwrite arbitrary files, and execute arbitrary shell commands. No workspace boundary, path validation, command allowlist, sandbox, user-confirmation mechanism, or privilege reduction is applied. The `run_command` tool passes model-generated text directly ...[truncated 1889 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/create-agent.py:155
Finding

Unsanitized scaffold arguments allow generated Python code injection

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/create-agent.py:155
Finding

Output path construction permits directory traversal and unintended file placement

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:24
Finding

Documentation recommends unpinned package installation and mutable MCP execution

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (10)

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 57)May include surrounding context.

md
from strands import Agent

# No model specified → BedrockModel (Claude Sonnet 4, us-west-2)
# Requires AWS credentials (~/.aws/credentials or env vars)
agent = Agent()
result = agent("Explain quantum computing")

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The scaffolded agent exposes a run_command tool that executes arbitrary shell commands, yet the generated README provides no warning that prompts may lead to command execution on the host. In an LLM-agent setting, this materially increases risk because prompt injection, user misunderstanding, or model error can turn ordinary interactions into system-level actions.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
99% confidence
Finding

Using subprocess.run(command, shell=True) with an unconstrained string parameter gives the generated agent arbitrary shell execution capability. In this context, the command string is effectively LLM-controlled via tool use, so prompt injection or unsafe prompting can directly lead to command injection, data theft, destructive actions, or full host compromise.

Content

Scanner excerpt · scripts/create-agent.py (reported line 87)May include surrounding context.

python
command: Shell command to execute.
    """
    import subprocess
    result = subprocess.run(command, shell=True, capture_output=True, text=True, timeout=60)
    output = result.stdout
    if result.stderr:
        output += f"\\nSTDERR: {{result.stderr}}"

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill documents and enables powerful capabilities including file read/write, shell execution, and MCP integrations, but the manifest does not declare any explicit tool scope such as permissions or allowed-tools. In an agent ecosystem, this weakens policy enforcement and user awareness, increasing the chance that consumers invoke a skill with broader authority than intended.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The skill prominently describes Bedrock, Anthropic, OpenAI, Ollama, MCP, SSE, and other network-connected integrations, but it does not clearly warn that prompts, files, tool outputs, or metadata may be transmitted to external services. This can lead users to expose sensitive local data or credentials to third-party systems without informed consent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The examples include file-writing and shell-capable tools as normal usage patterns without an adjacent warning that they can modify the local system. In practice, users may copy these snippets into real agents and unintentionally grant an LLM the ability to alter files or run commands, which raises the risk of destructive or unauthorized actions.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The generator scaffolds agents with powerful runtime capabilities beyond simple project creation, including arbitrary file read/write and shell command execution. In this skill context, those capabilities are especially risky because they are handed to an LLM-driven agent by default, enabling prompt-triggered system actions that can affect the host environment.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The generated agent includes a write_file tool that can create or overwrite arbitrary paths, but the scaffolded README does not warn users that the agent can modify the filesystem. Because this is an agent scaffold, users may run the generated code without realizing that normal prompts can cause file writes, increasing the chance of accidental or unsafe changes.

Content

No source excerpt is available for this finding.

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Confidence
75% confidence
Finding

Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Content

Scanner excerpt · tests/test_imports.py (reported line 102)May include surrounding context.

python
("OpenAIRealtime", "strands.experimental.bidi.models.openai_realtime"),
        ]:
            try:
                __import__(mod)
                models_found.append(name)
            except ImportError:
                pass

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · tests/test_imports.py (reported line 47)May include surrounding context.

python
skipped = []
    for name in lazy_names:
        try:
            cls = getattr(m, name)
            assert cls is not None
            resolved += 1
        except (ImportError, ModuleNotFoundError):

Static analysis

No suspicious patterns detected.