CVE-2015-2171: Slim vulnerable to PHP object injection

slim/slim Updated 02 Oct 2025

Summary

17/05/2022
Yes i
High
Not published

CVE-2015-2171: Slim vulnerable to PHP object injection. Affects slim/slim versions < 2.6.0. Fixed in 2.6.0. 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 Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

Slim is a PHP micro-framework that helps developers quickly build web applications and APIs. It provides a simple and elegant way to handle HTTP requests and responses. However, versions before 2.6.0 of Slim are vulnerable to PHP object injection attacks through crafted session data in the Middleware/SessionCookie.php file.

Vulnerability Detail

The vulnerability in Slim allows remote attackers to exploit PHP object injection and execute arbitrary PHP code. By manipulating session data, an attacker can inject malicious objects into the application, potentially leading to unauthorized access, data leakage, or remote code execution. This vulnerability has a high severity rating and is classified under CWE-94.

How To Fix

Minimum fixed version

2.6.0

This is the first release that contains the fix.

composer require slim/slim:2.6.0

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

Workaround

If upgrading to the latest version of Slim is not immediately feasible, developers can implement a workaround by manually validating and sanitizing session data before using it. This involves checking the integrity and authenticity of the session data and ensuring that it does not contain any unexpected or malicious objects. Here is an example of how to sanitize session data in PHP:

function sanitizeSessionData($data) {
    // Perform validation and sanitization
    // Example code: remove any objects from the session data
    foreach ($data as $key => $value) {
        if (is_object($value)) {
            unset($data[$key]);
        }
    }

    return $data;
}

By implementing this workaround, developers can reduce the risk of PHP object injection until they are able to upgrade to a secure version of Slim.

Conclusion

The vulnerability in Slim versions prior to 2.6.0 allows for PHP object injection attacks, which can lead to unauthorized access, data leakage, or remote code execution. To mitigate this vulnerability, it is recommended to upgrade to Slim 2.6.0 or later. Alternatively, developers can implement a workaround by manually validating and sanitizing session data. Stay informed about vulnerabilities in your software by using Vulert, a tool that monitors and alerts in real-time for open-source vulnerabilities.

See every vulnerability recorded for slim/slim →

Share this vulnerability

FAQ

PHP object injection is a vulnerability that occurs when untrusted user input is deserialized and used to create PHP objects. Attackers can exploit this vulnerability to inject malicious objects into an application, leading to various security risks.

If your application uses a vulnerable version of Slim, it is susceptible to PHP object injection attacks. This can result in unauthorized access, data leakage, or remote code execution, depending on how the injected objects are utilized.

While specific exploits for this vulnerability may exist, they have not been disclosed in the provided information. However, it is crucial to address this vulnerability promptly to prevent potential exploitation.

No specific incidents related to this vulnerability have been mentioned in the provided information. However, it is important to stay vigilant and apply the necessary security patches to mitigate the risk.

For more information about the Slim vulnerability, you can refer to the official GitHub advisory database. Additionally, you can reach out to info@devnack.com for further support on vulnerability remediation.

Related vulnerabilities

Recent vulnerabilities recorded for slim/slim.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

2.6.0

This is the first release that contains the fix.

composer require slim/slim:2.6.0

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