CVE-2020-7065
📋 TL;DR
A buffer overflow vulnerability in PHP's mb_strtolower() function when using UTF-32LE encoding allows attackers to corrupt memory. This could lead to crashes or potentially remote code execution. Affects PHP applications running vulnerable versions that process untrusted input with this specific encoding.
💻 Affected Systems
- PHP
📦 What is this software?
Php by Php
Php by Php
Tenable.sc by Tenable
Ubuntu Linux by Canonical
Ubuntu Linux by Canonical
Ubuntu Linux by Canonical
Ubuntu Linux by Canonical
Ubuntu Linux by Canonical
Ubuntu Linux by Canonical
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution leading to complete system compromise
Likely Case
Application crashes causing denial of service
If Mitigated
Limited impact with proper input validation and encoding restrictions
🎯 Exploit Status
Exploitation requires specific conditions but public proof-of-concept exists
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: PHP 7.3.16, PHP 7.4.4
Vendor Advisory: https://bugs.php.net/bug.php?id=79371
Restart Required: Yes
Instructions:
1. Update PHP to version 7.3.16 or higher for PHP 7.3.x, or 7.4.4 or higher for PHP 7.4.x. 2. Restart web server and PHP-FPM services. 3. Verify the update was successful.
🔧 Temporary Workarounds
Disable UTF-32LE encoding
allRemove or disable UTF-32LE encoding support in mbstring configuration
Edit php.ini and set: mbstring.encoding_translation = Off
Or remove UTF-32LE from mbstring.internal_encoding
Input validation
allValidate and sanitize all input before passing to mb_strtolower()
🧯 If You Can't Patch
- Implement strict input validation for all data passed to mb_strtolower()
- Use Web Application Firewall (WAF) rules to block suspicious encoding patterns
🔍 How to Verify
Check if Vulnerable:
Check PHP version and test with vulnerable code pattern using UTF-32LE encoding
Check Version:
php -v
Verify Fix Applied:
Verify PHP version is 7.3.16+ or 7.4.4+ and test with previously vulnerable inputs
📡 Detection & Monitoring
Log Indicators:
- Segmentation fault errors in PHP/webserver logs
- Unexpected process crashes
Network Indicators:
- HTTP requests with unusual encoding parameters
- Requests containing UTF-32LE encoded data
SIEM Query:
source="php_error.log" AND ("segmentation fault" OR "buffer overflow" OR "mb_strtolower")
🔗 References
- https://bugs.php.net/bug.php?id=79371
- https://security.netapp.com/advisory/ntap-20200403-0001/
- https://usn.ubuntu.com/4330-1/
- https://usn.ubuntu.com/4330-2/
- https://www.debian.org/security/2020/dsa-4719
- https://www.oracle.com/security-alerts/cpuoct2021.html
- https://www.php.net/ChangeLog-7.php#7.4.4
- https://www.tenable.com/security/tns-2021-14
- https://bugs.php.net/bug.php?id=79371
- https://security.netapp.com/advisory/ntap-20200403-0001/
- https://usn.ubuntu.com/4330-1/
- https://usn.ubuntu.com/4330-2/
- https://www.debian.org/security/2020/dsa-4719
- https://www.oracle.com/security-alerts/cpuoct2021.html
- https://www.php.net/ChangeLog-7.php#7.4.4
- https://www.tenable.com/security/tns-2021-14