Skip to content

Add House of Mango (glibc 2.43): stashing unlink with a FILE as the fake chunk - #246

Open
nanhang-950 wants to merge 1 commit into
shellphish:masterfrom
nanhang-950:house-of-mango
Open

nanhang-950 wants to merge 1 commit into
shellphish:masterfrom
nanhang-950:house-of-mango

Conversation

@nanhang-950

Copy link
Copy Markdown

House of Mango uses the tcache stashing unlink loop to turn a FILE into a chunk. The fake chunk is placed at stdout-0x10, so the chunk header sits in front of the FILE and the chunk bk (offset 0x18) aliases the FILE second qword, _IO_read_ptr (offset 0x08). After any output that field points at the stdio buffer, which gives the loop its next victim without a heap leak; the buffer content at +0x18 is attacker controlled and terminates the loop.

The PoC asserts that malloc() returns stdout, with no heap address known to the attacker. Tested on glibc 2.43 and 2.44. The technique keeps stdout buffered on purpose (setvbuf _IOFBF) and writes its log to stderr, because _IO_read_ptr must point at the stdio buffer.

House of Mango uses the tcache stashing unlink loop to turn a FILE into a
chunk. The fake chunk is placed at stdout-0x10, so the chunk header sits in
front of the FILE and the chunk bk (offset 0x18) aliases the FILE second
qword, _IO_read_ptr (offset 0x08). After any output that field points at the
stdio buffer, which gives the loop its next victim without a heap leak; the
buffer content at +0x18 is attacker controlled and terminates the loop.

The PoC asserts that malloc() returns stdout, with no heap address known to
the attacker. Tested on glibc 2.43 and 2.44. The technique keeps stdout
buffered on purpose (setvbuf _IOFBF) and writes its log to stderr, because
_IO_read_ptr must point at the stdio buffer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant