
Exploit di Dirty Cow - CVE-2016-5195
Dirty COW è una Local Privilege Escalation (LPE) nel kernel Linux nota come CVE-2016-5195. :contentReference[oaicite:0]{index=0}
In generale, Dirty COW colpisce i kernel Linux dalla 2.x alla 4.x precedenti alla 4.8.3. :contentReference[oaicite:1]{index=1}
Alcune distribuzioni hanno già backportato la patch, quindi la versione del kernel può sembrare “vecchia” ma potrebbe già essere sicura.
Dirty COW è stata corretta nei seguenti kernel (e versioni successive):
Controlla la versione del kernel target:
uname -r
# dirtycow
This exploit uses the pokemon exploit of the dirtycow vulnerability as a base and automatically generates a new passwd line.
The user will be prompted for the new password when the binary is run.
The original /etc/passwd file is then backed up to /tmp/passwd.bak and overwrites the root account with the generated line.
After running the exploit you should be able to login with the newly created user.
To use this exploit modify the user values according to your needs.
The default user being created is `toor`.
Original exploit (dirtycow's ptrace_pokedata "pokemon" method):
https://github.com/dirtycow/dirtycow.github.io/blob/master/pokemon.c
Compile with:
```bash
gcc -pthread dirty.c -o dirty -lcrypt
Quindi esegui il binario appena creato in uno dei seguenti modi:
./dirty
oppure
./dirty my-new-password
Successivamente, puoi usare su toor oppure ssh toor@...
NON DIMENTICARE DI RIPRISTINARE IL TUO /etc/passwd DOPO AVER ESEGUITO L'EXPLOIT!
mv /tmp/passwd.bak /etc/passwd
Exploit adattato da Christian "firefart" Mehlmauer