CVE-2026-56389 Overview
CVE-2026-56389 is a command injection vulnerability in GNU Bison, the widely used parser generator. The flaw stems from improper handling of grammar-defined configuration variables during HTML report generation. An attacker-controlled grammar file can override the executable used for the XML-to-HTML transformation step through the %define tool.xsltproc directive. Bison accepts this value without restriction and passes it directly to execvp(). When a user runs bison --html on a malicious grammar, an arbitrary program executes with the privileges of the Bison process. Version 3.8.2 was tested and confirmed vulnerable, and other versions may also be affected.
Critical Impact
Attackers can achieve arbitrary local code execution by tricking a user into running bison --html on a crafted grammar file, gaining execution with the invoking user's privileges.
Affected Products
- GNU Bison version 3.8.2 (confirmed vulnerable)
- Other GNU Bison versions prior to commit 3169c1e7a2c6acc4c59dfcf8b089896d6881925b (untested but potentially vulnerable)
- Build environments and CI/CD systems that invoke bison --html on untrusted grammar files
Discovery Timeline
- 2026-07-29 - CVE-2026-56389 published to NVD
- 2026-07-30 - Last updated in NVD database
Technical Details for CVE-2026-56389
Vulnerability Analysis
GNU Bison supports an HTML report generation mode invoked with the --html flag. This mode converts internal XML output to HTML using an XSLT processor. The tool selects the processor executable based on a configuration variable that can be set inside the grammar file itself using the %define tool.xsltproc directive.
The vulnerability lies in how Bison consumes this directive. The specified value is passed directly to execvp() without validation, sanitization, or allow-listing. This behavior maps to OS Command Injection [CWE-78]. Because grammar files are treated as source input rather than trusted configuration, any attacker who supplies a grammar file can dictate which binary Bison executes during HTML generation.
Root Cause
The root cause is a missing separation between trusted configuration and untrusted input data. Grammar files should describe language syntax, not control which binaries the parser generator invokes. Bison's %define mechanism failed to distinguish safety-critical variables like tool.xsltproc from ordinary grammar metadata. Maintainers addressed the issue in commit 3169c1e7a2c6acc4c59dfcf8b089896d6881925b.
Attack Vector
Exploitation requires local access and user interaction. An attacker delivers a crafted .y grammar file through email, a code repository, a build artifact, or a supply-chain dependency. When a developer or automated build pipeline invokes bison --html on the file, the embedded %define tool.xsltproc value executes as a program. The attacker's binary runs with the privileges of the Bison process. See the CERT Security Advisory CVE-2026-56389 for further technical detail.
// Conceptual illustration of the vulnerable directive placement
// (No verified public exploit code is available)
//
// Inside an attacker-supplied grammar file:
// %define tool.xsltproc "/path/to/attacker/binary"
//
// Bison then invokes execvp() on the attacker-specified path
// when the user runs: bison --html grammar.y
Detection Methods for CVE-2026-56389
Indicators of Compromise
- Grammar files containing %define tool.xsltproc directives referencing non-standard paths or unexpected binaries
- Unexpected child processes spawned by bison during build or CI pipeline execution
- Shell utilities, network tools, or scripting interpreters launched from a Bison process context
- Modifications to developer or build-agent home directories immediately after invoking bison --html
Detection Strategies
- Scan repositories and build inputs for grammar files that set %define tool.xsltproc and flag any value other than the expected system xsltproc binary
- Monitor process ancestry for bison invocations that produce unexpected child executables
- Alert on bison --html execution against grammar files sourced from untrusted contributors, external tarballs, or third-party packages
Monitoring Recommendations
- Log all invocations of bison in developer workstations and CI runners, including command-line arguments and parent processes
- Track file integrity of grammar files stored in build pipelines and repositories
- Correlate Bison execution events with outbound network activity to detect post-exploitation callbacks
How to Mitigate CVE-2026-56389
Immediate Actions Required
- Upgrade GNU Bison to a version that includes commit 3169c1e7a2c6acc4c59dfcf8b089896d6881925b or later
- Audit all grammar files ingested from external sources for %define tool.xsltproc directives before running bison --html
- Restrict bison --html usage in automated pipelines that process untrusted grammar input
- Run Bison under least-privilege service accounts, especially in CI/CD workers
Patch Information
GNU Bison maintainers fixed the issue in commit 3169c1e7a2c6acc4c59dfcf8b089896d6881925b. The maintainers did not publish an explicit vulnerable version range. Consult the GNU Bison Commit Details and the GNU Bison Project Repository to build from a fixed source tree until a tagged release is distributed by your operating system vendor.
Workarounds
- Avoid running bison --html on grammar files from untrusted or unverified sources
- Pre-process grammar files to strip %define tool.xsltproc directives before invoking Bison
- Execute Bison inside a sandbox or container with no network access and restricted filesystem permissions when handling third-party grammars
- Prefer non-HTML report formats such as --graph or --xml for untrusted input, then transform output manually with a trusted xsltproc
# Configuration example: strip the vulnerable directive before running bison --html
grep -v '^%define[[:space:]]\+tool\.xsltproc' untrusted.y > sanitized.y
bison --html sanitized.y
# Or run Bison in a restricted sandbox (example using firejail)
firejail --net=none --private=/tmp/bison-sandbox bison --html untrusted.y
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

