List soal PWN untuk KSL Seleksi
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

31 行
591 B

5 年前
  1. //gcc -m32 -mpreferred-stack-boundary=2 -fno-stack-protector -no-pie -fno-builtin -o tumpuk2 soal.c
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5. char *pager ="/";
  6. char *bin = "bin";
  7. char *sh = "sh";
  8. char binsh[8];
  9. void flag(int y,int w){
  10. if( y == 0xfacebabe && w == 0xbeefdead)
  11. system(binsh);
  12. }
  13. void ramuan(int x, char *dest, char *src){
  14. if( x == 0xdeadbeef )
  15. strcpy(dest,src);
  16. }
  17. void vuln(){
  18. char buf[64];
  19. printf("Masukkan flag : ");
  20. fflush(stdout);
  21. gets(buf);
  22. printf("flag adalah %s\n", buf);
  23. }
  24. int main(){
  25. vuln();
  26. }