Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2026-56390

CVE-2026-56390: GNU Bison Path Traversal Vulnerability

CVE-2026-56390 is a path traversal flaw in GNU Bison that allows attackers to write generated files to arbitrary filesystem locations. This post covers technical details, affected versions, impact, and mitigation.

Published:

CVE-2026-56390 Overview

CVE-2026-56390 is a file path handling vulnerability in GNU Bison, the parser generator used to produce LALR(1) parsers from grammar files. The vulnerability stems from Bison honoring grammar-level directives such as %output and %header without restriction. These directives override caller-supplied output options and accept arbitrary filesystem paths. An attacker who supplies a malicious grammar file can direct Bison to write generated output to any location writable by the invoking user. This allows overwriting existing files accessible to the Bison process. The issue was confirmed in version 3.8.2 and fixed in upstream commit 8d101c19d4d9aaedf83a448c925513742d4efcf0.

Critical Impact

Attacker-controlled grammar files can overwrite arbitrary files writable by the Bison process, enabling tampering with build artifacts, source files, or configuration in automated pipelines.

Affected Products

  • GNU Bison version 3.8.2 (confirmed vulnerable)
  • Earlier and untested GNU Bison releases prior to commit 8d101c19d4d9aaedf83a448c925513742d4efcf0 may also be affected
  • Build systems and CI/CD pipelines that process untrusted grammar files with vulnerable Bison versions

Discovery Timeline

  • 2026-07-29 - CVE-2026-56390 published to NVD
  • 2026-07-30 - Last updated in NVD database

Technical Details for CVE-2026-56390

Vulnerability Analysis

GNU Bison processes grammar (.y) files that can contain declarative directives controlling code generation. Two directives, %output and %header, specify the destination paths for the generated parser and header files. Bison accepts these grammar-embedded paths without validation and applies them even when the invoker has already specified output destinations via command-line arguments. The result is that grammar content, rather than the calling process, determines where files land on disk. This maps to [CWE-73]: External Control of File Name or Path. When Bison runs in an environment that processes untrusted grammars, such as automated build systems, package build farms, or shared code review tooling, an attacker can direct Bison to write to any path the invoking user can access.

Root Cause

The root cause is a missing precedence and validation check in how Bison resolves output destinations. The parser accepts %output and %header directives from the grammar file and treats them as authoritative, overriding safer caller-supplied options such as -o or --output. There is no path sanitization, no restriction to a working directory, and no confirmation that the target is not an existing sensitive file.

Attack Vector

Exploitation requires local execution of Bison against attacker-supplied grammar. The attacker crafts a grammar file containing a %output or %header directive pointing to a target path, for example a shell startup script, a build artifact, or a configuration file writable by the Bison process. When a developer, CI runner, or packaging system invokes bison on the file, the generated output overwrites the target. The attack does not yield direct code execution through Bison itself, but the overwritten file can carry attacker-controlled content that leads to code execution when later consumed by another tool.

No verified exploit code is publicly available. See the CERT.pl advisory
and the upstream commit for technical detail on the directive handling
and the applied fix.

Detection Methods for CVE-2026-56390

Indicators of Compromise

  • Unexpected modification of files under /etc, user home directories, or build output directories following invocation of bison
  • Grammar files containing %output or %header directives with absolute paths or .. traversal segments
  • Bison process activity writing to files outside the current working directory or expected build tree
  • Divergence between the -o argument passed on the command line and the file path actually written by the Bison process

Detection Strategies

  • Inspect .y and .yy grammar files ingested from third-party sources for %output and %header directives before invoking Bison
  • Monitor bison process file writes using audit frameworks such as auditd or eBPF-based file integrity tooling
  • Correlate invocations of bison with subsequent writes to paths outside the declared build directory
  • Flag CI pipeline jobs where Bison produces artifacts at unexpected filesystem locations

Monitoring Recommendations

  • Enable file integrity monitoring on build hosts and developer workstations that regularly execute Bison
  • Log full command lines and child process activity for bison invocations in CI runners
  • Alert on any Bison write operations targeting paths outside a sandboxed working directory

How to Mitigate CVE-2026-56390

Immediate Actions Required

  • Upgrade GNU Bison to a build that includes commit 8d101c19d4d9aaedf83a448c925513742d4efcf0 or later
  • Audit build pipelines and package recipes that invoke Bison against externally supplied grammars
  • Restrict Bison execution to unprivileged accounts and dedicated build directories
  • Scan repositories for grammar files containing %output or %header directives with unexpected paths

Patch Information

The upstream fix is available in the GNU Bison source repository via commit 8d101c19d4d9aaedf83a448c925513742d4efcf0. Maintainers did not publish a specific vulnerable version range, but version 3.8.2 was tested and confirmed vulnerable. Rebuild Bison from a source tree that includes the fix, or install a distribution package that has back-ported the change. See the GNU Bison Commit Details and the CERT.pl advisory for the full fix description.

Workarounds

  • Run bison inside a container, chroot, or unprivileged sandbox rooted at the build directory so directive-controlled paths cannot escape
  • Pre-process untrusted grammar files to strip or reject %output and %header directives before invocation
  • Execute Bison as a dedicated low-privilege user with write access only to a scratch directory
  • Use mandatory access controls such as SELinux or AppArmor policies to constrain Bison file writes
bash
# Example sandboxed invocation using bubblewrap to confine writes to the build dir
bwrap --ro-bind / / \
      --bind "$PWD/build" "$PWD/build" \
      --chdir "$PWD/build" \
      --unshare-all \
      bison -o parser.c ../grammar.y

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.