CVE-2026-40467: GNU gawk Use After Free in do_getline_redir

CVE-2026-40467 · Severity: info · CVSS 5.1 · Published 2026-07-13

A memory management flaw has been identified in gawk, a widely used tool for processing text and data on Unix-like systems. This vulnerability can cause the program to crash when processing specific input commands. While primarily impacting system stability, such crashes can disrupt automated data processing tasks and scripts.

Technologies: Gnu Gawk. Vendors: Gnu.

Quick answers

Is CVE-2026-40467 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-40467 being exploited in the wild.
How severe is CVE-2026-40467?
Informational severity, with a CVSS score of 5.1, published 13 July 2026.
Which products and versions are affected?
Gnu Gawk All versions through 5.4.0.
Is there a fix for CVE-2026-40467?
A patch was published on 2026-04-03: Fix committed to gawk repository by Arnold Robbins. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-40467 attacked?
It is attacked with local access, in a software library.
Am I affected by CVE-2026-40467?
Check whether you run Gnu Gawk at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

Technical details

A Use After Free (UAF) vulnerability exists in the 'do_getline_redir()' routine within 'io.c' of GNU gawk. The root cause is the premature dereferencing of the 'redir_exp' pointer before its final use in redirection logic. An attacker who can provide a crafted AWK script or input that triggers specific redirection error paths can cause the application to reference freed memory, leading to a denial-of-service (crash). The issue is local in nature, requiring the ability to execute gawk with controlled parameters or scripts. This vulnerability was fixed in gawk version 5.4.1 by moving the DEREF calls to the appropriate exit points of the routine.

Affected products

  • GNU gawk All versions through 5.4.0

Timeline

  • 2026-04-03: patched: Fix committed to gawk repository by Arnold Robbins.
  • 2026-07-13: disclosed: Vulnerability disclosed by CERT Polska.
  • 2026-07-13: advisory: CVE-2026-40467 published.

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.