View Issue Details

IDProjectCategoryView StatusLast Update
0002422XdebugStep Debuggingpublic2026-06-08 14:36
Reporterilia Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.5.1 
Target Version3.5devFixed in Version3.5.3 
Summary0002422: No limit on DBGP read buffer
Description
  • xdebug_fd_read_line_delim grows context->buffer with realloc() in 128-byte chunks until a NUL delimiter arrives. No cap.
  • _fd_buf::buffer_size is int; buffer_size + newl + 1 overflows near INT_MAX.
  • realloc() return is assigned into context->buffer with no NULL check; subsequent memcpy derefs NULL.

Fix: cap at 64 MiB (XDEBUG_DBGP_MAX_PACKET), realloc into a temp, NULL-check before assignment, free old buffer on failure.

Steps To Reproduce
  1. Run attacker.php: listens on 127.0.0.1:9003, accepts xdebug's connect, reads the init packet, then streams 'A' without ever sending '\0'.
  2. Run victim.php (xdebug.mode=debug, start_with_request=yes, client_port=9003).
  3. Unpatched: victim grows past memory_limit and dies silently; long enough run hits the signed overflow.

Patched: connection closed at the cap, victim runs to completion.

TagsNo tags attached.
Operating System
PHP Version8.4.10-8.4.19

Activities