This Gist contains a loopback-only C++ server and Python client for the PHP2Shell article. The client triggers a simulated upload failure, observes a stale-pointer leak, reuses the slot, and makes the server run id. It is a teaching model, not a payload for PHP.
Build with sh build.sh. Run ./server --port 18092 in one terminal and python3 exploit.py --port 18092 in another. Restart the server between runs. For the fixed comparison, use ./server --fixed --port 18093 and python3 exploit.py --port 18093.