SkillTotal

Is claude-agent-sdk safe?

No malicious indicators - review capabilities before installing
Notable — review in context (capabilities are not malware):
  • Python shell/command execution
  • Python filesystem read
  • Python filesystem write/delete

What to do: Nothing here argues against installing it. Grant the capabilities it lists only if you expect the tool to need them.

claude-agent-sdk is a PyPI package analyzed by SkillTotal's deterministic static scanner. The scan found no malicious indicators. It can: filesystem read, filesystem write, mcp tools detected, network egress and shell execution — capabilities are what the code can do, not a verdict on intent. Risk score 0/100 (low).

claude-agent-sdk 0.2.165

python_package · pypi:claude-agent-sdk
LOW
0
/ 100 risk score
Snapshot · scanned Oct 8, 2026 · claude-agent-sdk@0.2.165 · engine 0.56.4 / ruleset 62

Automated static-analysis result. It can contain false positives and false negatives, and is not a claim about the intent of claude-agent-sdk's authors. Report a false positive.

Capabilities — what this component can do (not a risk score):
filesystem readfilesystem writemcp tools detectednetwork egressshell execution

Behavioral traits

How this component maps to the CSA agentic threat model. Descriptive — it never affects the risk score.

Tool surface
Tool Usage
Execution authority
Tool Access Control / Direct Tool Access
Filesystem reach
Tool Execution Context
Network egress
Interaction & Communication / Direct Communication

Findings (5)

HIGHPython shell/command executionST-SHELL-PY

The component can run operating-system commands or spawn processes.

result = subprocess.run(
            cmd,
            check=True,
            stdout=subprocess.PIPE,
            stderr=subprocess.STDOUT,
            text=True,
        )
result = subprocess.run(
        [
            sys.executable,
            "-m",
            "wheel",
            "tags",
            "--platform-tag",
            platform_tag,
            "--remove",
            str(wheel_path),
        ] …
result = subprocess.run(
            [sys.executable, "-m", "twine", "check", "dist/*"],
            check=False,
            stdout=subprocess.PIPE,
            stderr=subprocess.STDOUT,
            text=True,
        )
subprocess.run(
        command,
        check=True,
        capture_output=True,
        stdin=subprocess.DEVNULL,
        env=env,
    )
result = subprocess.run(
            [
                "security",
                "find-generic-password",
                "-a",
                user,
                "-w",
                "-s",
                _KEYCHAIN_SERVICE_NAME, …
result = subprocess.run(
            ["git", "worktree", "list", "--porcelain"],
            cwd=cwd,
            capture_output=True,
            text=True,
            timeout=5,
            check=False,
        )

Why it matters: Powerful and often legitimate — confirm the commands aren't built from untrusted input.

Fix: Confirm the command and its arguments are fully controlled and not derived from untrusted input; avoid shell=True.

MEDIUMPython filesystem readST-FS-PY-READ

The component reads files from disk.

match = CLI_VERSION_PATTERN.search(CLI_VERSION_FILE.read_text())
with Path(gh_out).open("a", encoding="utf-8") as f:
head = Path(script_path).read_bytes()[:64]
with Path(script_path).open("rb") as f:
body = Path(script_path).read_bytes()
json.loads(config_path.read_text(encoding="utf-8"))
content = version_path.read_text()
content = pyproject_path.read_text()
content = version_path.read_text()
return (project_dir / file_name).read_text(encoding="utf-8")
content = match.read_text(encoding="utf-8")
_agent_metadata_sidecar_path(transcript_path).read_text(encoding="utf-8")

Why it matters: Usually legitimate, but worth confirming it can't be steered into reading sensitive files.

Fix: Confirm which files are read and that paths cannot be influenced by untrusted input to reach sensitive locations.

MEDIUMPython filesystem write/deleteST-FS-PY-WRITE

The component writes or deletes files on disk.

shutil.rmtree(dist_dir)
shutil.copy2(cli_path, target_path)
config_path.write_text(json.dumps(config, indent=2) + "\n", encoding="utf-8")
version_path.write_text(new_content)
pyproject_path.write_text(content)
version_path.write_text(content)
shutil.rmtree(path.parent / session_id, ignore_errors=True)
dst.write_bytes(transform(content) if transform else content)
meta_file.write_text(json.dumps(meta_content), encoding="utf-8")

Why it matters: Usually legitimate, but worth confirming the paths can't be controlled by untrusted input.

Fix: Confirm which files are written/deleted and that paths cannot be influenced by untrusted input.

MEDIUMPython network egressST-NET-PY

The component makes outbound network requests.

req = urllib.request.Request(
        f"https://pypi.org/simple/{package}/",
        headers={
            "Accept": "application/vnd.pypi.simple.v1+json",
            "User-Agent": "claude-agent-sdk-quota-check",
        },
    )
with urllib.request.urlopen(req, timeout=30) as resp:

Why it matters: Usually legitimate, but confirm the destinations are expected and no sensitive data leaves.

Fix: Confirm the destination hosts are expected and that no sensitive data is sent off-host.

LOWMCP tool surface detectedST-MCP-DETECTED

An MCP tool surface (manifest or tool definitions) was found.

>>> @tool("greet", "Greet a user", {"name": str})
>>> @tool("add", "Add two numbers", {"a": float, "b": float})
>>> @tool("divide", "Divide two numbers", {"a": float, "b": float})
tools: List of SdkMcpTool instances created with the @tool decorator.
>>> @tool("add", "Add numbers", {"a": float, "b": float})
>>> @tool("multiply", "Multiply numbers", {"a": float, "b": float})
>>> @tool("add_item", "Add item to store", {"item": str})

Why it matters: Just context — review which tools it offers and their permissions.

Fix: Review the declared MCP tools and their permissions.

How attackers abuse these capabilities

Interactive labs on the attack class behind the rules above. They show the technique, not anything found in claude-agent-sdk.

Check your own component

Run the same evidence-backed scan on any MCP server, agent skill, or package.

Scan your own component

How we determine this: deterministic static analysis (regex + AST), evidence-anchored, no code execution. Methodology →