How to do it...

In this section, we will look at how we can get started with exploiting a plain vanilla stack based buffer overflow on an ARM environment.

  1. The vulnerable program in this case is as follows:
 
#include <stdio.h> 
#include <stdlib.h> 
void IShouldNeverBeCalled() 
{ 
puts("I should never be called\n"); 
exit(0); 
} 
void vulnerable(char *arg) 
{ 
char buff[10]; 
strcpy(buff,arg); 
} 
int main(int argc, char **argv) 
{ 
vulnerable(argv[1]); 
return(0); 
} 

As you can see in the preceding program, the main function takes a user-supplied input and then passes that argument to the vulnerable function which has a buffer, with the name buff, of 10 bytes. As expected, if the input argument size is significantly larger than the size of the buff, it ...

Get IoT Penetration Testing Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.