O'Reilly logo

Learning Pentesting for Android Devices by Aditya Gupta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Simple stack-based buffer overflow

In simple words, a buffer is a place to store any kind of data. An overflow occurs when the data in the buffer exceeds the size of the buffer itself. An attacker can then perform an overflow attack so as to get control of the program and execute malicious payloads.

Let's use an example of a simple program and see how we could exploit it. In the following screenshot, we have a simple program with three functions: vulnerable, ShouldNotBeCalled, and main. The following is the program we are trying to exploit:

Simple stack-based buffer overflow

The ShouldNotBeCalled function is never called during the entire runtime of the program.

The vulnerable function ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required