Outils d'utilisateurs

Outils du Site


overthewire_narnia:level8

Ceci est une ancienne révision du document !


Level 8

ssh narnia8@narnia.labs.overthewire.org 
pass : mohthuphog
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// gcc's variable reordering fucked things up
// to keep the level in its old style i am 
// making "i" global unti i find a fix 
// -morla 
int i; 
 
void func(char *b){
	char *blah=b;
	char bok[20];
	//int i=0;
 
	memset(bok, '\0', sizeof(bok));
	for(i=0; blah[i] != '\0'; i++)
		bok[i]=blah[i];
 
	printf("%s\n",bok);
}
 
int main(int argc, char **argv){
 
	if(argc > 1)       
		func(argv[1]);
	else    
	printf("%s argument\n", argv[0]);
 
	return 0;
}

Nous avons un buffer overflow classique, le seul problème ici c'est que nous allons écrire par dessus notre pointeur qui est utilisé par le programme pour copier notre chaine. Il va donc falloir écrire la bonne valeur sur ce pointeur.

overthewire_narnia/level8.1363530779.txt.gz · Dernière modification: 2017/04/09 15:33 (modification externe)