Category Archives: Binary exploitation

Elias Levy

Does any of the binary exploiters know who Elias Levy is ?

People know him better by the name Aleph One. He is the person who wrote the article “Smashing the Stack for Fun and Profit” which is the first documentation of Buffer Overflows. Buffer Overflows are one of the most common kinds of vulnerabilities found in a C program, wherein a buffer is overflowed with and its adjacent memory locations are overwritten with the desired memory address. The control of the program is changed in such a manner that the code executes the malicious code that person exploiting the vulnerability wants it to execute.

Coming back to Elias Levy, he is the first person who to ever explain Buffer Overflow publicly. He did so by writing an article in Phrack magazine in the year 1996(which currently issues a copy once in a year or so). For all of you who are aspiring to become an expert in Binary exploitation reading and not just reading but thoroughly understanding this article is absolutely mandatory. Elias Levy is also the CTO and co-founder of the computer security company Security Focus. He was also the moderator of the full disclosure mailing list Bugtraq.

Elias Levy a.k.a. Aleph One

The article gives a very detailed step-by-step explanation of how to overflow a buffer and not only just overflow it but also to take full advantage of the overwritten values. It also explains how to write your own shell code.

But for this article it would have been difficult for me to understand what exactly is happening in Buffer Overflow. Although I’m no expert at it exploiting the vulnerability, I can atleast follow what exactly is happening.

Stack Canary

A few days back, I read about stack canaries. I thought I’d blog about it. So here goes…

A Stack Canary is a mechanism that protects the stack from getting attacked by malicious code. A stack canary is an extra bit that is added to the stack after every buffer or function in the code. In short, it is inserted in the memory wherever there is a return address, right after the buffer. This bit is then followed by the return address. Thus, if a hacker tries to overwrite the return address he would have to surely overwrite the canary bit as well. When before execution goes to the overwritten address it checks if the value of the canary bit has changed or not. If it is found that the value has been changed, the execution of the program stops immediately.

The following figure shows a clear picture of where the canary bit is placed.

However, there are ways by which this mechanism could be exploited as well. The hacker could find out the value of the original value of canary bit and then copy the same value into the location of the canary bit when the return address if being overwritten or the buffer is overflowed. So, when the address in the eip is being overwritten and the value of canary is checked it remains the same.

References :

[1] for data

[2] For the image :