MEDIUM 4.5

CVE-2026-13502: ANTLR4 Maven Plugin TOCTOU Vulnerability Guide

A timing vulnerability has been discovered in ANTLR4's Maven plugin (versions up to 4.13.2) that could allow a local attacker to manipulate file operations during the deserialization process. The flaw exploits a race condition between checking and using files, potentially leading to unauthorized access to sensitive data or modification of build artifacts. Exploitation requires local system access, elevated privileges, and significant technical skill, making it a targeted rather than widespread risk.

Source data · NVD / CISA · public domain

CVSS
3.1 · 4.5 MEDIUM · CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L
Weaknesses (CWE)
CWE-362, CWE-367
Affected products
0 configuration(s)
Published / Modified
2026-06-28 / 2026-06-29

NVD description (verbatim)

A flaw has been found in antlr ANTLR4 up to 4.13.2. This affects the function ObjectInputStream.readObject of the file antlr4-maven-plugin/src/main/java/org/antlr/mojo/antlr4/GrammarDependencies.java of the component Maven Plugin. This manipulation causes time-of-check time-of-use. The attack is restricted to local execution. A high degree of complexity is needed for the attack. It is indicated that the exploitability is difficult. The exploit has been published and may be used. The vendor was contacted early about this disclosure but did not respond in any way.

5 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

CVE-2026-13502 is a time-of-check time-of-use (TOCTOU) vulnerability in the GrammarDependencies.java component of the ANTLR4 Maven plugin. The flaw resides in the ObjectInputStream.readObject() method, which performs unsafe deserialization without proper synchronization between permission validation and actual file access. An attacker with local system access and sufficient privileges can create a race condition to substitute files between the security check and their actual use, potentially gaining read or write access to sensitive build-time data. The vulnerability requires high attack complexity and low privileges.

Business impact

Organizations using ANTLR4 Maven plugin in their build pipelines face risk of build artifact manipulation and information disclosure. An insider or compromised local account could poison generated code or extract intellectual property from grammar definitions. The impact is primarily confined to development environments rather than production systems, but compromised build artifacts could propagate downstream. The practical risk depends on build system isolation and the sensitivity of grammar and generated code within your organization.

Affected systems

ANTLR4 versions up to and including 4.13.2 are affected, specifically the Maven plugin component. No vendor product list was provided in the vulnerability data. Organizations should audit their development and CI/CD infrastructure for Maven plugin usage, particularly build servers and developer workstations where the plugin executes.

Exploitability

While a proof-of-concept has been published, real-world exploitation remains difficult. The attack vector is strictly local; network-based exploitation is not possible. An attacker must either have direct system access or compromise an existing account with plugin execution privileges. The race condition window is narrow and requires precise timing, making this not a trivial "one-click" exploit. The vendor's non-response suggests no active in-the-wild exploitation campaigns have been observed, but the published proof-of-concept raises awareness among determined threat actors.

Remediation

Users of ANTLR4 should update the Maven plugin beyond version 4.13.2. Verify the exact patched version against the official ANTLR project releases. Organizations should also review build system access controls: restrict who can execute Maven builds, isolate build servers, and use immutable artifact repositories where possible to detect tampering.

Patch guidance

Check the official ANTLR4 GitHub repository and Maven Central for versions released after 4.13.2. Apply the update to all development environments, CI/CD systems, and build servers where the Maven plugin is configured. Coordinate the update with your build pipeline validation to ensure compatibility with your grammar definitions. Test the patched version in a staging environment before production deployment.

Detection guidance

Monitor local file systems on build servers for unexpected file operations during Maven plugin execution. Watch for TOCTOU-style activity patterns: rapid file permission checks followed immediately by file operations on the same objects. Review audit logs for GrammarDependencies class instantiation and ObjectInputStream deserialization events. Inspect Maven build logs for anomalies in plugin initialization. Consider integrity monitoring on grammar files and generated source code directories to catch unauthorized modifications post-build.

Why prioritize this

This vulnerability merits prompt but not emergency attention. The MEDIUM severity reflects local-only attack vector and high complexity requirements. However, the published proof-of-concept and vendor non-response eliminate the 'unknown' factor. Prioritize patching if your organization heavily relies on ANTLR for code generation in sensitive domains (compilers, DSLs for financial or security-critical systems). If ANTLR usage is light or confined to non-sensitive projects, patch within normal maintenance windows.

Risk score, explained

The CVSS 4.5 score reflects a constrained threat model: local-only access (AV:L), high attack complexity due to race condition timing (AC:H), low privileges sufficient but not zero (PR:L), no user interaction required (UI:N), and confidentiality, integrity, and availability impact all possible but limited (C:L/I:L/A:L). The score appropriately penalizes this as a targeted vulnerability relevant primarily to insider threats and compromised developer accounts rather than a mass-exploitation vector.

Frequently asked questions

Does this vulnerability affect ANTLR4 runtime libraries, or only the Maven plugin?

Only the Maven plugin component is affected. The core ANTLR4 parser and lexer libraries are not impacted. If you use ANTLR4 at runtime in applications (without the Maven plugin), you are not exposed to this specific vulnerability.

Can this vulnerability be exploited remotely over the network?

No. The attack vector is strictly local, requiring either direct system access or a compromised local user account on a build machine. Remote code execution over a network is not possible with this vulnerability.

What's the difference between a TOCTOU vulnerability and a normal race condition?

TOCTOU (time-of-check time-of-use) is a specific type of race condition where an attacker exploits the gap between when a system checks a condition (e.g., file permissions) and when it actually uses the resource. An attacker can change the resource between these two moments, bypassing the security check. This vulnerability follows that pattern.

If the vendor didn't respond, will there ever be a patch?

ANTLR is an open-source Apache Foundation project. While the discoverer reports the vendor did not respond, the open-source community and maintainers may independently develop and release a fix. Monitor the official ANTLR repository for updates. If no patch emerges, you may need to implement compensating controls on build server access and permissions.

This analysis is based on publicly available vulnerability data current as of June 2026. CVSS scores and severity ratings reflect standardized CVSS 3.1 methodology and may not capture organizational context. Patch version numbers and remediation steps should be verified against official vendor advisories before deployment. SEC.co provides intelligence to support informed decision-making; it does not constitute professional security advice or a substitute for internal risk assessment. Consult with your security team and test all patches in non-production environments before wide-scale deployment. Source: NVD (public-domain), retrieved 2026-08-07. Analysis generated by SEC.co (claude-haiku-4-5).