CVE-2025-22145
NoneCVSS
—
EPSS
0.8%
Published
Jan 8, 2025
CISA due date
—
Cloudanix analysis
A library used for handling dates in PHP applications could let attackers run their own code on the server if user input was not properly checked and file uploads were allowed in the wrong places.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Moderate
- Impact
- Remote Code Execution
- Component
- Library
- Class
- Path Traversal
- Remediation
- Upgrade
- Effort
- Low
- Patch risk
- Low
What it actually does
Unsanitized user input passed to Carbon::setLocale enables path traversal that results in arbitrary .php file inclusion when the uploaded file resides in an include/require path, leading to remote code execution.
Why it matters to the business
Attackers can execute arbitrary code on servers running vulnerable Carbon versions, potentially compromising application data, user information, and hosting infrastructure with minimal prerequisites.
How an attack unfolds
An attacker uploads a malicious .php file to a writable directory that is reachable by include/require, then supplies a crafted locale string containing path traversal sequences to Carbon::setLocale, causing the application to include and execute the attacker-controlled file.
How to fix it
Upgrade briannesbitt/carbon to version 3.8.4 or 2.72.6. Validate that all calls to setLocale sanitize or whitelist locale input and restrict PHP file uploads to non-executable directories.
How to confirm the fix worked
Review source code for direct use of user input in Carbon::setLocale, confirm deployed version is 3.8.4+ or 2.72.6+, and test that crafted locale strings no longer result in file inclusion.
Typical attack path
- Identify an endpoint that accepts a locale parameter and forwards it directly to Carbon::setLocale without sanitization.
- Upload a file with .php extension containing malicious code to a directory that the web application can read via include or require.
- Craft a locale value using ../ sequences to traverse to the uploaded file path.
- Trigger the setLocale call so the malicious file is included and executed on the server.
How to detect it
Search web server and application logs for requests containing path traversal patterns in locale parameters, unexpected .php file includes, or error messages referencing Carbon locale handling; inspect uploaded file directories for recently added .php files.
- ../
- ..\
- Carbon::setLocale
- include.*\.php
What your security team should do
- Immediately upgrade all Carbon installations to 3.8.4 or 2.72.6.
- Audit application code for unsanitized locale parameters passed to Carbon.
- Enforce server-side validation that rejects path traversal sequences and restricts file upload directories.
- Monitor for unexpected file inclusions or PHP errors referencing locale values.
The record
Carbon is an international PHP extension for DateTime. Application passing unsanitized user input to Carbon::setLocale are at risk of arbitrary file include, if the application allows users to upload files with .php extension in an folder that allows include or require to read it, then they are at risk of arbitrary code ran on their servers. This vulnerability is fixed in 3.8.4 and 2.72.6.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Packagist | nesbot/carbon | 0 | 2.72.6 |
| Packagist | nesbot/carbon | 3.0.0 | 3.8.4 |
| Debian:11 | php-nesbot-carbon | 0 | No fix |
| Debian:11 | php-nesbot-carbon | 0 | 2.32.2-1+deb11u1 |
| Debian:12 | php-nesbot-carbon | 0 | No fix |
| Debian:13 | php-nesbot-carbon | 0 | 2.72.6-1 |
| Ubuntu:20.04:LTS | php-nesbot-carbon | 0 | No fix |
| Ubuntu:Pro:20.04:LTS | php-nesbot-carbon | 0 | No fix |
| packagist | nesbot/carbon | 3.0.0 | 3.8.4 |
Related vulnerabilities
- CVE-2026-87927 MaxSite CMS through 109.6 contains a local file inclusion vulnerability in the ajax and… CWE-98
- CVE-2026-15406 The Eventin – Event Calendar, Event Registration, Tickets & Booking (AI Powered) plugin… CWE-98
- CVE-2026-15667 The Eventin – Event Calendar, Event Registration, Tickets & Booking (AI Powered) plugin… CWE-98
- CVE-2026-11613 The Divi Ajax Filter plugin for WordPress is vulnerable to Local File Inclusion in all… CWE-98
- CVE-2026-28150 Unauthenticated Local File Inclusion in Golo Framework < 1.7.5 versions. CWE-98
- CVE-2026-66586 Author Local File Inclusion in WP Cafe Pro < 3.0.15 versions. CWE-98
- CVE-2026-75963 The Events Made Easy plugin for WordPress is vulnerable to Local File Inclusion in all… CWE-98
- CVE-2026-73387 Unauthenticated Local File Inclusion in Resido <= 1.5 versions. CWE-98