49
Spezielle Techniken und Technologien der Informatik Forensik des Massenspeichers Robert Baumgartl 19. April 2018 1 / 49

Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

  • Upload
    vanbao

  • View
    212

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Spezielle Techniken und Technologien derInformatik

Forensik des Massenspeichers

Robert Baumgartl

19. April 2018

1 / 49

Page 2: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Computerforensik?

Computerforensik ist die Untersuchung und Analyse vonRechensystemen zwecks Identifizierung, Gewinnung, Dokumentationund Interpretation von Daten, die potentiell als Beweismittel vorGericht dienen sollen.

I i. a. zum Nachweis bzw. zur Ermittlung von Straftaten

I „Wer, Was, Wo, Wann, Womit, Wie und Weshalb“

I Querschnittsthema der Informatik mit vielen Teilaspekten

2 / 49

Page 3: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Beschränkung

I MassenspeicherI komplex, weil groß und vielfältigI NTFS, ext2fs, ext3fs, ext4fs, btrfs, fat, vfat, exfat, . . .

„Neben“lerneffekte:I Management des Massenspeichers (↑ BS2); Aufbau von

DateisystemenI Wiederherstellung versehentlich gelöschter Daten

Nicht betrachtet: professionelle Datenrettung (nachFestplattensturz usw.)

3 / 49

Page 4: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Literatur

I Alexander Geschonneck. Computer-Forensik. 6. Aufl.dpunkt, 2014

I Bruce Carrier. File System Forensic Analysis. AddisonWesley, 2005

I Bruce J. Nikkel. “Forensic analysis of GPT disks and GUIDpartition tables”. In: Digital Investigation 6 (2009), S. 39–47

I Linda Volonino und Reynaldo Anzaldua. ComputerForensics For Dummies. Wiley, 2008

Weitere Informationsquellen:I Zeitschrift „Digital Investigation“I Bachelorstudiengang „Allgemeine und Digitale Forensik“,

FH Mittweida

4 / 49

Page 5: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Informationsquellen für die praktische Arbeit

I Partitionstypen für MBR-partitionierte Datenträgerhttps://www.win.tue.nl/~aeb/partitions/partition_types-1.html

5 / 49

Page 6: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Begriffe

I Dezimal- und Binärpräfixe: ↑https://de.wikipedia.org/wiki/Binärpräfix

I Datenträger bestehen aus logischen Blöcken (historisch:Sektoren) fester Größe (typisch: 512 Byte oder 4 KiB)

I Logische Blöcke werden ab 0 durchnumeriert, Nummern heißenLogische Blockadressen (Logical Block Address – LBA)

6 / 49

Page 7: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Strukturierung von Massenspeichern

Massenspeicher sind i. a. in eine Menge hierarchischerAbstraktionen strukturiert:

1. Medium: Festplatte, SSD, DVD, USB-Stick, Diskette2. Partition: logisch zusammengehöriger Teil einer Festplatte

(zusammenhängend)3. Dateisystem4. Datei und Verzeichnis5. (Satz, Record, Feld)

Auf jeder dieser Ebenen ist ein Verstecken von Daten möglich.

7 / 49

Page 8: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Partitionen

Zweck: Aufteilung und logische Separation eines großenDatenträgers für unterschiedliche Aufgaben, z. B. :

I Partition für unterschiedliche BSI Trennung System- von NutzerdatenI SwapspaceI WiederherstellungspartitionI Hibernation Partition

58

General Theory of Partitions One of the concepts in a volume system is to create partitions. A partition is a collection of consecutive sectors in a volume. By definition, a partition is also a volume, which is why the terms are frequently confused. I will refer to the volume in which a partition is located as the partition's parent volume. Partitions are used in many scenarios, including

• Some file systems have a maximum size that is smaller than hard disks. • Many laptops use a special partition to store memory contents when the system is put

to sleep. • UNIX systems use different partitions for different directories to minimize the impact

of file system corruption. • IA32-based systems that have multiple operating systems, such as Microsoft

Windows and Linux, may require separate partitions for each operating system. Consider a Microsoft Windows system with one hard disk. The hard disk volume is partitioned into three smaller volumes, and each has a file system. Windows assigns the names C, D, and E to each volume. We can see this in Figure 4.1. Figure 4.1. An example hard disk volume is organized into three partitions, which are assigned

volume names.

Each operating system and hardware platform typically uses a different partitioning method. We will cover the different implementations in Chapter 5, "PC-based Partitions," and Chapter 6, "Server-based Partitions," but we will examine the basic components here. The common partition systems have one or more tables, and each table entry describes a partition. The data in the entry will have the starting sector of the partition, the ending sector of the partition (or the length), and the type of partition. Figure 4.2 shows an example table with three partitions.

Figure 4.2. A basic table with entries for the start, end, and type of each partition.

The purpose of a partition system is to organize the layout of a volume; therefore, the only essential data are the starting and ending location for each partition. A partition system

Abbildung: Prinzip einer Partitionstabelle

8 / 49

Page 9: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Partitionierungsschemata

Es existieren zwei wesentliche Partitionierungsprinzipien:I DOS-Partitionen mit Master Boot Record

(IBM-PC-kompatible Computer, bis ca. 2010,Flash-Medien)

I GUID-Partitionstabelle (GPT) für gleiche Hardware abca. 2010

I keine Partitionstabelle bei geringer Kapazität (Disketten)Weitere Schemata existieren, sind aber so gut wie nur nochvon historischem Interesse (Apple Partition Map, Volume Tableof Contents, . . . )Keines der Partitionierungsprinzipien ist standardisiert (→„Industriestandard“)Literatur:http://www.win.tue.nl/~aeb/partitions/partition_tables.html

9 / 49

Page 10: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Master Boot Record (MBR)

1. logischer Block der Partition:

Start Länge Inhalt0 446 Bootcode (Programm)

446 (1BE16) 16 Eintrag 1 der Partitionstabelle462 (1CE16) 16 Eintrag 2 der Partitionstabelle478 (1DE16) 16 Eintrag 3 der Partitionstabelle494 (1EE16) 16 Eintrag 4 der Partitionstabelle

510 2 Signatur (0xAA55)

Tabelle: Aufbau des Master Boot Record

10 / 49

Page 11: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

DOS-Partition: Partitionstabelleneintrag

Start Länge Inhalt0 1 Bootflag1 3 Partitionsbeginn (CHS-Adresse 8/6/10 Bit)4 1 Typ der Partition5 3 Partitionsende (CHS-Adresse 8/6/10 Bit)8 4 Partitionsbeginn (LBA)

12 4 Länge der Partition (Sektoren)

verbreitete Partitionstypen: 05 Extended Partition, 07 WindowsNTFS, 82 Linux Swap, 83 Native Linux u. v. a. m.

11 / 49

Page 12: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

DOS-Partition: Beispiel

Partitionstabelle:

80 20 21 00 83 1a 3b 1f 00 08 00 00 00 98 07 0000 3b 1b 1f 05 fe ff ff fe a7 07 00 02 b0 30 3a00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

1. bootbar, Native Linux (8316), Startsektor 80016 = 204810, Länge7980016 = 49766410 Sektoren á 512 Byte (=243 MiB)

2. nicht bootfähig, „DOS 3.3+ Extended Partition“, Startsektor7a7fe16 = 50175810, Länge 3a30b00216 = 976.269.31410Sektoren (ca. 465.5 GiB)

3.+4. nicht verwendet

(vgl.fdisk -lu als root)

12 / 49

Page 13: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

DOS-Partition: Extended PartitionsPrinzip

Problem: feste Anzahl (4) Partitionen ggf. nicht ausreichend (z. B. fürgrößere Datenträger)

Lösung: letzten Partitionstabelleneintrag gesondert behandeln;Eintrag repräsentiert eine Liste von Partitionen, d. h.:

I 1-3 Primary Partitions und dann (genau) 1 Primary ExtendedPartition, die den ganzen Rest umfasst (und in sich wiedermehrere Partitionen haben kann)

I Primary Extended Partition besitzt vorangestellt eigenePartitionstabelle (mit maximal 4 Einträgen), diese verweisen auf

I Secondary File System Partition („logisches Laufwerk“), dieein Dateisystem enthält und/oder

I Secondary Extended Partition, die rekursiv die gleicheStruktur besitzt, wie die Primary Extended Partition

Literatur: Bruce Carrier. File System Forensic Analysis. AddisonWesley, 2005, S.67ff

13 / 49

Page 14: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

DOS-Partition: Extended PartitionBeispiel

69

Consider an example. We have a 12GB disk and we want to break it up into six 2GB partitions. We create the first three 2GB partitions using the first three entries in the MBR, and the remaining 6GB is allocated to a primary extended partition, which spans from 6GB to 12GB. We need to allocate three more partitions using the linked-list method. We use the partition table in the first sector of the primary extended partition, make a secondary file system partition that spans from 6GB to 8GB, and make a secondary extended partition that spans from 8GB to 10GB. A partition table is inside the secondary extended partition, and it has entries for a secondary file system partition that spans from 8GB to 10GB and an entry for another secondary extended partition that spans from 10GB to 12GB. A partition table is inside the last secondary extended partition, and it has an entry for the final file system partition, which spans from 10GB to 12GB. We see this in Figure 5.4.

Figure 5.4. The layout required for a disk with six file system partitions.

