CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-106451

CVE-2026-106451: Local Privilege Escalation via JNI Extraction TOCTOU in lz4-java

Alon Barad
Alon Barad
Software Engineer

Oct 8, 2026·6 min read·64 visits

Executive Summary (TL;DR)

A local attacker can exploit a TOCTOU race condition and insecure temporary file creation in lz4-java's JNI loader to execute arbitrary code as the victim JVM user.

A local privilege escalation and code execution vulnerability exists in the yawkat fork of lz4-java when extracting its bundled JNI shared library into the system temporary directory. Predictable path derivation and lack of exclusive file creation flags allow a local attacker to hijack library loading via a race condition.

Vulnerability Overview

The yawkat fork of lz4-java (upstream net.jpountz.lz4) features a utility class responsible for loading its JNI native library dynamically at runtime. When the library is initialized, if no system-native lz4 library is pre-installed on the host system, the loader extracts its bundled native library (.so, .dylib, or .dll) into a temporary directory.

Historically, this dynamic extraction targeted the system temporary directory defined by the java.io.tmpdir system property (typically /tmp on UNIX systems). In these multi-user directories, multiple processes share the same storage space. The vulnerable library versions ranging from 1.7.0 up to 1.11.3 expose a significant attack surface during this initialization phase.

The vulnerability is classified under CWE-367 (Time-of-check Time-of-use Race Condition) and CWE-377 (Insecure Temporary File). Local unprivileged attackers can exploit this behavior to hijack the binary dynamic extraction and force the victim JVM to execute arbitrary native code. The risk is elevated on shared hosting servers, terminal servers, and multi-tenant environments where low-privilege users share the same operating system.

Root Cause Analysis

The technical root cause lies in how the JNI loader determines the destination file path and writes the compiled binary. During start-up, net.jpountz.util.Native.load() generates a lockfile using the safe File.createTempFile() API. This initial lockfile creation is robust because it relies on OS-level exclusive creation flags like O_CREAT | O_EXCL which fail if the file name already exists.

However, the flaw is introduced in the next step where the actual target binary destination path is calculated. Instead of calling File.createTempFile() again to allocate a safe, unique file path for the library, the system derives the destination path programmatically. It strips the .lck extension from the previously created lockfile path via string replacement to obtain the final library location.

Because the resulting destination path is predicted and passed directly to a standard FileOutputStream constructor, the JVM does not enforce exclusive creation. It opens the target path without checking if the file is a pre-existing symbolic link or file descriptor owned by another user. If an attacker pre-creates the file or drops a symbolic link at that predicted path between the time the lockfile is created and the time the stream writes to it, the JVM blindly follows the link and writes to the destination.

Code Analysis

Analyzing the vulnerable code path vs. the patched code reveals the precise mechanism of the flaw and its remediation. The vulnerable JNI extraction routine uses a lockfile to coordinate multi-process extraction, but relies on a predictable name conversion that leaves it vulnerable to race conditions.

Below is the comparison highlighting the vulnerable path and the patched implementation:

// VULNERABLE CODE PATH (lz4-java < 1.11.4)
// Creates a secure temporary file to act as a lock
tempLibLock = File.createTempFile("liblz4-java-", "." + os().libExtension + ".lck");
// Programmatic derivation of the target library path - INSECURE
tempLib = new File(tempLibLock.getAbsolutePath().replaceFirst(".lck$", ""));
// FileOutputStream is opened without exclusive flags, making it vulnerable to symlink attack
try (FileOutputStream out = new FileOutputStream(tempLib)) {
    byte[] buf = new byte[4096];
    // ... copies stream to tempLib ...
}
 
// PATCHED CODE PATH (lz4-java >= 1.11.4)
// No lockfile is derived. The library is directly created using createTempFile which ensures O_EXCL
tempLib = File.createTempFile("liblz4-java-", "." + os().libExtension);
try (FileOutputStream out = new FileOutputStream(tempLib)) {
    byte[] buf = new byte[4096];
    // ... copies stream securely ...
}

The fix is complete and highly effective because it removes the string replacement entirely. By calling File.createTempFile directly on the final target binary name, the application ensures that the operating system atomically validates file creation, preventing an attacker from planting a file or symlink beforehand. Variant attacks targeting this specific path are prevented by the atomic nature of the system calls behind createTempFile.

Exploitation Methodology

To successfully execute this attack, a local adversary must monitor file events in the target temporary directory using mechanisms like inotify or a rapid polling loop. The attacker awaits the creation of a lockfile with the pattern liblz4-java-*.lck which signals that a JVM application using the library has started.

