canary/djCTF-1

This commit is contained in:
2021-12-11 12:02:32 +08:00
parent 36877e5aa8
commit 3a0e685f4d
4 changed files with 67 additions and 0 deletions

41
canary/djCTF-1/djctf1.c Normal file
View File

@@ -0,0 +1,41 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void pwnable();
void init();
__attribute__((aligned(0x100)))
void flag(){
asm volatile(".byte 0x90");
asm volatile(".byte 0x90");
asm volatile(".byte 0x90");
asm volatile(".byte 0x90");
asm volatile(".byte 0x90");
asm volatile(".byte 0x90");
asm volatile(".byte 0x90");
asm volatile(".byte 0x90");
asm volatile(".byte 0x90");
asm volatile(".byte 0x90");
system("cat flag");
write(1, "Unbelieveable! You must be an experienced hacker!!\n", 51);
write(1, "That's your reward!!", 20);
}
int main(){
init();
write(1, "You are so lucky to have unlimited chance!!! xm!!!\n", 51);
while(1){
pwnable();
}
}
void init(){
setvbuf(stdout, 0LL, 2, 0LL);
setvbuf(stdin, 0LL, 2, 0LL);
setvbuf(stderr, 0LL, 2, 0LL);
}
void pwnable(){
char buf[0x10];
write(1, "> ", 2);
read(0, buf, 0x29);
write(1, "Let's check if you are successful. \n", 36);
puts(buf);
buf[0x18] = 0x00;
}