
CVE-2024-2961 (CNEXT) PHP file-read to RCE exploit adapted to an XXE/CTF channel
Adapts the PHP file-read -> RCE exploit script from Ambionics' official cnext-exploits to the SVG upload + XXE arbitrary file read scenario (PolarisCTF 2026 "Avatar Uploader" type challenges).
php://filter, data://, zlib (the script's check_vulnerable() will verify automatically)pip install -r requirements.txt (pwntools, ten, requests)| -> /: When the XML entity URL contains |, libxml fails to parse (tested: DOMDocument returns an empty document); php://filter supports bare filters without a prefix separated by /, equivalent to read=a|b|c.LIBC_FILE changed to a relative path (runs on both Windows/Linux).download_file changed to use open() for writing (the Path exported by the ten library is a PosixPath subclass, which cannot be instantiated on Windows).Remote class at the top of the script: fill in the challenge API address, account, and password.Remote.send/download (the example implementation targets the "upload SVG + parse on view" interface form; adapt similarly for other forms).-s sleep timing to verify):python cnext-exploit-xxe-polaris.py <url> '/readflag > /var/www/html/uploads/flag_out.txt' -s 2
After seeing EXPLOIT SUCCESS, use the read primitive to read the output file back.