aturt13 Dojo

C++ Exploitation

What if there were a programming language that allowed you to blow your whole leg off...

4 challenges

What is std::string?

What are smart pointers?

Challenges

CHALLENGE 01

What is a string?

— solves

Heap exploitation is hard. There's safelinking, metadata corruption detection mechanisms, FILE_plus has vtable validation... If only there were a data structure that would contain a pointer and a length and whose control would allow arbitrary read and write!

They promised that C++ would be safe... They lied.

CHALLENGE 02

What is new?

— solves

What is new? And what is delete? And why is there new[] and delete[]? And what the hell is a pure virtual destructor?!

Disclaimer: I have not yet tested this challenge and it is subject to change (currently working on it).

CHALLENGE 03

What is a vtable?

— solves

How simple it was to manipulate vtable and _wide_data in FILE_plus! As if libc developers wanted us to exploit programs this way. How nice of them. But what if FILE_struct_plus were not the only structure that makes use of vtables, i.e. tables of function pointers?

Leverage a vtable exploit to get a root shell.

Btw. I felt a bit paranoid, so I added some extra measures:

g++ -Wl,-z,relro,-z,now -fstack-protector -fcf-protection=full -o main main.cpp
CHALLENGE 04

What are pancakes?!

— solves

Are pancakes bread?

Do we have academic freedom??

Should I use modern memory management in C++???

...

Should I use C++???!