CVE-2023-35169php-imap vulnerable to RCE through a directory traversal vulnerability
- 9.1CriticalCVSS base score
- 3.2%Exploitation in 30 daysEPSS · top 12% of all CVEs
- NoKnown exploitednot in CISA's KEV catalog
- YesPublic exploitsa reference or SSVC says so
Description
PHP-IMAP is a wrapper for common IMAP communication without the need to have the php-imap module installed / enabled. Prior to version 5.3.0, an unsanitized attachment filename allows any unauthenticated user to leverage a directory traversal vulnerability, which results in a remote code execution vulnerability. Every application that stores attachments with `Attachment::save()` without providing a `$filename` or passing unsanitized user input is affected by this attack. 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)`. 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. 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 or requests. Version 5.3.0 contains a patch for this issue.
Public exploit
An exploit or proof of concept is public: anyone can try it against an unpatched system. CISA's SSVC rates its exploitation: a proof of concept is public.
Timeline
ID reserved
By GitHub_M
- 9 days later
· 9 days later
Published
- 17 months later
· 17 months later
Record updated
Changes after publication (a new score, a public exploit, EPSS crossing 1, 10 or 50 %, leaving KEV) are kept since November 2026; earlier ones are not known.
Scores
| Scored by | CVSS | Score | Vector |
|---|---|---|---|
| GitHub_MCNA (assigner) | 3.1 | Critical9.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H |
| NVDNVD · Modified | 3.1 | Critical9.8 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
- EPSS (exploitation in 30 days)
- 3.2% · top 12% of all CVEs (16 Nov 2026)
- CISA SSVC
- Exploitation: poc · Automatable: no · Technical impact: total
The list uses the assigner's score when there is one, then CISA's, then NVD's: Critical 9.1.
Affected products
Affected packages
From reviewed advisories of the GitHub Advisory Database.
- Packagistwebklex/laravel-imapGHSA-47p7-xfcc-4pv9 (opens in a new tab)
- Packagistwebklex/php-imapGHSA-47p7-xfcc-4pv9 (opens in a new tab)
References
References5
- https://github.com/Webklex/php-imap/security/advisories/GHSA-47p7-xfcc-4pv9 (opens in a new tab)x_refsource_CONFIRMx_transferred
- https://github.com/Webklex/php-imap/pull/414 (opens in a new tab)x_refsource_MISCx_transferred
- https://github.com/Webklex/php-imap/blob/5.2.0/src/Attachment.php#L251-L255 (opens in a new tab)x_refsource_MISCx_transferred
- https://github.com/Webklex/php-imap/blob/5.2.0/src/Attachment.php#L252 (opens in a new tab)x_refsource_MISCx_transferred
- https://github.com/Webklex/php-imap/releases/tag/5.3.0 (opens in a new tab)x_refsource_MISCx_transferred
Sources
The same CVE in the primary databases and aggregators, to check against.
- CVE.org record (opens in a new tab)
- CVE List JSON (GitHub) (opens in a new tab)
- NVD (opens in a new tab)
- FIRST EPSS (opens in a new tab)
- EUVD EUVD-2023-1681 (opens in a new tab)
- OSV.dev (opens in a new tab)
- GitHub Advisory GHSA-47p7-xfcc-4pv9 (opens in a new tab)
- CIRCL Vulnerability-Lookup (opens in a new tab)
Badge for a README or a ticket
[](https://cveledger.app/cve/CVE-2023-35169)Record last updated .