CVE Professor
/
All CVEs
CVE-2026-136625

CVE-2026-136625 — CWE-61

MEDIUM CVSS 6.6 ⚡ EPSS 0.2% NVD

ai-memory 2.6.0 before 3.3.2 contains a symlink following vulnerability in the ai-memory-wikisync companion that allows local attackers to overwrite arbitrary files by planting symlinks at predictable temporary names. Attackers can place a .wikisync-tmp-<page>.md symlink in a shared destination so atomic_write() truncates and overwrites its target with the victim's privileges.

ai-memory 2.6.0 before 3.3.2 contains a symlink following vulnerability in the ai-memory-wikisync companion that allows local attackers to overwrite arbitrary files by planting symlinks at predictable temporary names. Attackers can place a .wikisync-tmp-<page>.md symlink in a shared destination so atomic_write() truncates and overwrites its target with the victim's privileges.

CVSS v3.1 Vector Metrics
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H
Attack Vector Local AV:L
Attack Complexity Low AC:L
Privileges Req. Low PR:L
User Interaction Required UI:R
Scope Unchanged S:U
Confidentiality None C:N
Integrity High I:H
Availability High A:H
EPSS — Exploit Prediction Scoring System
0.2%
30-day probability
In the 7. percentile of all CVEs — higher exploitation probability than most vulnerabilities.
AI Security Analysis & Remediation

🎯 What is this vulnerability?

This vulnerability is a Symlink Following flaw (CWE-61) within the ai-memory-wikisync companion tool, specifically affecting versions of ai-memory prior to 3.3.2.

The core technical failure lies in the implementation of the atomic_write() function. Standard atomic write operations typically involve:
1. Creating a temporary file in the same directory as the destination.
2. Writing data to the temporary file.
3. Renaming (or linking) the temporary file to the final destination name.

In this vulnerable implementation, the code likely uses a predictable naming convention for the temporary file (e.g., .wikisync-tmp-<page>.md) and fails to verify that this path does not already exist as a symbolic link before performing the write operation. Specifically, if the code uses open() with O_CREAT or similar flags without O_NOFOLLOW, or if it performs a truncate()/write() on a file descriptor obtained from a path that is a symlink, the kernel will resolve the symlink and write to the target file.

Because the temporary filename is predictable (based on the <page> identifier), a local attacker can pre-plant a symlink at this exact path pointing to an arbitrary file (e.g., /etc/passwd, ~/.ssh/authorized_keys, or a system binary). When the victim user runs the ai-memory-wikisync process, the atomic_write() function follows the symlink, truncates the target file, and overwrites it with the content intended for the wiki page. This results in Arbitrary File Overwrite with the privileges of the victim user.

⚡ Attack Chain

