View Issue Details

IDProjectCategoryView StatusLast Update
0002424XdebugStep Debuggingpublic2026-06-08 14:36
Reporterilia Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionopen 
Product Version3.5.1 
Target Version3.5devFixed in Version3.5.3 
Summary0002424: Control-socket buffer crashes
Description

3 issues in 1 file, so 1 patch to keep it simple

  • read(new_sd, buffer, sizeof(buffer)) at ~line 292 leaves no room for NUL. A full 256-byte send leaves no terminator; xdebug_log_ex("Received: '%s'", buffer) walks past via strlen; xdebug_cmd_parse(buffer) walks past via its state machine.
  • zero-byte read passes the bytes_read == -1 check,xdebug_cmd_parse returns parse_error with*cmd == NULL, lookup_cmd(NULL) does strcmp(name, NULL) and crashes.

Fix:

  • read cap to sizeof(buffer)-1, explicit NUL atbuffer[bytes_read], reject bytes_read <= 0
  • NULL-check cmd before lookup_cmd

Test covers 1st & last

Steps To Reproduce
  1. Start victim.php (xdebug.mode=develop, xdebug.control_socket=default).
  2. Run attacker.php a (256 non-NUL bytes), attacker.php c (immediate close)
  3. Unpatched:
    • ASan stack-buffer-overflow atctrl_socket.c:296
    • SEGV at lookup_cmd
TagsNo tags attached.
Operating System
PHP Version8.4.10-8.4.19

Activities