VYPR
High severity7.6NVD Advisory· Published Feb 14, 2026· Updated Apr 29, 2026

CVE-2026-2469

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.

PackageAffected versionsPatched versions
directorytree/imapenginePackagist
< 1.22.31.22.3

Affected products

1

Patches

1
87fca56affd9

Merge pull request #150 from DirectoryTree/escape-id

https://github.com/DirectoryTree/ImapEngineSteve BaumanFeb 3, 2026via ghsa
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

News mentions

0

No linked articles in our index yet.