Don't like this style? Click here to change it! blue.css
Just for reference here are our struct treasure maps:
The story is roughly like this:
_IO_list_all
_IO_FILE_plus
_IO_FILE_plus
is just a thin struct that wraps an _IO_FILE
and an struct _IO_jump_t*
(pointer to a jump table)_chain
attribute is a pointer to the next filestream.By the way you can inspect these things in gdb as follows:
So the jump_table is a struct full of function pointers.
This is needed for object-oriented coding.
If you can overwrite a function pointer inside the vtable of a filestream then trigger that function you can control the instruction pointer.
When a filestream flushes it's buffers it will stream from the ptr to the end of the stream. If we control those addresses we can get arbitrary reads.
Likewise if we take over stdout and can carefully control pointers we can dump a buffer into a region.
_IO_flush_all_lockp
From our perspective this is a target rich topic, but a little light on blog-posts and articles and pretty pictures. We'll have to forge our own path. Exciting!
I'll be updating this as we go for sure, but I'd like to start with an FSOP playground for making a fake _IO_FILE_plus and linking it into the _IO_list_all:
OK So let's make an exploit together using this playground.
OK so we're going to play with this live. But once you're here the check is this:
To control the _mode write_ptr and write_base we need some treasure map offsets.