CVE-2025-22145 — Vulnerability in nesbot/carbon — CVE Details
Carbon has an arbitrary file include via unvalidated input passed to Carbon::setLocale
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (1.01%). Schedule for your next planned update.
Does your project use an affected nesbot/carbon version?
Paste your composer.lock to check it for CVE-2025-22145 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
Impact
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.
Patches
Workarounds
Any of the below actions can be taken to prevent the issue:
- Validate input before calling
setLocale(), for instance by forbidding or removing/and\ - Call
setLocale()only with a locale from a whitelist of supported locales - When uploading files, rename them so they cannot have a
.phpextension (this is recommended even if you're not affected by this issue) - Prefer storage system that are not local to the application (remote service, or local service ran by another user so the uploaded files actually live outside of the application basedir)
References
https://en.wikipedia.org/wiki/File_inclusion_vulnerability
Credits
Thanks to Szczepan Hołyszewski who reported the issue and to Tidelift to coordinate the resolution
Advisory Timeline
- First published January 8, 2025 (687 days ago).
- Last revised February 25, 2025 — 48 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
composer require "nesbot/carbon:^2.72.6"
composer require "nesbot/carbon:^3.8.4"
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (2)
Affects 1 ecosystem: Packagist (1).
| Package | Fixed In |
|---|---|
| nesbot/carbon Packagist · Affected: 1.0.0, 1.0.1, 1.1.0, 1.10.0 (+218 more) | 2.72.6 |
| nesbot/carbon Packagist · Affected: 3.0.0, 3.0.1, 3.0.2, 3.1.0 (+16 more) | 3.8.4 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-98
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 6.8 score means for each attack dimension.
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N
References
- https://github.com/CarbonPHP/carbon/security/advisories/GHSA-j3f9-p6hm-5w6qWEB
- https://nvd.nist.gov/vuln/detail/CVE-2025-22145ADVISORY
- https://github.com/briannesbitt/Carbon/commit/129700ed449b1f02d70272d2ac802357c8c30c58WEB
- https://github.com/CarbonPHP/carbonPACKAGE
- https://lists.debian.org/debian-lts-announce/2025/02/msg00032.htmlWEB
Frequently Asked Questions
- What is CVE-2025-22145?
- Carbon has an arbitrary file include via unvalidated input passed to Carbon::setLocale. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 6.8/10).
- How do I check if my project is affected by CVE-2025-22145?
- CVE-2025-22145 affects nesbot/carbon. It has a 1.0% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2025-22145 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Exploitation requires specific conditions, or the impact is limited.
This is an above-median EPSS score — 62% of tracked vulnerabilities score at or below it, putting its exploitation likelihood in the upper half of the tracked corpus.
Also Known As
Related CVEs
- CVE-2026-75592MEDIUM
Kirby: Access to image files outside of the site root via path traversal in the media handling
- CVE-2026-88023MEDIUM
MongoDB: GridFS data disclosure and deletion via query-operator injection in file IDs