I have the following file
-rwxr-sr-x 1 root reader 15555 janv. 1 00:00 reader
-rw-r----- 1 root reader 65 janv. 1 00:00 flag.txt
drwxr-x--x 2 root reader 4096 janv. 1 00:00 dir
Inside dir, I have the file
-rw-r--r-- 1 root reader janv. 1 00:00 dir/file1
The executable reader
open and reads file1
. The content of file1
is a simple string, and I know that with the dirty cow exploit I can write to f1 even if I don't have writing rights.
Thus, is there a way to write a program that execute commands upon being read? Like if I could change the content of file1
c for a type of cat flag.txt
, I would be able to access flag.txt since I would be reading it from reader
.