CVE-2026-13503: ANTLR4 Path Traversal in TokenVocab Grammar Handler
ANTLR4, a widely-used parser generator framework, contains a path traversal vulnerability in how it handles grammar vocabulary imports. An attacker can craft a malicious grammar file that, when processed by the vulnerable tokenVocab handler, reads files outside the intended directory. The flaw requires no authentication and can be exploited remotely by providing a specially constructed grammar option. While the direct impact is limited to information disclosure (reading files the attacker shouldn't access), the vulnerability is now publicly known and actively exploitable.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 5.3 MEDIUM · CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
- Weaknesses (CWE)
- CWE-22
- Affected products
- 0 configuration(s)
- Published / Modified
- 2026-06-28 / 2026-06-29
NVD description (verbatim)
A vulnerability was detected in antlr ANTLR4 up to 4.13.2. Affected by this issue is the function getImportedVocabFile of the file tool/src/org/antlr/v4/parse/TokenVocabParser.java of the component tokenVocab Grammar Option Handler. The manipulation results in path traversal. The attack can be executed remotely. The exploit is now public 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
The vulnerability exists in the TokenVocabParser.java component within ANTLR4's grammar option handler, specifically in the getImportedVocabFile function. The flaw is a classic CWE-22 path traversal issue where user-controlled input from the tokenVocab grammar option is not properly sanitized before being used in file operations. This allows an attacker to use directory traversal sequences (such as '../') to escape the expected vocabulary file directory and access arbitrary files readable by the process. The vulnerability affects ANTLR4 versions up to and including 4.13.2.
Business impact
Organizations using ANTLR4 in production toolchains—particularly those processing untrusted grammar files or exposing grammar compilation as a service—face information disclosure risks. If ANTLR4 runs with elevated privileges or has access to sensitive configuration files, credentials, or source code, an attacker could extract that data. Development environments are particularly at risk if developers routinely process grammar files from external sources (third-party libraries, open-source projects, or user submissions). The impact is less severe than remote code execution but sufficient to compromise confidentiality of stored data.
Affected systems
ANTLR4 versions up to 4.13.2 are affected. Any application or development environment using ANTLR4 to parse or compile grammar files is in scope. This includes IDEs with ANTLR plugins, build systems that invoke ANTLR4 for code generation, and language-processing tools built on ANTLR4. The vulnerability is most dangerous in environments where grammar files come from untrusted or external sources.
Exploitability
Exploitability is straightforward: an attacker crafts a grammar file containing a malicious tokenVocab option with path traversal sequences and provides it to a system running vulnerable ANTLR4. No authentication or special privileges are required on the attacker side. Since exploits are now public, the barrier to weaponization is low. However, successful exploitation requires that the target system actually process the malicious grammar file—organizations that do not use ANTLR4 or do not accept untrusted grammar inputs are unaffected.
Remediation
Upgrade ANTLR4 to a patched version released after 4.13.2. Verify against the official ANTLR project releases and security advisories for the specific patched version number. As an interim control, restrict which users can invoke ANTLR4 grammar compilation, limit the grammar files processed to trusted sources only, and run ANTLR4 processes with minimal file system permissions and under a low-privilege service account to reduce the blast radius of file disclosure.
Patch guidance
Check the ANTLR4 GitHub repository and official release notes for versions newer than 4.13.2. The fix should address the path traversal in TokenVocabParser.java by properly validating or sanitizing the tokenVocab input before file operations. Apply the patch to all development systems, build pipelines, and any production environments that invoke ANTLR4. Test grammar processing workflows post-patch to ensure no regressions. Document the patched version in your software bill of materials.
Detection guidance
Monitor ANTLR4 process execution for attempts to access files outside expected directories, particularly in vocabulary file lookups. If available, enable ANTLR4 debug logging to capture grammar option parsing. In development environments, code review grammar files for suspicious tokenVocab values containing '../' or other path traversal patterns before processing. File system auditing (via tools like auditd on Linux or Sysmon on Windows) can flag unexpected file reads from ANTLR4 processes. Watch for error messages or exceptions related to file not found when processing grammar files, as these may indicate traversal attempts.
Why prioritize this
Although the CVSS score (5.3 MEDIUM) reflects limited direct impact, this vulnerability warrants prompt attention because: (1) exploits are publicly available; (2) the attack surface is any organization processing untrusted grammar files; (3) information disclosure can expose secrets or intellectual property; and (4) organizations may not immediately realize they're affected if ANTLR4 is a transitive dependency or embedded in a larger tool. Prioritize patching in development and CI/CD environments first, where untrusted grammar files are most likely to be processed.
Risk score, explained
The CVSS 3.1 score of 5.3 (MEDIUM) reflects a remotely exploitable vulnerability with low complexity and no privilege requirement, but limited impact scope—only confidentiality is affected (the 'C' in the vector is set, while 'I' and 'A' are not). The score does not account for public exploit availability or vendor non-responsiveness, which elevate practical risk. Organizations with tight control over grammar file sources may assess lower risk; those accepting external grammars or exposing grammar compilation services should treat this as higher priority.
Frequently asked questions
Do we need to patch if we only use ANTLR4 to generate code during development and never process external grammar files?
Lower risk, but still advisable to patch. If your team only compiles grammars you control internally, exposure is minimal. However, patching is still recommended to prevent accidental misuse and to maintain a clean security posture. If any developers work with third-party grammar libraries or examples, upgrade sooner.
What files could be leaked by this vulnerability?
Any file readable by the process running ANTLR4 is in scope. Common high-value targets include: configuration files with API keys or database credentials, .git directories or source repositories, .ssh or SSL certificates, environment variable dumps, and source code. The exact risk depends on what files are accessible and what permissions the ANTLR4 process holds.
Is there a workaround if we cannot patch immediately?
Implement strict input validation: reject grammar files containing '../', '.\', or other path traversal sequences in the tokenVocab option. Run ANTLR4 in a sandboxed environment with minimal file system access. Consider using a separate unprivileged user account for grammar processing. These are temporary measures—upgrade as soon as the patch is available.
Why didn't the vendor respond to the early disclosure?
The advisory notes the vendor was contacted early but did not respond. This may indicate resource constraints, deprioritization, or communication gaps. Regardless, public exploits now exist, making community-driven or proactive patching essential. Monitor the ANTLR project's GitHub and mailing lists for patch releases.
This analysis is for informational purposes and should not be considered professional security advice tailored to your organization. Verify all patch version numbers and vendor advisories directly from the ANTLR project's official sources. CVSS scores and vulnerability metadata are current as of the advisory publication date and may be updated. Organizations should conduct their own impact assessment and risk analysis based on their specific ANTLR4 deployments and threat model. No exploit code or detailed weaponization steps are provided; consult your incident response team or security vendors if you suspect active exploitation. Source: NVD (public-domain), retrieved 2026-08-07. Analysis generated by SEC.co (claude-haiku-4-5).
Weaknesses (CWE)
Related vulnerabilities
- CVE-2018-25393MEDIUMNavigate CMS 2.8.5 Path Traversal Vulnerability (CVSS 6.5)
- CVE-2018-25421MEDIUMOpen STA Manager 2.3 Path Traversal File Download Vulnerability
- CVE-2019-25734MEDIUMContact Form by WD CSRF & Local File Inclusion Vulnerability
- CVE-2019-25740MEDIUMJoomla com_jsjobs Arbitrary File Deletion Vulnerability
- CVE-2022-50953MEDIUMWordPress admin-word-count-column Plugin Local File Read Vulnerability
- CVE-2024-47263MEDIUMSynology Hyper Backup Path Traversal – Admin Privilege Required
- CVE-2024-47273MEDIUMSynology Hyper Backup Path Traversal Vulnerability (4.3 MEDIUM)
- CVE-2025-24268MEDIUMmacOS Path Traversal Vulnerability – Patch Sequoia 15.4