Critical Memory Corruption Vulnerability in PHP5 due to Oniguruma Library Flaw

php5 Updated 02 Oct 2025

Summary

24/05/2017
N/A
Yes i
Critical
9.8

ALPINE-CVE-2017-9226: An issue was discovered in Oniguruma 6.2.0, as used in Oniguruma-mod in Ruby through 2.4.1 and mbstring in PHP through 7.1.5. Affects php5 versions < 5.6.31-r0. Fixed in 5.6.31-r0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

PHP5 is a widely-used open-source scripting language designed for web development but also used as a general-purpose programming language. It is known for its ease of use, flexibility, and extensive community support. However, PHP5 has been found to be vulnerable to a critical memory corruption issue stemming from the Oniguruma regular expression library, which is utilized in various PHP functionalities, including mbstring. This vulnerability can lead to severe security risks if not addressed promptly.

Vulnerability Detail

An issue was discovered in Oniguruma 6.2.0, which is used in PHP5 through version 7.1.5. The vulnerability manifests as a heap out-of-bounds write or read during regular expression compilation. Specifically, octal numbers larger than 0xff are mishandled in the functions fetch_token() and fetch_token_in_cc(). A malformed regular expression containing an octal number in the form of '\700' can produce an invalid code point value, leading to out-of-bounds memory corruption. This vulnerability has a CVSS score of 9.8, indicating a critical severity level, and can potentially allow attackers to execute arbitrary code or crash the application.

How To Fix

Minimum fixed version

5.6.31-r0

This is the first release that contains the fix.

sudo apk add --upgrade php5

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, avoid using regular expressions that include octal numbers or validate input to ensure that such patterns are not processed until the package is updated. Implementing input sanitization can help mitigate the risk until a proper fix is applied.

Conclusion

The vulnerability identified in PHP5 due to the Oniguruma library poses a critical risk to applications utilizing this package. It is imperative to update to the patched version to mitigate potential exploitation. Regular monitoring and validation of dependencies can help maintain application security.

See every vulnerability recorded for php5 →

Share this vulnerability

FAQ

The vulnerability is a memory corruption issue caused by improper handling of octal numbers in regular expressions, leading to potential exploitation.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

Exploitation of this vulnerability can lead to arbitrary code execution, application crashes, or data corruption, posing significant security risks.

Yes, updating to PHP5 version 5.6.31-r0 or later will resolve the vulnerability.

If immediate updates are not possible, implement input validation to avoid processing potentially malicious regular expressions as a temporary measure.

Related vulnerabilities

Recent vulnerabilities recorded for php5.

How To Fix

Minimum fixed version

5.6.31-r0

This is the first release that contains the fix.

sudo apk add --upgrade php5

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback