Created
July 18, 2023 12:45
-
-
Save 1337kid/e552fdf20b4fd9446dcfc5d934e5f51d to your computer and use it in GitHub Desktop.
chall1.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// overflow challenge xD | |
// gcc chall1.c -o chall1 -fno-stack-protector | |
// ./chall1 | |
// | |
// Aim : to execute shell() func | |
#include <stdio.h> | |
#include <stdlib.h> | |
void shell(){ | |
char cmd[]="/bin/bash"; | |
system(cmd); | |
} | |
void main(){ | |
int tmp = 1234; | |
char text[20]; | |
printf("Enter text: "); | |
gets(text); | |
if(tmp==5678) { | |
printf("here is the shell"); | |
shell(); | |
} else { | |
printf("noice"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment