CVE-2026-13501: ANTLR4 GoTarget Command Injection Vulnerability
ANTLR4, a widely-used parser generator framework, contains a command injection vulnerability in its Go code generation component. The vulnerability exists in how the GoTarget module processes input when invoking the Go formatter (gofmt). An attacker with local system access can craft malicious input that breaks out of the intended command context, allowing arbitrary command execution with the privileges of the user running ANTLR4. This affects ANTLR4 versions up to and including 4.13.2.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 5.3 MEDIUM · CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L
- Weaknesses (CWE)
- CWE-74, CWE-77
- Affected products
- 0 configuration(s)
- Published / Modified
- 2026-06-28 / 2026-06-29
NVD description (verbatim)
A security vulnerability has been detected in antlr ANTLR4 up to 4.13.2. Affected by this vulnerability is the function GoTarget of the file tool/src/org/antlr/v4/codegen/target/GoTarget.java of the component gofmt. The manipulation leads to command injection. The attack can only be performed from a local environment. The exploit has been disclosed publicly 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 resides in the GoTarget.java component of ANTLR4's code generation toolchain. The flaw is a classic command injection issue (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component, and CWE-77: Improper Neutralization of Special Elements used in a Command). When ANTLR4 generates Go source code, it invokes gofmt to format the output. The GoTarget implementation fails to properly sanitize or escape user-controlled input before passing it to the system command handler, allowing an attacker to inject shell metacharacters or additional commands. The attack surface is local; an attacker must have the ability to execute ANTLR4 or influence its input files on the target system.
Business impact
For development teams using ANTLR4 to generate parsers and code generators, this vulnerability introduces a supply-chain risk. If an attacker can influence grammar files or input to the build process, they can gain code execution during the build phase. This is particularly concerning in CI/CD pipelines where ANTLR4 may be invoked automatically. The impact extends beyond individual developers to any downstream consumers of generated code if the build environment is compromised. Organizations shipping products built with affected ANTLR4 versions should assess whether their build infrastructure was exposed.
Affected systems
ANTLR4 versions up to 4.13.2 are affected. The vulnerability is triggered specifically when using the Go code generation target (GoTarget). Organizations should inventory their use of ANTLR4—both as a direct dependency and as a transitive dependency in build tools or language frameworks. Go-based projects and polyglot development teams that rely on ANTLR4 for parser generation are most directly impacted.
Exploitability
The vulnerability is exploitable only from a local context (AV:L in the CVSS vector), meaning an attacker needs local system access or the ability to influence input files on the affected system. However, the exploit has been publicly disclosed, reducing the bar for attackers familiar with ANTLR4's architecture. The attack requires no elevated privileges (PR:L indicates low privilege is sufficient) and no user interaction. In cloud-native and containerized build environments, local access is more easily achieved through compromised CI/CD agents, malicious container images, or shared build servers.
Remediation
Upgrade ANTLR4 to a version released after 4.13.2 that includes the fix for the GoTarget command injection vulnerability. Verify the patched version against the vendor's official release notes. Immediately review your build pipeline configuration to ensure ANTLR4 invocations are isolated and that input files come from trusted sources. For projects unable to upgrade immediately, restrict execution of ANTLR4 to isolated build environments with minimal network access and implement input validation on grammar files before processing.
Patch guidance
Check the ANTLR4 project repository and release pages for versions newer than 4.13.2. Patch deployment should be prioritized for any build automation systems that automatically invoke ANTLR4, as these represent high-risk attack vectors. Verify that your organization's version of ANTLR4 is explicitly referenced and up-to-date in your build manifests (pom.xml, gradle files, go.mod, package.json, or equivalent). Test the patched version in a staging environment with your existing grammar definitions to ensure code generation output remains correct.
Detection guidance
Monitor system call logs and process execution records for ANTLR4 invocations that generate unexpected child processes or shell commands. Watch for unusual command-line arguments passed to gofmt or similar formatting tools. In CI/CD logs, flag ANTLR4 execution with non-standard input files or grammar sources outside your version control repository. Conduct static analysis of your grammar files for suspicious syntax or injection patterns that might be interpreted as commands. Review build logs for error messages or warnings from gofmt that might indicate command injection attempts.
Why prioritize this
Although the CVSS base score of 5.3 (Medium) reflects the local-only attack surface, the vulnerability's presence in the build pipeline makes it operationally significant. Public disclosure and vendor non-responsiveness remove any uncertainty about exploitability. Organizations should prioritize patching ANTLR4 to reduce supply-chain risk, especially in CI/CD and automated build environments where local compromise can cascade to all downstream artifacts.
Risk score, explained
The CVSS 3.1 score of 5.3 accounts for local attack vector (AV:L), low complexity (AC:L), low privilege requirement (PR:L), no user interaction (UI:N), unchanged scope (S:U), and confidentiality, integrity, and availability impacts (C:L, I:L, A:L). While a Medium severity baseline is appropriate given the local-only constraint, context matters: in shared or automated build environments, the practical risk is higher. The public disclosure and lack of vendor response increase real-world exploit likelihood.
Frequently asked questions
Does this vulnerability affect my ANTLR4 usage if I only generate Java or Python parsers?
No. The vulnerability is specific to the GoTarget code generation component. If your build process uses ANTLR4 only to generate parsers for languages other than Go, you are not directly affected. However, you should still update to a patched version as a precautionary measure.
Is upgrading to the latest ANTLR4 version sufficient, or are there other steps?
Upgrading is necessary but not always sufficient. Review your build pipeline for any hardcoded paths, custom scripts, or wrapper tools that invoke ANTLR4 with unsanitized input. Ensure your grammar files come from trusted, version-controlled sources and that untrusted input cannot influence code generation.
Can this vulnerability be exploited in a containerized CI/CD environment?
Yes. If an attacker gains access to a CI/CD agent container or can poison a container image used for builds, they can exploit this vulnerability to achieve code execution and potentially compromise generated artifacts. This is a significant risk in cloud-native development pipelines.
What should I do if I cannot immediately upgrade ANTLR4?
Isolate ANTLR4 execution to a sandboxed environment with minimal privileges and network access. Implement strict input validation for any user-supplied or external grammar files before passing them to ANTLR4. Monitor execution logs closely and consider disabling Go code generation until a patch is applied.
This analysis is provided for informational and educational purposes. SEC.co makes no warranty regarding the accuracy or completeness of this information. Vulnerability details and patch availability should be verified directly with the ANTLR4 project before taking action. Organizations should conduct their own risk assessments and testing in controlled environments before applying patches to production systems. The CVSS score and severity assessment reflect publicly available data as of the publication date and may be subject to revision. Consult your organization's security policies and vendor advisories for definitive guidance. Source: NVD (public-domain), retrieved 2026-08-07. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-10060MEDIUMTRENDnet TEW-432BRP Command Injection—End-of-Life Router Vulnerability
- CVE-2026-10061MEDIUMTRENDnet TEW-432BRP Command Injection Vulnerability – Remediation via Replacement
- CVE-2026-10127MEDIUMEdimax BR-6478AC Command Injection in Firmware 1.23
- CVE-2026-10166MEDIUMEdimax BR-6478AC Command Injection – Authentication Required
- CVE-2026-10180MEDIUMTRENDnet TEW-432BRP Command Injection Vulnerability – Hardware Retirement Required
- CVE-2026-10182MEDIUMTRENDnet TEW-432BRP Command Injection – Unpatched EOL Device
- CVE-2026-10550MEDIUMCommand Injection in elunez eladmin Deployment Module
- CVE-2026-10878MEDIUMD-Link DWR-M920 Command Injection Vulnerability – Patch Now