I’m still working on the Nebula chain of challenges, however, I’ve been stuck on Nebula 11 for a bit now, as well as busy outside work.
In the meantime, I still have other challenges that can be solved while I learn how to do more advanced ones. Protostar is another challenge made by Exploit-Exercises, the same people who brought you Nebula.
Protostar Stack 0 is a very easy challenge. After doing a bunch of these challenges, and seeing nobody else doing them, I finally found someone, Mito125. We’ve been chatting a little bit back and forth, and I like that we both seem to have different solutions to the problems. His can be found here. Note that he blogs in Italian, but you can get the gist using Google Translate.
First, we are given a vulnerable piece of C code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
My solutions is very similar, however a little different only due to the language being used. He uses python, and I use perl. I one day should switch to python on the command line, but I’m set in my ways. My solution is as follows:
What is happening here, is that first the “modified” variable is put onto the stack (0). It is followed by the assignment of the “buffer” when being read. Because of this, if you put more than the buffer can hold (64), it will overflow into previously assigned items in the stack. So we essentially are overflowing and assigning “modified” to “A”.