As I have described it and as most documents claim, an extended partition table should have, at most, one entry for a secondary file system partition and one entry for a secondary extended partition. In practice, most operating systems will not generate an error if more than two entries are being used. In fact, in July 2003, I released a 160 MB disk image [Carrier 2003] with six 25 MB DOS partitions to the CFTT Yahoo! Groups list (http://groups.yahoo.com/group/cftt/). The image had a primary extended partition table with two secondary file system partition entries and one secondary extended partition entry. Some forensic tools properly handled the third partition entry, while others ignored it or claimed that the 25 MB partition was a 1 TB partition. This example shows how something as common as DOS partitions can cause problems with analysis tools.

Abbildung: Nutzung von Primary und Secondary Extended Partitions1

zur Realisierung von 6 Partitionen

1Bruce Carrier. File System Forensic Analysis. Addison Wesley, 2005, S. 69 14 / 49

Page 15: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

DOS-PartitionierungsschemaFazit

I basiert auf technischem Stand der 80er Jahre(PC-Architektur)

I nicht standardisiert; keine technische ReferenzI aufwandsarm nur 4 PartitionenI komplex, wenn mehr als 4 Partitionen notwendigI Limit: 4 Byte für Länge der Partition in Sektoren

(; max. 232 − 1 Sektoren á 512 Bytes= 241 Bytes = 2 TiB)

→ GUID-Partitionierungsschema (2010)

15 / 49

Page 16: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

GUID Partition Table (GPT)

I Teil der UEFI2-SpezifikationI LBA-Angaben nun 64bittigI bis zu 128 Partitionen möglichI verbesserte Fehlertoleranz

106

As with other partition systems, the 'type' field in the partition description is not enforced. Just because the disk label structure says that the partition is for the /var/ partition or swap space does not mean that it is. As always, look at the disk for unused space. If the location of the disk label cannot be determined, a search can be performed using the signature values. The signature value of 0x600DDEEE exists inside the disk label, and 0xDABE exists in bytes 508 to 509.

Summary Solaris systems are common in corporate settings and will be investigated for intrusions and cases of fraud. This section has shown how Solaris organizes its disks and how the layout can be listed and extracted. The disk label structure is fairly simple, and it can be read with the fdisk or mmls tools.

GPT Partitions Systems with 64-bit Intel Itanium processors (IA64) do not have a BIOS like IA32 systems do. Instead, they have an Extensible Firmware Interface (EFI). EFI (available at http://www.intel.com/technology/efi) is also used by non-Intel platforms, such as Sun Sparc systems. The EFI uses a partition system called the GUID Partition Table (GPT) that can support up to 128 partitions and uses 64-bit LBA addresses. Backup copies of the important data structures are maintained in case of failure. At the time of this writing, GPT disks are found in high-end servers and not in typical desktop systems.

General Overview A GPT disk has five major areas to it, as shown in Figure 6.7. The first area is the Protective MBR, and it starts in the first sector of the disk and contains a DOS partition table with one entry. The single entry is for a partition with a type of 0xEE that spans the entire disk. This partition exists so that legacy computers can recognize the disk as being used and do not try to format it. EFI does not actually use the partition, though.

Figure 6.7. A GPT disk has five areas in its layout.

The second part of the GPT disk starts in sector 1 and contains the GPT header. The header defines the size and location of the partition table, which are fixed when the GPT disk is created. Windows limits the number of entries in the partition table to 128 [Microsoft 2004]. The header also contains a checksum of the header and the partition table so that errors or modifications can be detected. The third section contains the partition table. Each entry in the partition table contains a starting and ending address, a type value, a name, attribute flags, and a GUID value. The 128-bit GUID is supposed to be unique for that system and is set when the partition table is created. The fourth section of the disk is the partition area. The partition area is the largest area and contains the sectors that will be allocated to partitions. The starting and ending sectors for this area are defined in the GPT header. The final section of the disk contains a backup copy of the GPT header and partition table. It is located in the sector following the partition area.

Abbildung: Grundsätzlicher Aufbau eines Datenträgers mit GPT3

(unmaßstäblich)

2Unified Extensible Firmware Interface3Bruce Carrier. File System Forensic Analysis. Addison Wesley, 2005, S. 106

16 / 49

Page 17: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

GUID Partition Table (GPT)Struktur des Datenträgers

LBA 0I enthält (wie bisher) MBRI einzelne primäre Partition, Typ 0xEE, mit maximaler Länge

(2 TiB)I MBR-basierte Werkzeuge erkennen 0xEE als „Legacy

MBR“ und weigern sich, die Disk zu manipulierenI ; “Protective MBR”

LBA 1I GPT HeaderI 1 Sektor (d. h. , gewöhnlich 512 Byte)

17 / 49

Page 18: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

GUID Partition Table (GPT)Aufbau des GPT-Headers

Start Länge Inhalt0 0x00 8 Signatur „EFI PART“8 0x08 4 Revision (0x00 0x00 0x01 0x00)

12 0x0c 4 Größe des Headers in Bytes16 0x10 4 CRC32 des Headers20 0x14 4 reserviert (0x00 0x00 0x00 0x00)24 0x18 8 aktuelle LBA32 0x20 8 LBA des Backups (des GPT-Headers)40 0x28 8 LBA des Starts der Partition Area48 0x30 8 LBA des Endes der Partition Area56 0x38 16 GUID des Datenträgers (UUID)72 0x48 8 LBA des Starts der Partitionstabelle80 0x50 4 Anzahl Einträge in Partition Table84 0x54 4 Größe eines Eintrags in PT (0x80 = 128 Bytes)88 0x58 4 CRC32 der Partitionstabelle

18 / 49

Page 19: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

GUID Partition Table (GPT)Aufbau eines Eintrags in der Partitionstabelle

I konstant 128 Byte pro Eintrag

Start Länge Inhalt0 0x00 16 GUID des Partitionstyps

16 0x10 16 Unique GUID der Partition32 0x20 8 LBA des 1. Blockes der Partition40 0x28 8 LBA des letzten Blockes der Partition48 0x30 8 Attribute der Partition56 0x38 72 Name der Partition in Unicode

I Attribute aus forensischer Sicht uninteressant

19 / 49

Page 20: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

DOS-Partitionen vs. GUID Partition Table (GPT)

Erzielte Verbesserungen:I Fehlertoleranz

I CRCs für Partitionstabelle und HeaderI Redundanz: 2 Partitionstabellen, 2 HeaderI Speicherung des Backups räumlich getrennt und „verkehrt

herum“I Limits aufgehoben bzw. deutlich vergrößert

I Partitionsgröße (2 TiB→ ?)I mögliche Anzahl Partitionen

I klarere und verständlichere Struktur

20 / 49

Page 21: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

DateisystemeKategorien forensischer Daten in Dateisystemen

130

belong to one of the categories based on the role they play in the file system. We will use these categories throughout this book when describing file systems, although some file systems, namely FAT, cannot be applied to this model as easily as others can. The tools in The Sleuth Kit (TSK) are based on these same categories. The file system category contains the general file system information. All file systems have a general structure to them, but each instance of a file system is unique because it has a unique size and can be tuned for performance. Data in the file system category may tell you where to find certain data structures and how big a data unit is. You can think of data in this category as a map for this specific file system. The content category contains the data that comprise the actual content of a file, which is the reason we have file systems in the first place. Most of the data in a file system belong to this category, and it is typically organized into a collection of standard-sized containers. Each file system assigns a different name to the containers, such as clusters and blocks, and I will use the general term data units until we discuss specific file systems. The metadata category contains the data that describe a file; they are data that describe data. This category contains information, such as where the file content is stored, how big the file is, the times and dates when the file was last read from or written to, and access control information. Note that this category does not contain the content of the file, and it may not contain the name of the file. Examples of data structures in this category include FAT directory entries, NTFS Master File Table (MFT) entries, and UFS and Ext3 inode structures.

Figure 8.1. Interaction between the five data categories.

The file name category, or human interface category, contains the data that assign a name to each file. In most file systems, these data are located in the contents of a directory and are a list of file names with the corresponding metadata address. The file name category is similar to a host name in a network. Network devices communicate with each other using IP addresses, which are difficult for people to remember. When a user enters the host name of a remote computer, the local computer must translate the name to an IP address before communication can start.

Abbildung: Kategorien forensischer Daten in Dateisystemen4

4Bruce Carrier. File System Forensic Analysis. Addison Wesley, 2005, S. 13021 / 49

Page 22: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Warum FAT?

I alte Rechner (bis Windows ME)I wichtigstes Austauschformat zwischen unterschiedlichen

Betriebssystemen (gemeinsame Partitionen,USB-Memory-Sticks)

I Consumerelektronik: Handy, Digitalkamera, MP3-Player,PDAs

“FAT is supported by all Windows and most Unix OperatingSystems, and will be encountered by investigators for yearsto come, even if it is not the default file system of desktopWindows systems” (Bruce Carrier. File System ForensicAnalysis. Addison Wesley, 2005, S. 156)

22 / 49

Page 23: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Grundlegender Aufbau eines FAT-Dateisystems

157

a structure that is called the FAT. The FAT structure is used to identify the next cluster in a file, and it is also used to identify the allocation status of clusters. Therefore it is used in both the content and metadata categories. There are three different versions of FAT: FAT12, FAT16, and FAT32. The major difference among them is the size of the entries in the FAT structure. The relationships between these data structures will be examined in more detail, but we can see this relationship in Figure 9.1. The layout of the FAT file system has three physical sections to it, which can be seen in Figure 9.2. The first section is the reserved area, and it includes data in the file system category. In FAT12 and FAT16 this area is typically only 1 sector in size, but the size is defined in the boot sector. The second section is the FAT area, and it contains the primary and backup FAT structures. It starts in the sector following the reserved area, and its size is calculated based on the number and size of FAT structures. The third section is the data area, and it contains the clusters that will be allocated to store file and directory content.

Figure 9.2. Physical layout of a FAT file system.

File System Category The data in the file system category describe the general file system, and they are used to find the other important data structures. This section describes the general concepts about where FAT stores the data in this category and how we can analyze the data.

General Concepts In a FAT file system, the file system category of data can be found in the boot sector data structure. The boot sector is located in the first sector of the volume, and it is part of the reserved area of the file system. Microsoft refers to some of the data in the first sector as belonging to the BIOS Parameter Block (BPB), but for simplicity I'll use the term boot sector. The boot sector contains data that belong to all categories in the model, so I will wait until we get to each of those categories to describe those values. There is no field that identifies the file system as FAT12, FAT16, or FAT32. The type can be determined only by performing calculations from the boot sector data. I will show that calculation at the end of the chapter because it relies on concepts that have not yet been discussed. A FAT32 file system boot sector contains additional data, including the sector address of a backup copy of the boot sector and a major and minor version number. The backup copy of the boot sector can be used if the version in sector 0 becomes corrupt, and the Microsoft documentation says that it should always be in sector 6 so that tools can automatically find it if the default copy goes bad. The data structure for the boot sector is discussed in Chapter 10. FAT32 file systems also have an FSINFO data structure that contains information about the location of the next available cluster and the total amount of free clusters. The data are not guaranteed to be accurate, and are there only as a guide for the operating system. Its data structure is described in the next chapter.

Essential Boot Sector Data One of the first things we need to know when analyzing a FAT file system is the location of the three physical layout areas. The reserved area starts in sector 0 of the file system, and its

Abbildung: Layout eines FAT-basierten Dateisystems

23 / 49

Page 24: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Cluster

I Data Area ist in Logische Blöcke5 (Cluster) strukturiert:I 2nfaches der Sektorgröße; Maximum 32768 BytesI Größe steht im Bootsektor („Reserved Area“)I durchnumeriert, beginnend mit 2 (!)

I Cluster können somit auf 2 Arten adressiert werden:1. mit ihrer Clusternummer C2. mit der Sektornummer S (gebräuchlicher)

I Umrechnung C → S:

S = (C−2)·Sektoren/Cluster+Sektornummer von Cluster 2

I Umrechnung S → C:

C =S − Sektornummer von Cluster 2

Sektoren/Cluster+ 2

5Achtung! Nicht mit den Logical Blocks des Datenträgers (Sektoren) verwechseln; die Logischen Blöcke desDateisystems sind gerade ein Vielfaches von denen!

24 / 49

Page 25: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Grundlegende Prinzipien

I jede Datei und jedes Verzeichnis besitzen genau einenVerzeichniseintrag (Name, Größe, Metadaten,Anfangscluster)

I welche Cluster zu einer Datei gehören, steht in der FileAllocation Table (FAT)

datei1.txt 6845 Bytes #42

Verzeichniseintrag Cluster (Blöcke)

#43

#42

...

...

43

EOF

FAT

Abbildung: Grundprinzip des FAT-Dateisystems

25 / 49

Page 26: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

FAT

I FAT hat für jeden Cluster einen Eintrag (; Länge der FAT hängtvon Größe der Data Area und der Clustergröße ab)Beispiel: Die Data Area umfasst die Sektoren von 7726 bis 3946495; jederCluster ist 4 KiB groß. Dann gibt es b(3946495− 7726+ 1)/8c = 492346 Cluster,wofür 492346*4 Byte = 1969384 Byte ≈ 2 MiB für die FAT benötigt werden.

I Größe eines Eintrages in der FAT hängt von Variante ab(FAT12/FAT16/FAT32); FAT32 hat 32-Bit-Einträge(Clusternummern)

I mögliche Werte:

I = 0x0000.0000→ Cluster ist unbenutztI = 0x0fff.fff7→ Cluster ist defektI ansonsten→ Cluster gehört zu einer Datei

I beim Löschen einer Datei wird meist der FAT-Eintrag nur auf 0gesetzt; der Clusterinhalt bleibt erhalten

26 / 49

Page 27: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Varianten

I 3 Varianten: FAT12, FAT16, FAT32→ bezieht sich aufmaximale Größe der Clusternummer in Bit (aber: FAT32hat Maximum bei 228 − 1)

I kein Feld zur Unterscheidung, Version muß ermitteltwerden

27 / 49

Page 28: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Allokationsketten

Verzeichniseintrag 0016

0015

EOF

0014

0042

...

...

13

14

15

16

17

Abbildung: Beispiel einer Allokationskette mittels FAT

Kontrollfrage: Wie lang ist die FAT bei einem FAT-basiertenDateisystem?

28 / 49

Page 29: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Physisches Layout

Bootsektor

Kopf FAT−Bereich Daten (Cluster)

FAT 1 FAT 2

Abbildung: Grundprinzip des FAT-Dateisystems

I Kopf: Start #0, Größe→ Bootsektor (typisch: FAT12/161 Sektor, FAT32: größer)

I FAT-Bereich: Größe = Anzahl FATs · Größe der FAT (→Bootsektor)

I Daten: Größe = Größe des Filesystems (→ Bootsektor) -Startadresse

I folgen direkt aufeinander

29 / 49

Page 30: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Boot-Sektor

CodeI Boot-Code (oder Boot-Virus)

obligatorische DatenI Anzahl FATs (typisch: 2)I Größe FATsI Anzahl Sektoren/ClusterI Größe des Root-Directory (FAT12/16)I Start-Adresse des Wurzelverzeichnisses (FAT32)

informatorische DatenI OEM-Name: Werkzeug, das zur Formatierung genutzt

wurdeI Volume Serial NumberI Type String (8 Zeichen), z. B. „FAT12“I Volumel Label (11 Zeichen)

30 / 49

Page 31: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Analyse der grundlegenden Struktur von FAT32

Notwendige Informationen:I Größe der Reserved Area (typisch: 1 Sektor Bootsektor, 1

Sektor FSINFO)I Anzahl, Startsektor und Größe der FATI Startsektor der Data AreaI Position des WurzelverzeichnissesI Clustergröße

Wichtiges Werkzeug: fsstat

31 / 49

Page 32: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Analyse der grundlegenden Struktur von FAT32Beispiel der Ausgabe von fsstat

robge@ipo51:~$ fsstat fat32.imgFile System Type: FAT32[...]Next Free Sector (FS Info): 3523094Free Sector Count (FS Info): 3556448Sectors before file system: 2048File System Layout (in sectors)Total Range: 0 - 3946495

* Reserved: 0 - 31

** Boot Sector: 0

** FS Info Sector: 1

** Backup Boot Sector: 6

* FAT 0: 32 - 3878

* FAT 1: 3879 - 7725

* Data Area: 7726 - 3946495

** Cluster Area: 7726 - 3946493

*** Root Directory: 7726 - 7733

** Non-clustered: 3946494 - 3946495[...]CONTENT INFORMATIONSector Size: 512Cluster Size: 4096Total Cluster Range: 2 - 492347[...] 32 / 49

Page 33: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Verzeichnisse

I belegen 1 oder mehrere Cluster (vermerkt in FAT)I jeder Verzeichniseintrag ist 32 Byte großI erste beide Einträge sind „.“ und „..“

33 / 49

Page 34: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Wurzelverzeichnis (Root-Directory)

I normalerweise am Beginn der Data AreaI kann (bei FAT32) aber prinzipiell überall liegenI erster Eintrag: Volume LabelI danach „.“I enthält keinen Eintrag für übergeordnetes Verzeichnis („..“)I danach Dateien und Verzeichnisse in

AllokationsreihenfolgeI unbenutzte Einträge sind ausgenullt

34 / 49

Page 35: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

VerzeichniseintragAllgemeine Struktur

0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30

Dateiname A CreationHi

Cl.#

Lo

Cl.# GrößeWrittenAcc.

3 ZeitstempelEintrag frei oder 1. Zeichen Dateiname

Index Erklärung

0 0xe5 (; leerer Eintrag) oder 1. Zeichen des Datei-namens

1-10 2.-11. Zeichen des Dateinamens (8+3)

11 Attributflag (↑ nächste Folie)

12 reserved

13-19,22-25 3 Zeitstempel (Creation, Accessed, Written)

20-21,26-27 Nummer des ersten Clusters (→ Index in die FAT)

28-31 Größe der Datei (in Byte)

35 / 49

Page 36: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Attributflag

Byte Nr. 11 jedes Verzeichnisses legt die File-Atribute zumzugehörigen Eintrag fest:

binär hex Bedeutung0000.0001 0x01 Read-only0000.0010 0x02 Versteckte Datei0000.0100 0x04 Systemdatei0000.1000 0x08 Volume Label0000.1111 0x0f Langer Dateiname0001.0000 0x10 Verzeichnis0010.0000 0x20 Archivbit

Tabelle: Mögliche Werte des Attributflags in FAT32

36 / 49

Page 37: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Verzeichniseinträge

I maximale Dateigröße: 4 GiB, da entsprechendes Feld 4Byte umfasst

I 1. Zeichen des Dateinamens entscheidet, ob Eintragbenutzt oder nicht

I 0xe5 oder 0x00:→ Eintrag freiI alle anderen→ Eintrag belegt

I keine Trennung Metadaten↔Dateiname (→ keine Links)I „Lange“ Dateinamen im FAT32 extra behandelt

Attribute:I System File, Hidden File, Archive, Read-Only (nicht

bindend; Behandlung abhängig vom Dateisystem)I Langer Dateiname (LFN)→ alternative Interpretation des

EintragsI Verzeichnis (Dateilänge: 0)I Volume Label: genau ein Verzeichniseintrag pro

Dateisystem enthält dieses37 / 49

Page 38: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Lange Dateinamen (Long File Names – LFN)

I Dateinamen dürfen in FAT32 nur 11 (d. h. 8+3) Zeichenlang sein

I Ist der Name länger, dann ist ein extra Verzeichniseintrag„LFN“ mit anderer Bedeutung (↑ nächste Folie) notwendig

I diese extra Verzeichniseinträge können ggf. kaskadiertwerden (bei sehr langem Namen), daher ist eineSequenznummer vorangestellt

I zusätzlich wird ein „regulärer“ Verzeichniseintrag mit einemauf 8.3-Länge gekürzten Dateinamen angelegt

I Beispiel: wuestenplanet.txt→ WUESTE~1.TXT

38 / 49

Page 39: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Lange Dateinamen (Long File Names – LFN)

195

Here the output shows us the cluster chain for RESUME-1.RTF from sectors 1646 to 1663 and the End of File. Each cluster was 2 sectors in size, so we can see in the parentheses that there are 18 sectors in the cluster chain.

The istat tool in TSK shows the details of a directory entry and its output for this entry is given next. Using the metadata-addressing scheme of TSK, the RESUME-1.RTF file is the second entry in the root directory, which means that it has an address of 4. # istat -f fat fat-4.dd 4 Directory Entry: 4 Allocated File Attributes: File, Archive Size: 8689 Name: RESUME-1.RTF Directory Entry Times: Written: Wed Mar 24 06:26:20 2004 Accessed: Thu Apr 8 00:00:00 2004 Created: Tue Feb 10 15:49:40 2004 Sectors: 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663

Long File Name Directory Entries The standard directory entry can support names with only 8 characters in the name and 3 characters in the extension. Longer names or names that use special characters require long file name (LFN) directory entries. A file will have a normal entry in addition to any LFN entries, and the LFN entries will precede the normal entry. The LFN version of the directory entry has the fields shown in Table 10.7.

Table 10.7. Data structure for an LFN FAT directory entry.

Byte Range

Description Essential

0–0 Sequence number (ORed with 0x40) and allocation status (0xe5 if unallocated)

Yes

1–10 File name characters 1–5 (Unicode) Yes

11–11 File attributes (0x0f) Yes

12–12 Reserved No

13–13 Checksum Yes

14–25 File name characters 6–11 (Unicode) Yes

26–27 Reserved No

28–31 File name characters 12–13 (Unicode) Yes

The sequence number field is a counter for each entry needed to store the file name, and the first entry has a value of 1. The sequence number increases for each LFN entry until the final entry, which is a bitwise OR with the value 0x40. When two values are bitwise ORed together, the result has a 1 wherever any of the two inputs had a 1.

The LFN entries for a file are listed before the short name entry and are in reverse order. Therefore, the first entry that you will find in the directory will be the last LFN entry for the file and will have the largest sequence value. Unused characters are padded with 0xff, and the name should be NULL-terminated if there is room.

Abbildung: Bedeutung der Bytes im Verzeichniseintrag eines langenDateinamens6

6Bruce Carrier. File System Forensic Analysis. Addison Wesley, 2005, S. 19539 / 49

Page 40: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Wichtige Werkzeuge

I Diagnose der Platte: smartctl (Packagesmartmontools)

I forensisches Image anlegen: dd;Beispiel: sudo dd if=/dev/sda of=sda.imgbs=512 count=1M skip=4M

I Kryptographische Hashes erzeugen: md5sum, sha1sumI Recovery gelöschter Dateien: photorec, testdiskI Umrechnung Hex→ Dezimal:echo "ibase=16; 3C3800"|bc

I Partitionierungsinformationen über Image erhalten:mmls image.img

I Informationen über FAT-Dateisystem-Image erhalten:fsstat fat-image.img

40 / 49

Page 41: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Motivation: Verstecken von Informationen (DataHiding)

I Schutz sensitiver Daten vor (potentiellem) DiebstahlI Verbergen von Daten vor ErmittlungsbeamtenI Verstecken von Malware (Viren, Würmer, Rootkits)

“Knowing how data can be hidden within the mediaand file system structure means knowing how thatdata can be found. ”

Verwandte Aspekte (hier nicht behandelt):I KryptografieI SteganografieI Digitale Wasserzeichen

41 / 49

Page 42: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Systematik potentieller Verstecke

Versteckmöglichkeiten

Out−of−BandIn−Band

generischdateisystem−

spezifisch

42 / 49

Page 43: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Out-of-Band vs. In-Band

Out-of-BandI Speicherung außerhalb der für die jeweilige

Hierarchieebene gültigen SpezifikationI Daten sind schwer zugänglich (für Nutzer und Ermittler)I bei zielgerichteter Analyse schwer zu versteckenI große KapazitätI Beispiel: verschiedene Formen von Slack, Host Protected

Area (HPA)In-Band

I Speicherung innerhalb der für die jeweiligeHierarchieebene gültigen Spezifikation

I schwer zu entdecken, da keine AuffälligkeitenI Beispiel: nichtalloziierte Blöcke, Alternative Data Streams

(ADS)I Steganografie

43 / 49

Page 44: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Potentielle Verstecke für Daten

1. In-BandI reguläre DateienI Dateien mit irreführendem Namen und Magic Marker

(Bilder in .EXE usw.)I reguläre Dateien in tiefen Verzeichnishierarchien

2. Out-of-Band, innerhalb des DateisystemsI gelöschte Dateien (1. Zeichen des Dateinamens = 0xe5)I gelöschte Dateien in gelöschten VerzeichnissenI ungenutzte Blöcke in der Reserved Area, z.B. Nr. 2-5I wenn Clustergröße > Sektorgröße, Nutzung der

Restsektoren, die keinen ganzen Cluster mehr ergebenI Nutzung unalloziierter Cluster

44 / 49

Page 45: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Potentielle Verstecke für Daten II

3. Out-of-Band, außerhalb des Dateisystems

I ungenutzte Blöcke in der Partition (z.B. zwischen Ende derPartitionstabelle und Beginn der ersten Partition)

I Blöcke außerhalb der Partition (Indiz:∑

Partitionen <Datenträger)

I Host Protected Area (HPA) und Device Configuration Overlay(DCO)

45 / 49

Page 46: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Nutzung einer Host Protected Area (HPA)

I definiert im ATA-Standard (“Advanced TechnologyAttachment”)

I besonders geschützter Bereich einer Festplatte, auf denBetriebssystem (und damit das Dateisystem und dessenWerkzeuge, z. B. dd) sowie das BIOS keinen Zugriff haben

I zur Sicherung von Systemimages für dieWiederherstellung, Konfigurationsinformationen etc.

I Einrichtung: z.B. mit HDAT2 (http://www.hdat2.com/ )I Detektierung (Linux): dmesg, The Sleuth Kit (disk_stat)I Kommandos:

I SET_MAX_ADDRESSI READ_NATIVE_MAX_ADDRESS

46 / 49

Page 47: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Device Configuration Overlay (DCO)

I ab ATA-6I erlaubt gewolltes Reduzieren der Kapazität und

Funktionalität einer FestplatteI PC-Hersteller können damit Festplatten unterschiedlicher

Hersteller und Kapazitäten auf identische Anzahl Sektorentrimmen

I Kommandos:I DEVICE_CONFIGURATION_SETI DEVICE_CONFIGURATION_RESTORE

I Angabe einer maximalen LBA-AdresseI unterstützte DMA-Modi und SMART-Funktionen sind

ebenfalls manipulierbarI Detektierung: TAFT (The ATA Forensics Tool, MS-DOS)

47 / 49

Page 48: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Kombination von HPA und DCO

I DCO muss zuerst eingerichtet werdenI READ_NATIVE_MAX_ADDRESS liefert nicht mehr wahre

Kapazität der Festplatte

DCOHPA

DEVICE_CONFIGURATION_RESTORE

DEVICE_CONFIGURATION_SET

READ_NATIVE_MAX_ADDRESS

SET_MAX_ADDRESS

sichtbarer Teil der Festplatte

48 / 49

Page 49: Spezielle Techniken und Technologien der Informatik ...robge/stti/vl/stti-02... · I Bachelorstudiengang „Allgemeine und Digitale Forensik“, FH Mittweida 4/49. Informationsquellen

Nicht behandelt („Ausblick“)

I Auswertung ZeitstempelI Restauration versehentlich oder absichtlich gelöschter

Partitionen

49 / 49