CVE-2019-19204
📋 TL;DR
CVE-2019-19204 is a heap-based buffer over-read vulnerability in Oniguruma regular expression library versions 6.x before 6.9.4_rc2. This vulnerability allows attackers to read memory beyond allocated buffers, potentially leading to information disclosure or application crashes. Any software using vulnerable Oniguruma versions is affected, including various programming language implementations and text processing tools.
💻 Affected Systems
- Oniguruma library
- Ruby (via Oniguruma)
- PHP (via mbstring extension)
- Other software embedding Oniguruma
📦 What is this software?
Fedora by Fedoraproject
Fedora by Fedoraproject
Oniguruma by Oniguruma Project
Oniguruma by Oniguruma Project
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution through memory corruption leading to complete system compromise, though this requires specific memory layout conditions.
Likely Case
Application crashes (denial of service) or information disclosure through memory leaks.
If Mitigated
Limited impact with proper memory protection mechanisms like ASLR and DEP, though crashes may still occur.
🎯 Exploit Status
Proof-of-concept code is publicly available. Exploitation requires crafting specific regular expressions to trigger the buffer over-read.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Oniguruma 6.9.4_rc2 and later
Vendor Advisory: https://github.com/kkos/oniguruma/releases/tag/v6.9.4_rc2
Restart Required: Yes
Instructions:
1. Update Oniguruma to version 6.9.4_rc2 or later. 2. Rebuild any applications linked against Oniguruma. 3. Restart affected services. 4. For packaged distributions, use system package manager updates.
🔧 Temporary Workarounds
Input Validation
allValidate and sanitize regular expression inputs to prevent malicious patterns
Library Replacement
allTemporarily replace Oniguruma with alternative regex libraries if possible
🧯 If You Can't Patch
- Implement strict input validation for regular expressions
- Use application-level firewalls to filter malicious patterns
- Isolate affected systems from untrusted networks
- Monitor for crash logs and memory access violations
🔍 How to Verify
Check if Vulnerable:
Check Oniguruma version: `onig-config --version` or check library files. For Ruby: `ruby -e 'require "oniguruma"; puts Oniguruma::VERSION'`
Check Version:
onig-config --version 2>/dev/null || grep -r "oniguruma" /usr/lib/*.so* /usr/local/lib/*.so* 2>/dev/null | head -5
Verify Fix Applied:
Verify version is 6.9.4_rc2 or later. Test with known malicious regex patterns to ensure no crashes.
📡 Detection & Monitoring
Log Indicators:
- Application crashes with segmentation faults
- Memory access violation errors
- Unexpected process termination
Network Indicators:
- Unusual patterns of regex processing requests
- Repeated connection attempts to regex-processing endpoints
SIEM Query:
process.name:("ruby" OR "php") AND event.action:"segmentation fault" OR "memory violation"
🔗 References
- https://github.com/ManhNDd/CVE-2019-19204
- https://github.com/kkos/oniguruma/issues/162
- https://github.com/kkos/oniguruma/releases/tag/v6.9.4_rc2
- https://github.com/tarantula-team/CVE-2019-19204
- https://lists.debian.org/debian-lts-announce/2019/12/msg00002.html
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/NO267PLHGYZSWX3XTRPKYBKD4J3YOU5V/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/V3MBNW6Z4DOXSCNWGBLQ7OA3OGUJ44WL/
- https://usn.ubuntu.com/4460-1/
- https://github.com/ManhNDd/CVE-2019-19204
- https://github.com/kkos/oniguruma/issues/162
- https://github.com/kkos/oniguruma/releases/tag/v6.9.4_rc2
- https://github.com/tarantula-team/CVE-2019-19204
- https://lists.debian.org/debian-lts-announce/2019/12/msg00002.html
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/NO267PLHGYZSWX3XTRPKYBKD4J3YOU5V/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/V3MBNW6Z4DOXSCNWGBLQ7OA3OGUJ44WL/
- https://usn.ubuntu.com/4460-1/