Is it possible to plan for race conditions, so that you can execute specific commands at a specific time?
For example, the following code is vulnerable to a race condition. Is it possible to modify the file / replace it with a symlink exactly when the race window occurs and without trying continuously (like with while True
)?
if (access("file", W_OK) != 0) {
exit(1);
}
fd = open("file", O_WRONLY);
write(fd, buffer, sizeof(buffer));
Can I exploit this vulnerability with one attempt or one try? If the answer is true, how can I write an exploit to do this?
Is timing the execution flow with the C function sleep(seconds);
possible?