VYPR
Unrated severityNVD Advisory· Published Dec 31, 2003· Updated Jun 16, 2026

CVE-2003-1302

CVE-2003-1302

Description

The IMAP functionality in PHP before 4.3.1 allows remote attackers to cause a denial of service via an e-mail message with a (1) To or (2) From header with an address that contains a large number of "\" (backslash) characters.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Affected products

7
  • PHP/PHP7 versions
    cpe:2.3:a:php:php:4.2.0:*:*:*:*:*:*:*+ 6 more
    • cpe:2.3:a:php:php:4.2.0:*:*:*:*:*:*:*
    • cpe:2.3:a:php:php:4.2.1:*:*:*:*:*:*:*
    • cpe:2.3:a:php:php:4.2.2:*:*:*:*:*:*:*
    • cpe:2.3:a:php:php:4.2.3:*:*:*:*:*:*:*
    • cpe:2.3:a:php:php:4.2:*:dev:*:*:*:*:*
    • cpe:2.3:a:php:php:4.3.0:*:*:*:*:*:*:*
    • (no CPE)range: <4.3.1

Patches

Vulnerability mechanics

Root cause

"Insufficient buffer size in the IMAP address parser (PHP_IMAP_ADDRESS_SIZE_BUF set to 10) causes a buffer overflow when processing email headers with many backslash characters."

Attack vector

An attacker sends an email message with a specially crafted `To:` or `From:` header, such as `\\\\\\\\\\ <t@t.com>`, containing many backslash characters. When the recipient's PHP application calls `imap_header()` on that message, the IMAP extension's address parser overflows a fixed-size buffer, causing a segmentation fault. The attack is remote and requires no authentication—the attacker only needs to deliver the malformed email to a mailbox that the target PHP script processes via IMAP. [CWE-120]

Affected code

The IMAP extension in PHP before 4.3.1, specifically the `imap_header()` function in `ext/imap/php_imap.c`, crashes when parsing email messages with a `To:` or `From:` header containing an address with a large number of backslash (`\`) characters. The crash is triggered by insufficient buffer sizing in the address parsing logic, where the constant `PHP_IMAP_ADDRESS_SIZE_BUF` (set to 10) is too small to handle the expanded representation of heavily escaped addresses.

What the fix does

The patch, referenced in the bug report as available at http://bb.prohost.org/imap.txt, fixes the buffer overflow by correcting the address parsing logic rather than simply increasing `PHP_IMAP_ADDRESS_SIZE_BUF`. The developer noted that merely enlarging the buffer is a temporary fix—an address with hundreds of backslashes would still cause a crash. The proper fix ensures the parser handles arbitrarily long escaped sequences without overflowing. The fix was committed to CVS on 2003-02-11 and shipped in PHP 4.3.1.

Preconditions

  • configThe target PHP application must use the IMAP extension (imap_header()) to process email messages from an attacker-controllable mailbox.
  • inputThe attacker must be able to send an email message with a malformed To: or From: header to the mailbox being processed.
  • authNo authentication is required beyond the ability to deliver email to the target mailbox.

Generated on Jun 16, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

2

News mentions

0

No linked articles in our index yet.