CVE-2026-2469
Description
Versions of the package directorytree/imapengine before 1.22.3 are vulnerable to Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') via the id() function in ImapConnection.php due to improperly escaping user input before including it in IMAP ID commands. This allows attackers to read or delete victim's emails, terminate the victim's session or execute any valid IMAP command on victim's mailbox by including quote characters " or CRLF sequences \r\n in the input.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
directorytree/imapenginePackagist | < 1.22.3 | 1.22.3 |
Affected products
1Patches
187fca56affd9Merge pull request #150 from DirectoryTree/escape-id
2 files changed · +23 −1
src/Connection/ImapConnection.php+1 −1 modified@@ -539,7 +539,7 @@ public function id(?array $ids = null): UntaggedResponse $token = '('; foreach ($ids as $id) { - $token .= '"'.$id.'" '; + $token .= '"'.Str::escape($id).'" '; } $token = rtrim($token).')';
tests/Unit/Connection/ImapConnectionTest.php+22 −0 modified@@ -648,6 +648,28 @@ expect($response->type()->is('ID'))->toBeTrue(); }); +test('id escapes special characters to prevent command injection', function () { + $stream = new FakeStream; + $stream->open(); + + $stream->feed([ + '* OK Welcome to IMAP', + '* ID NIL', + 'TAG1 OK ID completed', + ]); + + $connection = new ImapConnection($stream); + $connection->connect('imap.example.com'); + + $connection->id([ + 'name' => 'Evil"Client', + 'version' => "1.0\r\nLOGOUT", + 'vendor' => 'Test\\Vendor', + ]); + + $stream->assertWritten('TAG1 ID ("Evil\\"Client" "1.0LOGOUT" "Test\\\\Vendor")'); +}); + test('expunge', function () { $stream = new FakeStream; $stream->open();
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
6- github.com/advisories/GHSA-rfq9-4wcm-64ghghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2026-2469ghsaADVISORY
- gist.github.com/wanamirulhakim/74b41589cdea3c07c3375e5946960778nvdWEB
- github.com/DirectoryTree/ImapEngine/commit/87fca56affd9527e6907a705e6d600c5174d9a5anvdWEB
- github.com/DirectoryTree/ImapEngine/pull/150nvdWEB
- security.snyk.io/vuln/SNYK-PHP-DIRECTORYTREEIMAPENGINE-15274300nvdWEB
News mentions
0No linked articles in our index yet.