At the beginning, the binary lets you enter 0x20 bytes for your name
. This is stored in the bss section, and it is not null terminated. After this, you get the following menu options:
- Show Name - Shows you your name
- Write Diary - Lets you allocate a page of max 0x80 size. The first four bytes of this page chunk stores the size you choose, and then the rest is the content you enter.
calloc
is used to allocate this chunk. This chunk's pointer is stored in an array immediately after yourname
in the bss section (meaning the name can be aligned to it and you can leak it using option 1). You can have a max of 14 pages. - Read Diary - Lets you pick a page index, and the corresponding page contents is output to you (using
puts
). - Edit Diary - Lets you pick a page index to edit. It will use the size stored in the first 4 bytes of the page chunk to determine how many bytes you can edit. The page index you enter is signed, so there is a bug here (you can enter negative