Skip to main content

CVE-2025-22145 — Vulnerability in nesbot/carbon — CVE Details

MEDIUM

Carbon has an arbitrary file include via unvalidated input passed to Carbon::setLocale

Published January 8, 2025Updated February 25, 2025Source: OSV

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.

Check my composer.lock

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 .php extension (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
Update nesbot/carbon to 2.72.6 or later
composer require "nesbot/carbon:^2.72.6"
Composer
Update nesbot/carbon to 3.8.4 or later
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).

PackageFixed 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.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 6.8 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
—
Confidentiality
—
Integrity
—
Availability
—

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

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

CVSS Score
6.8

Exploitation requires specific conditions, or the impact is limited.

EPSS Score (30-day exploit probability)
1.01%
EPSS percentile: 62

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

GHSA-j3f9-p6hm-5w6q

Related CVEs

  • CVE-2026-75592
    MEDIUM

    Kirby: Access to image files outside of the site root via path traversal in the media handling

  • CVE-2026-88023
    MEDIUM

    MongoDB: GridFS data disclosure and deletion via query-operator injection in file IDs

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my composer.lock