Files
reverse-engineering-anything/third_party/pwntools
6357f775a0 fix(pwntools): release each PLT emulator so CET binaries keep their PLT map (#13213)
* fix(pwntools): release each PLT emulator so CET binaries keep their PLT map

pwntools 4.15.0 emulates each PLT section in a new Unicorn instance with
a 1 GiB virtual map, and hook closures keep each instance alive until
cyclic GC. Under the default 3 GiB address-space limit the third section
of a CET x86-64 image failed upstream's 1 GiB probe, so linkage.plt was
truncated with only a stderr warning (/usr/bin/ls: 4 of 108 entries).

Wrap upstream's emulate_plt_instructions for the PLT pass so each
section's emulator is collected before the next, restoring it in
finally. Peak PLT address space drops from about 3.2 GiB to 1.1 GiB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(pwntools): make the CET verifier deterministic and supervised

---------

Co-authored-by: aadheel <250292080+aadheel@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-11-22 02:35:42 +00:00
..

Offline ELF upstream profile

REA uses caller-supplied, unchanged Python packages. It vendors no pwntools, pyelftools or Unicorn implementation and never installs these dependencies.

Upstream Exact verified profile License Role
pwntools 4.15.0; tag commit 3ad86ec5adab1abf9781ca7552a6f5d7cff7a33c MIT ELF analysis and static mitigation/GOT/PLT heuristics
pyelftools 0.33 Public domain Original ELF sections, segments, symbols and relocations
Unicorn 2.1.2 GPL-2.0 Upstream PLT emulation; distinct from executing the target as a host process

The adapter checks all three runtime versions before importing the ELF engine. Original upstream code/licenses remain in the caller-selected environment. No target or core binaries are committed. Fixtures are compiled in owned temporary storage from repository source and are never executed.

bridge/pwntools/layout.py is an owned allocation-failure bootstrap; layout_impl.py is the adapter. It reads original tables through unchanged upstream APIs, preserves raw name bytes/ranges, and serializes uint64 values as strings. It never accesses ELF.libs, ELF.maps, ELF.libc or process.corefile, which have materially different execution authority.

The real verification lane traces host exec syscalls, checks original artifact hashes and observes released owned processes. No negative claim relies only on an unmodified target's sentinel: upstream can execute a patched copy when its runtime-library accessors are used.

The instance-local adapter subclass forwards the documented pyelftools 0.33 iter_segments(type=...) / iter_sections(type=...) filters missing from pwntools 4.15.0 cached overrides. No upstream file is changed. The only global substitution is scoped to the PLT pass: upstream resolves the module-global pwnlib.elf.elf.emulate_plt_instructions once per PLT section and offers no instance hook between sections, so the adapter wraps it to collect each section's Unicorn emulator before the next and restores it in finally. The bridge serves one request per process. Sectionless dynamic string tables use unique DT_STRTAB/DT_STRSZ mappings to file-backed PT_LOAD bytes; ambiguous or non-file-backed mappings are explicitly unsupported. Section-name table escapes follow the ELF ABI: SHN_XINDEX represents actual indices at least 0xff00; ordinary absence uses index zero. Raw name offsets remain reported when the name table is absent.

PLT convenience inference uses the unchanged upstream Unicorn instruction emulator. REA labels those maps as derived static evidence. The no-execution verification claim concerns launching the selected object as a host process, not the absence of static instruction emulation inside an analysis engine.