Upon identifying a lockfile, the attacker calculates the expected JNI output path. Within the brief window of time before the JVM starts writing the library payload, the attacker places a symbolic link pointing to a shared file or directly pre-creates the target filename with world-writable permissions.

Once the JVM finishes writing the binary data through the symlink, the attacker immediately modifies or replaces the target binary with a compiled malicious native library containing custom JNI_OnLoad payloads. When the victim JVM continues its initialization and calls System.load(), it executes the malicious dynamic library, elevating the attacker's privileges to those of the victim JVM process.

Impact Assessment

The impact of successful exploitation is complete compromise of the JVM process. Because the malicious library is loaded into memory using System.load(), the code runs within the same memory space and privilege context as the calling application.

If the victim application runs under a highly privileged service account or root user, the local attacker gains corresponding privileges on the host system. This can lead to arbitrary code execution, local privilege escalation, unauthorized database access, or file system manipulation.

The CVSS v4.0 score is assessed at 7.3 (High) with a vector of CVSS:4.0/AV:L/AC:H/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N. This reflects that while the attack is restricted to local vectors and requires winning a tight race condition, the resulting impact on confidentiality, integrity, and availability is critical.

Remediation and Mitigation

The definitive solution is upgrading the lz4-java dependency to version 1.11.4 or higher, which replaces the insecure lockfile logic with safe atomic file creations. Organizations should update their build definitions to pull the latest secure release from Central Repository.

If upgrading is not immediately possible, several effective mitigations can be implemented to minimize the attack surface. The most reliable workaround is configuring a private temporary directory for the JVM process, which prevents local attackers from monitoring or writing to the target directory. This is achieved by setting the system property -Djava.io.tmpdir=/path/to/private/dir where the private directory has restricted permissions (e.g., 700).

Additionally, system administrators can enable OS-level symlink protections. In modern Linux distributions, setting fs.protected_symlinks=1 and fs.protected_regular=2 via sysctl prevents processes from following symbolic links in world-writable directories if the link owner does not match the process owner. This kernel control completely blocks the symlink vector of this exploit.

Fix Analysis (1)

Technical Appendix

CVSS Score
7.3/ 10
CVSS:4.0/AV:L/AC:H/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
EPSS Probability
0.08%
Top 100% most exploited

Affected Systems

lz4-javaJVM applications running on multi-user systems

Affected Versions Detail

Product
Affected Versions
Fixed Version
lz4-java
yawkat
>= 1.7.0, < 1.11.41.11.4
AttributeDetail
CWE IDCWE-367 (TOCTOU) / CWE-377 (Insecure Temporary File)
Attack VectorLocal
CVSS Score7.3 (High)
EPSS Score / Percentile0.00083 / 0.21%
Exploit StatusProof-of-Concept
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1068Exploitation for Privilege Escalation
Privilege Escalation
CWE-367
Time-of-check Time-of-use (TOCTOU) Race Condition

The software checks the state of a resource before using that resource, but the resource's state can change between the check and the use.

References & Sources

  • [1]GitHub Security Advisory GHSA-mcr4-qmvw-px4g
  • [2]Official Fix Commit
  • [3]Official Fix Release
  • [4]NVD Entry
  • [5]CVE Project Record

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•1 day ago•CVE-2026-58254
6.5

CVE-2026-58254: Authorization Bypass in NATS Server Message Tracing for Leaf Node Connections

NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.

Alon Barad
Alon Barad
8 views•10 min read
•1 day ago•CVE-2026-63341
7.5

CVE-2026-63341: Unauthenticated Denial of Service via Unbounded Topic Depth in Aedes MQTT Broker

CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.

Alon Barad
Alon Barad
14 views•12 min read
•1 day ago•CVE-2026-61725
6.1

CVE-2026-61725: Path Traversal and Arbitrary File Overwrite in sevenz-rust2

CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.

Alon Barad
Alon Barad
6 views•12 min read
•1 day ago•CVE-2026-77309
8.8

CVE-2026-77309: Unauthenticated Remote Code Execution in NASA-AMMOS AIT-GUI via Incomplete File Cleanup and Path Traversal

CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.

Amit Schendel
Amit Schendel
13 views•10 min read
•1 day ago•CVE-2026-77332
2.3

CVE-2026-77332: Surfaced-Memory Envelope Injection and Stored Prompt Injection in memtomem-stm

A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.

Alon Barad
Alon Barad
17 views•10 min read
•2 days ago•CVE-2026-77331
2.0

CVE-2026-77331: Race Condition and Session State Corruption in memtomem-stm

CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.

Amit Schendel
Amit Schendel
8 views•9 min read