CVE-2026-32249 Overview
A null pointer dereference vulnerability exists in Vim's NFA (Non-deterministic Finite Automaton) regex compiler affecting versions 9.1.0011 through 9.2.0136. When the regex compiler encounters a collection containing a combining character as the endpoint of a character range (e.g., [0-0\\u05bb]), it incorrectly emits the composing bytes of that character as separate NFA states. This corruption of the NFA postfix stack results in NFA_START_COLL having a NULL out1 pointer. When nfa_max_width() subsequently traverses the compiled NFA to estimate match width for look-behind assertions, it dereferences state->out1->out without a NULL check, causing a segmentation fault.
Critical Impact
Exploitation of this vulnerability can cause Vim to crash via segmentation fault when processing specially crafted regular expressions containing combining characters in collection ranges, potentially leading to denial of service or data loss for unsaved work.
Affected Products
- Vim versions 9.1.0011 through 9.2.0136
- Systems running vulnerable Vim versions with regex processing enabled
- Applications integrating Vim's regex engine
Discovery Timeline
- 2026-03-12 - CVE-2026-32249 published to NVD
- 2026-03-12 - Last updated in NVD database
Technical Details for CVE-2026-32249
Vulnerability Analysis
This vulnerability is classified as CWE-476 (NULL Pointer Dereference). The flaw resides in Vim's NFA regex compiler within the src/regexp_nfa.c source file. The core issue occurs during the compilation phase of regular expressions that include character ranges with combining characters (Unicode composing characters) as range endpoints.
When parsing a character collection like [0-0\\u05bb], the compiler is designed to handle single characters and ranges. However, when a combining character serves as an endpoint, the compiler incorrectly processes the composing bytes as individual NFA states rather than treating them as part of a single combined character. This leads to stack corruption in the NFA postfix representation.
The corruption manifests when the NFA_START_COLL state is created with an uninitialized or NULL out1 pointer. Later, during the look-behind assertion width estimation performed by nfa_max_width(), the code traverses the NFA structure and attempts to access state->out1->out without validating that state->out1 is non-NULL, resulting in a segmentation fault.
Root Cause
The root cause is improper handling of Unicode combining characters during character range parsing in the NFA regex compiler. The compiler fails to correctly identify and process composing bytes as part of a single logical character entity when that character serves as a range endpoint. This architectural oversight results in malformed NFA state generation, specifically leaving critical pointer fields uninitialized. The absence of defensive NULL checks during NFA traversal exacerbates the issue by allowing the crash to occur.
Attack Vector
This vulnerability requires local access and user interaction—an attacker must convince a user to open a file or execute a command containing a maliciously crafted regular expression. Attack scenarios include:
- A user opening a Vim script or configuration file containing the malicious regex pattern
- A user executing a search command with the crafted pattern
- Processing text files that trigger regex operations with vulnerable patterns
The security patch adds a range_endpoint boolean flag to properly track when processing character range endpoints, ensuring combining characters are handled correctly:
if (*endp == ']')
{
int plen;
+ bool range_endpoint;
/*
* Try to reverse engineer character classes. For example,
* recognize that [0-9] stands for \d and [A-Za-z_] for \h,
Source: GitHub Commit Details
Detection Methods for CVE-2026-32249
Indicators of Compromise
- Unexpected Vim process crashes with segmentation fault signals (SIGSEGV)
- Core dump files generated by Vim processes
- Log entries indicating Vim termination during regex operations
- Presence of files containing suspicious Unicode character range patterns
Detection Strategies
- Monitor for Vim process crashes and analyze core dumps for NULL pointer dereference patterns in nfa_max_width() or regexp_nfa.c
- Implement file scanning for regex patterns containing combining characters in collection ranges
- Deploy endpoint detection to alert on repeated Vim segmentation faults
- Use static analysis tools to identify potentially malicious regex patterns in scripts and configuration files
Monitoring Recommendations
- Enable crash reporting for Vim processes on critical systems
- Monitor system logs for SIGSEGV signals from Vim executables
- Track Vim version deployment across infrastructure to identify vulnerable installations
- Implement alerting for unusual patterns of editor crashes
How to Mitigate CVE-2026-32249
Immediate Actions Required
- Upgrade Vim to version 9.2.0137 or later immediately
- Audit systems for Vim installations and identify versions between 9.1.0011 and 9.2.0136
- Review recently opened files and scripts for suspicious regex patterns
- Consider temporarily restricting execution of untrusted Vim scripts
Patch Information
The vulnerability has been fixed in Vim version 9.2.0137. The patch introduces proper handling of combining characters as range endpoints by adding a range_endpoint tracking mechanism in the NFA regex compiler.
Patch Resources:
- GitHub Security Advisory GHSA-9phh-423r-778r
- GitHub Release v9.2.0137
- GitHub Commit 36d6e87542cf823d833e451e09a90ee429899cec
Workarounds
- Avoid opening untrusted files or executing scripts from unknown sources in Vim
- Disable regex-heavy plugins or scripts until upgrade is completed
- Use alternative text editors for processing untrusted content
- Implement file validation before opening in Vim on shared or public-facing systems
# Check current Vim version
vim --version | head -1
# Upgrade Vim on Debian/Ubuntu
sudo apt update && sudo apt install vim
# Upgrade Vim on RHEL/CentOS
sudo yum update vim-enhanced
# Build from source with patch
git clone https://github.com/vim/vim.git
cd vim
git checkout v9.2.0137
./configure && make && sudo make install
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