1. Discovery & Reconnaissance

  • Identify Target: The attacker must have local access to the system (e.g., shared hosting environment, multi-user server, or compromised low-privilege account).
  • Version Check: Verify that ai-memory is installed and the version is < 3.3.2. This can be done by checking package managers (pip show ai-memory, npm list ai-memory) or inspecting the binary/library version strings.
  • Identify Victim Process: Determine which user account runs the ai-memory-wikisync service or command. The attacker needs to know the destination directory where the tool writes files and the naming convention for the temporary files (.wikisync-tmp-<page>.md).
  • 2. Exploitation

    The attacker exploits the race condition/predictable temp file by planting a symlink.

    Prerequisites:

  • Local access to the destination directory (or the ability to create files in a directory writable by the victim).

  • Knowledge of the <page> identifier that the victim will sync.
  • Step-by-Step Exploitation (Illustrative PoC):

    Assume the victim user victim runs ai-memory-wikisync which attempts to write to /home/victim/wiki/page1.md. The tool creates a temp file /home/victim/wiki/.wikisync-tmp-page1.md.

    1. Attacker (low-privilege user attacker) creates a symlink:

    # The attacker must have write access to the directory where the temp file is created.
        # If the directory is owned by 'victim' and not writable by 'attacker', this specific vector fails.
        # However, if the temp file is created in a world-writable directory (e.g., /tmp) or a shared directory, this works.
        # Let's assume the temp file is created in /tmp for this illustrative example, or the destination dir is group-writable.
        
        # Target: Overwrite /etc/cron.d/attacker (or ~/.ssh/authorized_keys)
        # Temp file name: .wikisync-tmp-page1.md
        
        ln -s /etc/cron.d/attacker /tmp/.wikisync-tmp-page1.md

    2. Victim triggers the sync:
    The victim runs the sync command. The atomic_write() function in ai-memory attempts to write to /tmp/.wikisync-tmp-page1.md.
    * The OS resolves the symlink to /etc/cron.d/attacker.
    * The function opens the file (following the symlink), truncates it, and writes the wiki content.

    3. Result:
    The file /etc/cron.d/attacker now contains the wiki page content. If the attacker crafts the wiki content to be a valid cron job, they achieve code execution as the victim user (or root, if the victim is root).

    Alternative: Overwriting SSH Keys

    # Attacker plants symlink
    ln -s /home/victim/.ssh/authorized_keys /tmp/.wikisync-tmp-page1.md
    
    # Attacker prepares malicious SSH public key in the wiki content
    echo "ssh-rsa AAAAB3... attacker@attacker" > /tmp/malicious_key
    
    # When victim syncs 'page1', the authorized_keys file is overwritten with the attacker's key.

    Note: The exact path of the temporary file depends on the implementation. If it is in the destination directory, the attacker needs write access to that directory. If it is in /tmp, the attacker needs write access to /tmp (usually true) and the ability to predict the filename.

    3. Post-Exploitation

  • Privilege Escalation: If the victim user has sudo privileges or is root, the attacker can escalate to full system control.
  • Persistence: By overwriting cron jobs, systemd units, or shell profile scripts (.bashrc, .profile), the attacker establishes persistence.
  • Lateral Movement: By overwriting ~/.ssh/authorized_keys, the attacker can SSH into the victim's account.
  • Data Destruction: The attacker can overwrite critical system files (e.g., /etc/passwd, /etc/shadow if permissions allow) to cause denial of service or lock out legitimate users.
  • 🌍 Real World Impact

  • Confidentiality (None): The vulnerability is an overwrite, not a read. The attacker does not gain direct access to read the victim's files, but they can overwrite them.
  • Integrity (High): The attacker can modify arbitrary files. This allows for tampering with system configurations, application code, and user data.
  • Availability (High): By overwriting critical system binaries, configuration files, or logs, the attacker can crash services, prevent logins, or render the system unusable.
  • Practical Consequences:
  • * Shared Hosting Environments: Multiple users on the same server. A low-privilege user can compromise other users' accounts or system files. * CI/CD Pipelines: If ai-memory-wikisync runs in a shared container or build agent, a malicious build step or compromised dependency could plant symlinks to overwrite build artifacts or deployment scripts. * Multi-User Servers: Any scenario where a low-privilege user can write to a directory where a high-privilege user's ai-memory process creates temporary files.

    🛡️ Remediation & Mitigation

    1. Upgrade

  • Affected Versions: ai-memory < 3.3.2
  • Fixed Version: ai-memory 3.3.2 and later.
  • Action: Immediately upgrade to version 3.3.2 or higher.
  • pip install --upgrade ai-memory>=3.3.2
        # or
        npm install ai-memory@^3.3.2

    2. Workarounds (If Upgrade is Not Possible)

  • Restrict Write Permissions: Ensure that the destination directory for ai-memory-wikisync is not writable by other users. If the temp files are created in the destination directory, this prevents symlink planting.
  • chmod 700 /path/to/wiki/destination
        chown victim:group /path/to/wiki/destination
  • Use O_NOFOLLOW: If you have access to the source code, patch the atomic_write() function to open temporary files with the O_NOFOLLOW flag (on Linux) or equivalent to prevent following symlinks.
  • Use mkstemp(): Replace predictable temporary file names with mkstemp() or tempfile.mkstemp(), which generates unique, unpredictable filenames and creates the file with O_EXCL (fail if exists).
  • Disable ai-memory-wikisync: If the feature is not required, disable it or remove the companion tool.
  • 3. Detection

    File Integrity Monitoring (FIM): Monitor critical files (e.g., /etc/cron.d/, ~/.ssh/authorized_keys, system binaries) for unexpected modifications.
  • Audit Logs: Check auditd logs for unlink or rename operations on temporary files in shared directories.
  • Symlink Detection: Scan for unexpected symlinks in directories where ai-memory operates.
  • find /path/to/wiki/destination -type l -name ".wikisync-tmp-*"
  • Log Analysis: Look for ai-memory-wikisync errors or warnings related to file permission issues or unexpected file contents.
  • ⚠️ Urgency

  • CVSS Score: 6.6 (Medium)
  • CISA KEV: No
  • Exploit Complexity: Low (requires local access and predictable temp file names)
  • Patch Priority: High for multi-user environments, shared hosting, or CI/CD systems. Medium for single-user, isolated systems.
Recommendation: Patch immediately in any environment where multiple users share the same filesystem or where ai-memory-wikisync runs with elevated privileges. The ability to overwrite arbitrary files with the victim's privileges is a severe integrity and availability risk.

[🤖 CVE Professor AI Security Engine]

Target Reconnaissance Queries (FOFA & Shodan)
PoC & Exploit Intelligence (GitHub)
Technical reference / advisory repository for CVE-2026-136625
Technical reference / advisory repository for CVE-2026-136625
Technical reference / advisory repository for CVE-2026-136625
Technical reference / advisory repository for CVE-2026-136625
CVSS Score
6.6 / 10 · CVSS MEDIUM
Weakness Types (CWE)
CWE-61
Related CVEs
8.7
CVE-2026-145182
Mullvad gotatun 0.1.0 before 0.10.1 contains a denial of service vulnerability that allows unauthenticated rem
8.2
CVE-2026-145176
quinn-proto 0.11.0 before 0.11.18 contains a denial of service vulnerability that allows remote QUIC peers to
6.5
CVE-2026-145046
FreeRDP before 3.33.1 contains a denial of service vulnerability in progressive_surface_tile_replace() that al
6.5
CVE-2026-145068
FreeRDP before 3.33.1 contains a denial of service vulnerability that allows malicious RDP servers to abort cl
6.3
CVE-2026-145185
Internxt drive-server-wip before commit 6a7801c contains an insufficient session expiration vulnerability in A
6.3
CVE-2026-144822
A security flaw has been discovered in gz-yami mall4j up to 4.0. This vulnerability affects unknown code of th
6.3
CVE-2026-120772
Insufficient session expiration in back-end login in dotCMS 25.03.12 through 26.10.28-03 (remember-me logins s