Bypass symlink detection
if (S_ISLNK(buf.st_mode)) { printf("Sneaky, but not good enough!\n"); return 0; }
S_ISLINK
: https://www.gnu.org/software/libc/manual/html_node/Testing-File-Type.html
[ecomaikgolf@desktop ../hacklets/REDACTED/]$ ln -s flag.txt test [ecomaikgolf@desktop ../hacklets/REDACTED/]$ file test test: symbolic link to flag.txt [ecomaikgolf@desktop ../hacklets/REDACTED/]$ rm test [ecomaikgolf@desktop ../hacklets/REDACTED/]$ ln -P flag.txt test [ecomaikgolf@desktop ../hacklets/REDACTED/]$ file test test: ASCII text [ecomaikgolf@desktop ../hacklets/REDACTED/]$ cat test Flag{...}
Also the file has the property that, if flag.txt
is deleted, the symlink continues working “And a characteristic of the PHYSICAL LINKS is that if you delete one of the two the other still exists without any problem.”.