[ DownBload @ 31.03.2005. 22:14 ] @
Evo konacno i jedan zadatak za exploitanje na windozama. Ajde pliz nemojte ove teme sa zadacima ostavljati prazne. Code: /* * Simple windows exploitation challenge * ------------------------------------- * Tested on VC++ 6.0 * * Coded by Leon Juranic <[email protected]> * */ #include <stdio.h> #include <time.h> #include <stdlib.h> #include <string.h> int cookie; main (int argc, char **argv) { int control_cookie; char buffer[24]; char *ptr=buffer; char buffer2[24]; srand(time(NULL)); cookie = rand(); control_cookie = cookie; strcpy (buffer2,argv[1]); strncpy (buffer,argv[2],strlen(argv[2])); buffer[strlen(argv[2])] = '\0'; printf ("%s",ptr); if (control_cookie != cookie) { printf ("Buffer overflow detected, sorry!!!\n"); exit(-1); } printf ("OK, everything is fine\n"); } |