linux forensics – magical mystery tour · 2020. 8. 20. · magical mystery tour hal pomeranz. who...

12
LINUX FORENSICS – MAGICAL MYSTERY TOUR Hal Pomeranz

Upload: others

Post on 06-Mar-2021

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: LINUX FORENSICS – MAGICAL MYSTERY TOUR · 2020. 8. 20. · MAGICAL MYSTERY TOUR Hal Pomeranz. WHO IS HAL POMERANZ? Started as a Unix Sys Admin in the 1980s Independent consultant

LINUX FORENSICS –MAGICAL MYSTERY TOURHal Pomeranz

Page 2: LINUX FORENSICS – MAGICAL MYSTERY TOUR · 2020. 8. 20. · MAGICAL MYSTERY TOUR Hal Pomeranz. WHO IS HAL POMERANZ? Started as a Unix Sys Admin in the 1980s Independent consultant

WHO IS HAL POMERANZ?Started as a Unix Sys Admin in the 1980sIndependent consultant since 1997Digital forensics, incident response, expert witnessHave done some interesting Linux/Unix investigations

[email protected]@hal_pomeranz

Page 3: LINUX FORENSICS – MAGICAL MYSTERY TOUR · 2020. 8. 20. · MAGICAL MYSTERY TOUR Hal Pomeranz. WHO IS HAL POMERANZ? Started as a Unix Sys Admin in the 1980s Independent consultant

LET’S TALK ABOUT EXTExt4 is the modern incarnation of a very old file system

Much of what you will see is inherited from 4.2 BSD’s FFS

When the old and new worlds mix is when things get fun!

Page 4: LINUX FORENSICS – MAGICAL MYSTERY TOUR · 2020. 8. 20. · MAGICAL MYSTERY TOUR Hal Pomeranz. WHO IS HAL POMERANZ? Started as a Unix Sys Admin in the 1980s Independent consultant

HAVING ATIMEStrict atime updates–

Useful for DFIRInefficient for file systems

Many file systems no longer update atime

Linux is weird…

Page 5: LINUX FORENSICS – MAGICAL MYSTERY TOUR · 2020. 8. 20. · MAGICAL MYSTERY TOUR Hal Pomeranz. WHO IS HAL POMERANZ? Started as a Unix Sys Admin in the 1980s Independent consultant

RELATIVE ATIMESUpdate atime on read if:

1. atime is more than 24 hours old *OR*2. atime is earlier than mtime or ctime

Result: atime now tends to indicate first use rather than last

Page 6: LINUX FORENSICS – MAGICAL MYSTERY TOUR · 2020. 8. 20. · MAGICAL MYSTERY TOUR Hal Pomeranz. WHO IS HAL POMERANZ? Started as a Unix Sys Admin in the 1980s Independent consultant

DIRECTORIESExt4 directories are unsorted lists of records:

Inode number (4 bytes)4-byte aligned entry length (2 bytes)File name length (1 byte)File type (1 byte)File name

Page 7: LINUX FORENSICS – MAGICAL MYSTERY TOUR · 2020. 8. 20. · MAGICAL MYSTERY TOUR Hal Pomeranz. WHO IS HAL POMERANZ? Started as a Unix Sys Admin in the 1980s Independent consultant

DELETING A FILEDirectory entry for deleted file unchanged

Previous directory entry “grows” to consume space

Result: See the file name and inode of deleted files!

Page 8: LINUX FORENSICS – MAGICAL MYSTERY TOUR · 2020. 8. 20. · MAGICAL MYSTERY TOUR Hal Pomeranz. WHO IS HAL POMERANZ? Started as a Unix Sys Admin in the 1980s Independent consultant

THE BAD NEWSExtent data is zeroed when files are deleted in Ext4

Knowing the inode of the deleted file doesn’t help!

Or does it..?

Page 9: LINUX FORENSICS – MAGICAL MYSTERY TOUR · 2020. 8. 20. · MAGICAL MYSTERY TOUR Hal Pomeranz. WHO IS HAL POMERANZ? Started as a Unix Sys Admin in the 1980s Independent consultant

BLOCK GROUPSBlocks are organized into Block Groups of 32K blocks

Each block group contains inodes and data blocksBlock and inode allocation bitmaps each occupy 1 blockMay also contain backup superblock, etc

Superblock(optional)

Group Desc Table(size varies)

Block/InodeBitmaps

Inodes(512 blocks)

Data Blocks(remainder)

Page 10: LINUX FORENSICS – MAGICAL MYSTERY TOUR · 2020. 8. 20. · MAGICAL MYSTERY TOUR Hal Pomeranz. WHO IS HAL POMERANZ? Started as a Unix Sys Admin in the 1980s Independent consultant

ALLOCATION STRATEGYNew directories are created in the least used block group

New files are added to same block group as directory

Page 11: LINUX FORENSICS – MAGICAL MYSTERY TOUR · 2020. 8. 20. · MAGICAL MYSTERY TOUR Hal Pomeranz. WHO IS HAL POMERANZ? Started as a Unix Sys Admin in the 1980s Independent consultant

DELETED DATA1. Use directory entry to determine inode of deleted file

2. Determine block group number from inode number

3. Search block group unallocated for deleted data

4. Profit?

Page 12: LINUX FORENSICS – MAGICAL MYSTERY TOUR · 2020. 8. 20. · MAGICAL MYSTERY TOUR Hal Pomeranz. WHO IS HAL POMERANZ? Started as a Unix Sys Admin in the 1980s Independent consultant

THANK YOU!Any final questions?Thanks for listening!

[email protected]@hal_pomeranz