CVE-2026-13500: ANTLR4 Code Injection Vulnerability (Grammar Action Block Handler)
ANTLR4, a widely-used parser generator framework, contains a code injection vulnerability in how it processes grammar action blocks. An attacker can craft malicious input that manipulates the OutputFile handler to inject and execute arbitrary code during the code generation phase. This flaw requires no authentication and can be triggered remotely, making it a significant concern for anyone using ANTLR4 to build language tools, compilers, or domain-specific languages. The vulnerability affects versions up to and including 4.13.2.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 7.3 HIGH · CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
- Weaknesses (CWE)
- CWE-74, CWE-94
- Affected products
- 0 configuration(s)
- Published / Modified
- 2026-06-28 / 2026-06-29
NVD description (verbatim)
A weakness has been identified in antlr ANTLR4 up to 4.13.2. Affected is an unknown function of the file tool/src/org/antlr/v4/codegen/model/OutputFile.java of the component Grammar Action Block Handler. Executing a manipulation can lead to code injection. The attack may be launched remotely. The exploit has been made available to the public and could be used for attacks. 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-13500 is a code injection vulnerability residing in the Grammar Action Block Handler component of ANTLR4, specifically within tool/src/org/antlr/v4/codegen/model/OutputFile.java. The weakness (CWE-74: Improper Neutralization of Special Elements in Output and CWE-94: Improper Control of Generation of Code) allows an unauthenticated remote attacker to manipulate grammar action blocks during parsing or code generation, resulting in unsafe code being generated and executed. The attack surface is low-complexity (AC:L) and requires no privileges or user interaction, indicating the vulnerability can be reliably exploited in network-accessible scenarios where ANTLR4 processes untrusted grammar specifications.
Business impact
Organizations deploying ANTLR4 for parser generation, compiler development, or DSL implementation face potential code execution within their build and code-generation pipelines. Compromised grammar files or intercepted parser inputs could allow attackers to inject malicious code into generated artifacts, leading to supply-chain contamination. Development teams, build infrastructure, and downstream users of generated code may all be affected. The public availability of exploit techniques increases the likelihood of active exploitation and justifies immediate patching of affected instances.
Affected systems
ANTLR4 versions up to and including 4.13.2 are confirmed vulnerable. The component affected is the Grammar Action Block Handler in the code generation tooling, meaning the risk is present wherever ANTLR4 is used to process and generate code from grammar specifications. No specific downstream products are listed in the advisory, but any tool, framework, or application built on ANTLR4 may inherit this risk if it processes untrusted or attacker-controlled grammar input.
Exploitability
This vulnerability has a CVSS score of 7.3 (HIGH) reflecting network accessibility, low attack complexity, and no authentication or user interaction required. Public exploit code has been disclosed, removing a significant barrier to exploitation. The primary limiting factor is that an attacker must supply malicious grammar input or action blocks to the ANTLR4 toolchain—however, in scenarios where grammars are user-supplied, downloaded, or integrated from external sources, this barrier is minimal. Active exploitation is plausible and should be anticipated.
Remediation
Update ANTLR4 to a patched version released after 4.13.2. Verify the exact patched version number and release date against the official ANTLR project repository and security advisories. In the interim, restrict the use of ANTLR4 to trusted grammar sources only, disable untrusted grammar inputs, and isolate grammar processing and code generation activities to sandboxed or network-segregated build environments. Review any generated code for anomalies and consider implementing static analysis on build artifacts.
Patch guidance
Consult the official ANTLR project repository and security advisories for the specific patched release version that addresses this vulnerability. Apply the patch to all instances of ANTLR4 in development environments, build pipelines, and any deployed tools that rely on ANTLR4 for runtime grammar processing. Test patched versions thoroughly in a staging environment before production deployment to ensure compatibility with existing grammars and build workflows.
Detection guidance
Monitor for unexpected modifications to grammar files or suspicious grammar input sources. Audit build logs and ANTLR4 invocations for processing of unfamiliar or untrusted grammars. Implement file integrity monitoring on grammar repositories and build configuration. Review generated code for suspicious patterns or injected code that does not align with the original grammar specification. Check runtime or build-time error messages for signs of malformed or adversarial grammar input. In environments with Endpoint Detection and Response (EDR), look for unusual code generation or process spawning tied to ANTLR4 execution.
Why prioritize this
HIGH priority is justified by the high CVSS score (7.3), public availability of exploits, vendor non-responsiveness to early disclosure, network-accessible attack vector, and zero authentication or interaction requirements. The vulnerability affects core parser-generation infrastructure used by developers and build pipelines, making it a meaningful supply-chain and operational risk. Organizations should prioritize patching to prevent potential code injection during the development and build process.
Risk score, explained
CVSS 7.3 reflects: (1) Network vector (AV:N)—remote exploitation is possible; (2) Low attack complexity (AC:L)—reliable exploitation without specialized conditions; (3) No privileges required (PR:N); (4) No user interaction needed (UI:N); (5) Scope unchanged (S:U); and (6) Confidentiality, Integrity, and Availability impact all rated as Low (C:L/I:L/A:L). The score appropriately captures a serious vulnerability with broad attack surface but localized impact, placing it in the HIGH severity band and warranting urgent remediation.
Frequently asked questions
What versions of ANTLR4 are affected?
All versions up to and including 4.13.2 are confirmed vulnerable. Verify the exact cutoff version and any patched releases by consulting the official ANTLR project advisories and repository.
Do I need to update if I only use pre-built ANTLR4 parsers and don't process user-supplied grammars?
If you do not process untrusted or externally-sourced grammar files, your direct risk is reduced. However, you should still patch to ensure security posture and to eliminate risk from supply-chain attack vectors or accidental exposure to malicious grammars.
Can this vulnerability be exploited at runtime or only during code generation?
The vulnerability is triggered during the grammar processing and code generation phase when ANTLR4 parses action blocks. If your system uses ANTLR4 to generate code from grammars as part of runtime operations (e.g., dynamic language compilation), the risk window is larger.
Will my antivirus or EDR detect exploitation of this vulnerability?
Detection depends on the specific payload and your EDR/antivirus configuration. Proactive detection is more reliable if you monitor grammar inputs, generated code, and anomalous build-time processes rather than relying solely on malware signatures.
This analysis is provided for informational purposes and reflects publicly available vulnerability data as of the publication date. No warranty is made regarding the completeness or accuracy of remediation guidance; organizations must verify patch availability, compatibility, and applicability to their specific environments by consulting official ANTLR project advisories and vendor communications. SEC.co does not endorse any specific tools or procedures and recommends that organizations engage qualified security personnel and follow their own change management and testing protocols before deploying patches. The absence of a patch announcement does not imply the vendor is unresponsive; verify directly with ANTLR maintainers for the latest status. Source: NVD (public-domain), retrieved 2026-08-07. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-14722HIGHTidGi-Desktop Code Injection via Git Repository Import (CVSS 7.3)
- CVE-2026-14749HIGHRemote Code Injection in mjperpinosa stumasy Calculator
- CVE-2026-47162HIGHVim netrw Code Injection Vulnerability – Arbitrary Code Execution
- CVE-2026-8795HIGHRapid7 Velociraptor YAML Injection in Remapping Artifact (v0.76.6)
- CVE-2026-10175MEDIUMCode Injection in Aider-AI Aider 0.86.3 – Exploit Available
- CVE-2026-10688MEDIUMCode Injection in ahujasid blender-mcp
- CVE-2026-12822MEDIUMCode Injection in Langflow Bundle URL Loader (v1.9.3 and Earlier)
- CVE-2026-14691MEDIUMCode Injection in SourceCodester Grocery Management System 1.0