Skip to content

Instantly share code, notes, and snippets.

@1337kid
Created July 18, 2023 12:45
Show Gist options
  • Save 1337kid/e552fdf20b4fd9446dcfc5d934e5f51d to your computer and use it in GitHub Desktop.
Save 1337kid/e552fdf20b4fd9446dcfc5d934e5f51d to your computer and use it in GitHub Desktop.
chall1.c
// 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