Executive brief
PCRE2 is a widely-used regular expression library embedded in many applications and languages. A flaw in its serialization function can inadvertently expose two bytes of uninitialized memory from previous allocations when converting compiled patterns to a portable format. While the impact is limited to two bytes and requires the attacker to already have access to serialized data, this could leak sensitive information in edge cases.
Technical details
The vulnerability is a use-of-uninitialized-memory (CWE-908) flaw in pcre2_serialize_encode(). When certain regular expressions with Unicode character classes are compiled with specific options (e.g., [\H] with PCRE2_UTF), the compiled structure contains two uninitialized bytes that are not sanitized before serialization. In debug builds, these bytes are deliberately initialized to 0x5555, but in production builds they retain whatever data was previously in that memory location. An attacker who can read the serialized output may recover those two bytes. The attack requires local access, high complexity to control what bytes are exposed, and the serialized data must be exposed to an untrusted actor—a scenario the PCRE2 developers consider unsafe. Fixed in version 10.48.
Affected products
- PCRE2Project PCRE2 10.45 to before 10.48
Timeline
- 2025-10-25: disclosed
- 2026-08-31: patched: Fixed in version 10.48