Recuperar datos del ext2 (y ext3)

Traducción del original en catalán. Léela en: CatalàEnglish

Leyendo por linuxsecurity me he encontrado un artículo muy interesante con links a artículos todavía más interesantes sobre la cantidad de cositas que tiene nuestro estimado y obsoleto ext2, pero que el ext3 mantiene...

tb podemos encontrar cosas tan itneresantes como las siguientes en el artículo:

Let us start with the classic method to hide material on UNIX filesystems (not even ext2 specific). Run a process that keeps the file open and then remove the file. The file contents are still on disk and the space will not be reclaimed by other programs. It is worthwhile to note that if an executable erases itself, its contents can be retrieved from /proc memory image: command "cp /proc/$PID/exe /tmp/file" creates a copy of a file in /tmp.

Ya me diréis que no os habéis quedado flipados después de leer esto, a quién no le ha pasado nunca que borra un demonio sin querer y tiene el proceso corriendo y entonces tiene que reinstalar el paquete entero. Pues ya veis qué fácil es recuperarlo de la RAM y volverlo a poner en nuestro HD.

En el artículo tb se comenta cómo recuperar ficheros borrados con el /bin/rm, siempre que no se hayan sobre-escrito, está claro. De hecho, hay un mini-HOWTO que habla del tema:

-Linux Ext2fs Undeletion mini-HOWTO

y si lo que queremos es un programita que nos haga el trabajo:

-e2undel

-recover

De hecho el artículo en cuestión lo que realmente nos plantea es:

On a 4GB Linux partition, the block size is typically 4K (chosen automatically when the mke2fs utility is run to create a filesystem). Thus one can reliably hide up to 4KB of data per file if using a small file. The data will be invulnerable to disk usage, invisible from the filesystem, and, which is more exciting for some people, undetectable by file integrity checkers using file checksumming algorithms and MAC times. Ext2 floppy (with a block size of 1KB) allows hiding data as well, albeit in smaller chunks.

Cosa que todos sabíamos, pero que seguramente no nos habíamos planteado nunca aprovechar este espacio. Pues si ahora lo queremos hacer ya tenemos una herramienta para hacerlo:

-bmap

bien ahora ya os he puesto el caramelo en la boca, o sea, que si queréis más info el artículo es este:

-Linux Data Hiding and Recovery