Repository navigation
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
Open
nanhang-950 wants to merge 1 commit into
nanhang-950 wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.