Files

research/

Working material, not part of the shipped tool. Everything here is either ignored by git or explained below.

Provenance of tests/golden/bodies.json

The golden hashes are generated, never typed. They are produced from the public reference chain (9bie/php2shell-bypass-aslr-exp) so that poc/bodies.py can be proven byte-identical to the code the primitives were published with, without vendoring that code.

mkdir -p research/upstream
git clone --depth 1 https://github.com/9bie/php2shell-bypass-aslr-exp.git research/upstream
python research/capture_golden.py
python -m unittest tests.test_bodies_parity -v

capture_golden.py runs the reference generators with the exact parameters recorded in poc/profiles.py (a1 with --big 78, a2 via build_body(880, 64, 115, …), b1 with the 17-item leak spec and --fake-len 0xC8000 --tag), hashes the three bodies and writes tests/golden/bodies.json. If a golden mismatches, the fix belongs in poc/bodies.py — never in the golden file.

Ignored artefacts

Path Why it is not committed
research/upstream/ third-party clone, reference only; nothing in poc/ imports it
research/control/ the control-test copy with one literal widened (see NOTES.md §10)
research/libphp.so 21 MB binary from the target image; needed only for tests/test_elf.py
research/captures/* multi-megabyte HTTP responses and generated bodies

Consequences: on a fresh clone, tests/test_elf.py and the real-capture test in tests/test_leak_parse.py skip themselves. To run them, copy the module out of the target:

docker cp p2s-lab:/usr/lib/apache2/modules/libphp.so research/libphp.so

Everything else — the payload builders, the leak parser, framing, profile logic, CLI parsing — runs with no Docker, no network and no binary, which is what CI exercises.