Spezielle Techniken und Technologien der Informatik - Forensik des Massenspeichers Robert Baumgartl 16. Mai 2019

Die Seite wird erstellt Hortensia-Antonija Janssen
 
WEITER LESEN
Spezielle Techniken und Technologien der Informatik - Forensik des Massenspeichers Robert Baumgartl 16. Mai 2019
Spezielle Techniken und Technologien der
                Informatik
        Forensik des Massenspeichers

             Robert Baumgartl

                16. Mai 2019

                                           1 / 64
Computerforensik?

  Computerforensik ist die Untersuchung und Analyse von
  Rechensystemen zwecks Identifizierung, Gewinnung, Dokumentation
  und Interpretation von Daten, die potentiell als Beweismittel vor
  Gericht dienen sollen.

    I   i. a. zum Nachweis bzw. zur Ermittlung von Straftaten (aber
        auch z. B. in der so genannten Computerarchäologie)
    I   „Wer, Was, Wo, Wann, Womit, Wie und Weshalb“
    I   Querschnittsthema der Informatik mit vielen Teilaspekten

                                                                      2 / 64
Beschränkung

    I      Massenspeicher
    I      komplex, weil groß und vielfältig
    I      NTFS, ext2fs, ext3fs, ext4fs, btrfs, FAT, VFAT, ExFAT, ZFS,
           ...1
  „Neben“lerneffekte:
    I      Management des Massenspeichers (vgl. LV
           Betriebssysteme 2) Aufbau von Dateisystemen
    I      Wiederherstellung versehentlich gelöschter Daten
  Nicht betrachtet: professionelle Datenrettung (nach
  Feuerschaden, Headcrash infolge Sturz usw.)

   1
       vgl. https://en.wikipedia.org/wiki/List_of_file_systems
                                                                         3 / 64
Weitere Aspekte

    I   Untersuchung stets ethisch vertretbar?
    I   “Anti-Forensics”
    I   allgemeiner Workflow
    I   Plattform für Analyse

                                                 4 / 64
Literatur

     I   Alexander Geschonneck. Computer-Forensik. 6. Aufl.
         dpunkt, 2014
     I   Bruce Carrier. File System Forensic Analysis. Addison
         Wesley, 2005
     I   Bruce J. Nikkel. “Forensic analysis of GPT disks and GUID
         partition tables”. In: Digital Investigation 6 (2009), S. 39–47
     I   Linda Volonino und Reynaldo Anzaldua. Computer
         Forensics For Dummies. Wiley, 2008
   Weitere Informationsquellen:
     I   Journal „Digital Investigation“ (Elsevier)
     I   „Journal of Digital Forensics, Security and Law“
         (https://www.jdfsl.org/)
     I   Bachelorstudiengang „Allgemeine und Digitale Forensik“,
         FH Mittweida
                                                                           5 / 64
Informationsquellen für die praktische Arbeit

    I   Partitionstypen für MBR-partitionierte Datenträger
        https://www.win.tue.nl/~aeb/partitions/partition_types-1.html
    I   Forensics Wiki
        https://forensicswiki.org/wiki/Main_Page
    I   Microsoft FAT Specification, 2005

                                                                        6 / 64
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 durchnummeriert, Nummern
        heißen Logische Blockadressen (Logical Block Address – LBA)

                                                                      7 / 64
Kapazitätsangaben: TB vs. TiB
Beispiel

                   I   typische „4-TB-Festplatte“
                   I   Anzahl Blöcke: 7814037168
                   I   Blockgröße: 512 Byte
                   I   Kapazität: 4.000.787.030.016 Bytes
                   = 4, 000787030016 · 1012 Bytes („4 TB“)
                   = 3, 63869460 · 240 Bytes („3,6 TiB“)
                   I   ∆ ca. 400 GB (GiB?)

                                                             8 / 64
Erzeugung forensischer Abbilder
  Prinzipien:
    I bitgetreue Kopie auf niedrigstmöglicher
      Abstraktionsebene (d.h., nicht Dateien kopieren [weil
      man damit z.B. gelöschte Dateien nicht mit erwischt],
      sondern Datenträger)
    I niemals auf Originaldatenträger schreiben! (d.h.,
      Originaldatenträger niemals montieren, physische
      Schreibschutzmechanismen aktivieren, HW-Write-Blocker
      nutzen)
    I alle Datenträger kopieren (Backups! USB-Sticks!)
    I zu jeder Kopie kryptografischen Hash (Integrity Hash)
      anfertigen, um nachträgliche Modifikationen zu
      entdecken/verhindern – und fälschungssicher ablegen
      (nicht am Speicherort des Images!)
    I bei Lesefehlern „0“-Sektoren schreiben, um Verkürzung
      des forensischen Images zu verhindern
                                                              9 / 64
Erzeugung forensischer Abbilder
Live vs. Dead Acquisition

       Live Acquisition
           I   zu untersuchendes System zur Erstellung der Abbilder
               genutzt
           I   Gefahr kompromittierter Werkzeuge
           I   notwendig, wenn
                   I   Datenträger/System immobil
                   I   verdeckte Operation (z.B. bei „Online-Durchsuchung“)
                   I   Datenträger kryptografisch verschlüsselt
       Dead Acquisition („Post-Mortem-Sicherung“)
           I   Datenträger separiert und auf extra Analysesystem kopiert
           I   Verschlüsselung des Datenträgers könnte nachträgliche
               Analyse unmöglich machen bzw. erschweren

                                                                              10 / 64
Erzeugung forensischer Abbilder

    I   proprietäre Werkzeuge verwenden häufig proprietäres
        Format für Image
    I   Metainformationen entweder im Image oder separat
        speicherbar
    I   Image kann ggf. komprimiert abgelegt werden
        (-Speicherplatz, +Rechenzeit)
    I   klassisches Linux-Werkzeug:
        dd conv=sync,noerror if=/dev/
        of= bs=4096
    I   ddrescue

                                                              11 / 64
Strukturierung von Massenspeichern

  Massenspeicher sind i. a. in eine Menge hierarchischer
  Abstraktionen strukturiert:
   1. Medium: Festplatte, SSD, DVD, USB-Stick, Diskette
   2. Partition: logisch zusammengehöriger Teil einer Festplatte
      (zusammenhängend)
   3. Dateisystem
   4. Datei und Verzeichnis
   5. (Satz, Record, Feld)
  Auf jeder dieser Ebenen ist ein Verstecken von Daten möglich.

                                                                   12 / 64
Teil 1: Partitionen

                      13 / 64
• IA32-based systems that have multiple operating systems, such as Microsoft
                            Windows and Linux, may require separate partitions for each operating system.

Partitionen         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.
   Zweck: Aufteilung und logische Separation eines großen
   Datenträgers für unterschiedliche Aufgaben, z. B. :
    I   Partition für unterschiedliche BS
    I   Trennung System- von Nutzerdaten
    I   Swapspace
                    Each operating system and hardware platform typically uses a different partitioning method.
    I   Wiederherstellungspartition
             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
    I   Hibernation         Partition
             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.

                          Abbildung: Prinzip einer Partitionstabelle
                    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

                                                                                                                    58

                                                                                                                         14 / 64
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 ab
        ca. 2010
    I   keine Partitionstabelle bei geringer Kapazität (Disketten)
  Weitere Schemata existieren, sind aber so gut wie nur noch
  von historischem Interesse (Apple Partition Map, Volume Table
  of Contents, . . . )
  Keines der Partitionierungsprinzipien ist standardisiert (→
  „Industriestandard“)
  Literatur:
  http://www.win.tue.nl/~aeb/partitions/partition_tables.html

                                                                     15 / 64
Master Boot Record (MBR)

  1. logischer Block der Partition:

           Start       Länge                Inhalt
            0           446         Bootcode (Programm)
       446 (1BE16 )      16     Eintrag 1 der Partitionstabelle
       462 (1CE16 )      16     Eintrag 2 der Partitionstabelle
       478 (1DE16 )      16     Eintrag 3 der Partitionstabelle
       494 (1EE16 )      16     Eintrag 4 der Partitionstabelle
           510           2            Signatur (0xAA55)
                Tabelle: Aufbau des Master Boot Record

                                                                  16 / 64
DOS-Partition: Partitionstabelleneintrag

     Start   Länge   Inhalt
       0      1      Bootflag
       1      3      Partitionsbeginn (CHS-Adresse 8/6/10 Bit)
       4      1      Typ der Partition
       5      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 Windows
   NTFS, 82 Linux Swap, 83 Native Linux u. v. a. m.

                                                                    17 / 64
DOS-Partition: Beispiel

   Partitionstabelle:

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

     1. bootbar, Native Linux (8316 ), Startsektor 80016 = 204810 , Länge
        7980016 = 49766410 Sektoren á 512 Byte (=243 MiB)
     2. nicht bootfähig, „DOS 3.3+ Extended Partition“, Startsektor
        7a7fe16 = 50175810 , Länge 3a30b00216 = 976.269.31410
        Sektoren (ca. 465.5 GiB)
  3.+4. nicht verwendet

   (vgl. fdisk -lu als root)

                                                                                   18 / 64
DOS-Partition: Extended Partitions
Prinzip

          Problem: feste Anzahl (4) Partitionen ggf. nicht ausreichend (z. B. für
          größ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 Extended
                Partition, die den ganzen Rest umfasst (und in sich wieder
                mehrere Partitionen haben kann)
            I   Primary Extended Partition besitzt vorangestellt eigene
                Partitionstabelle (mit maximal 4 Einträgen), diese verweisen auf
                  I   Secondary File System Partition („logisches Laufwerk“), die
                      ein Dateisystem enthält und/oder
                  I   Secondary Extended Partition, die rekursiv die gleiche
                      Struktur besitzt, wie die Primary Extended Partition
          Literatur: Bruce Carrier. File System Forensic Analysis. Addison
          Wesley, 2005, S.67ff

                                                                                    19 / 64
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
DOS-Partition:          Extended
        another secondary   extended partition thatPartition
                                                    spans from 10GB to 12GB. A partition table is
Beispiel                   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.

       Abbildung:
                As INutzung
                     have described von
                                    it and asPrimary
                                              most documentsund     Secondary
                                                               claim,                    Extended
                                                                      an extended partition                 Partitions2
                                                                                            table should have,
                at most, one entry for a secondary file system partition and one entry for a secondary
       zur Realisierung       vonIn 6
                extended partition.      Partitionen
                                      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
           2              (http://groups.yahoo.com/group/cftt/
               Bruce Carrier. File System Forensic Analysis. Addison  ). The  image2005,
                                                                          Wesley,    had aS.primary
                                                                                             69     extended partition
                                                                                                                          20 / 64
DOS-Partitionierungsschema
Fazit

         I   basiert auf technischem Stand der 80er Jahre
             (PC-Architektur)
         I   nicht standardisiert; keine technische Referenz
         I   aufwandsarm nur 4 Partitionen
         I   komplex, wenn mehr als 4 Partitionen notwendig
         I   Limit: 4 Byte für Länge der Partition in Sektoren
             (; max. 232 − 1 Sektoren á 512 Bytes
             = 241 Bytes = 2 TiB)
        → GUID-Partitionierungsschema (2010)

                                                                 21 / 64
GPT Partitions
GUID Systems
      Partition
             with 64-bit Table
                         Intel Itanium(GPT)
                                       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
         I important
             Teil der data structures are maintained in case of failure. At the time of this writing, GPT
                          UEFI3 -Spezifikation
           disks are found in high-end servers and not in typical desktop systems.
            LBA-Angaben
         I General Overview           nun 64bittig
           A GPT disk has five major areas to it, as shown in Figure 6.7. The first area is the Protective
             bisand
         I MBR,    zuit 128
                         starts inPartitionen
                                   the first sector ofmöglich
                                                      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
             verbesserte
         I partition exists so that Fehlertoleranz
                                    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.

                                                                                               4
     Abbildung:
        The secondGrundsätzlicher           Aufbau
                    part of the GPT disk starts in sectoreines   Datenträgers
                                                          1 and contains            mitThe
                                                                         the GPT header. GPT
                                                                                           header
        defines the size and location of the partition table, which are fixed when the GPT disk is
     (unmaßstäblich)
           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-
        3 bit GUID is supposed to be unique for that system and is set when the partition table is
         Unified Extensible Firmware Interface
        4 created.
         Bruce Carrier. File System Forensic Analysis. Addison Wesley, 2005, S. 106
           The fourth section of the disk is the partition area. The partition area is the largest area and   22 / 64
GUID Partition Table (GPT)
Struktur des Datenträgers

       LBA 0
          I    enthält (wie bisher) MBR
          I    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 manipulieren
          I    ; “Protective MBR”
       LBA 1
          I    GPT Header
          I    1 Sektor (d. h. , gewöhnlich 512 Byte)

                                                                           23 / 64
GUID Partition Table (GPT)
Aufbau des GPT-Headers

             Start       Länge   Inhalt
         0     0x00        8     Signatur „EFI PART“
         8     0x08        4     Revision (0x00 0x00 0x01 0x00)
        12     0x0c        4     Größe des Headers in Bytes
        16     0x10        4     CRC32 des Headers
        20     0x14        4     reserviert (0x00 0x00 0x00 0x00)
        24     0x18        8     aktuelle LBA
        32     0x20        8     LBA des Backups (des GPT-Headers)
        40     0x28        8     LBA des Starts der Partition Area
        48     0x30        8     LBA des Endes der Partition Area
        56     0x38       16     GUID des Datenträgers (UUID)
        72     0x48        8     LBA des Starts der Partitionstabelle
        80     0x50        4     Anzahl Einträge in Partition Table
        84     0x54        4     Größe eines Eintrags in PT (0x80 = 128 Bytes)
        88     0x58        4     CRC32 der Partitionstabelle

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

           I    konstant 128 Byte pro Eintrag

                Start              Länge         Inhalt
            0        0x00             16         GUID des Partitionstyps
           16        0x10             16         Unique GUID der Partition
           32        0x20              8         LBA des 1. Blockes der Partition
           40        0x28              8         LBA des letzten Blockes der Partition
           48        0x30              8         Attribute der Partition
           56        0x38             72         Name der Partition in Unicode

           I    Attribute aus forensischer Sicht uninteressant

                                                                                         25 / 64
DOS-Partitionen vs. GUID Partition Table (GPT)

   Erzielte Verbesserungen:
     I Fehlertoleranz
           I   CRCs für Partitionstabelle und Header
           I   Redundanz: 2 Partitionstabellen, 2 Header
           I   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

                                                                         26 / 64
Teil 2: Dateisysteme

                       27 / 64
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
Dateisysteme
     information. Note that this category does not contain the content of the file, and it may not
             contain the
Kategorien forensischer   name
                        Daten     of the file. Examples
                              in Dateisystemen        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.

                                                                                                          5
             Abbildung:
           The                  Kategorien
                 file name category,              forensischer
                                      or human interface              Datenthe
                                                            category, contains    indata
                                                                                     Dateisystemen
                                                                                         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
         5 to a host name in a network. Network devices communicate with each other using IP
          Bruce Carrier. File System Forensic Analysis. Addison Wesley, 2005, S. 130
           addresses, which are difficult for people to remember. When a user enters the host name of a          28 / 64
Warum FAT?
   I       alte Rechner (bis Windows ME)
   I       wichtigstes Austauschformat zwischen unterschiedlichen
           Betriebssystemen (gemeinsame Partitionen,
           USB-Memory-Sticks)
   I       Consumerelektronik: Flashspeichermedien in Smartphone,
           Tablet, Digitalkamera, MP3-Player, PDAs
   I       „Design Rule for Camera file System“ (DCF) – de-facto-Standard
           für Digitalkameras6 – schreibt FAT12/16/32 bzw. ExFAT als
           Dateisystem vor
                            “FAT is supported by all Windows and most Unix
                            Operating Systems, and will be encountered by
                            investigators for years to come, even if it is not the
                            default file system of desktop Windows systems.” 7

   I       Flashmedien > 32 GiB nutzen das so genannte
           ExFAT-Dateisystem, eine proprietäre Erweiterung
   6
       https://www.jeita.or.jp/english/standard/html/1_4.html
   7
       Bruce Carrier. File System Forensic Analysis. Addison Wesley, 2005, S. 156.   29 / 64
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
Grundlegender Aufbau eines FAT-Dateisystems
     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 Abbildung:
          System Category
                     Layout eines FAT-basierten Dateisystems
     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
                                                                                                         30 / 64
Cluster

      I   Data Area ist in Logische Blöcke8 (Cluster) strukturiert:
              I   2n faches der Sektorgröße; Maximum 32768 Bytes
              I   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 C
             2. mit der Sektornummer S (gebräuchlicher)
      I   Umrechnung C → S:

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

      I   Umrechnung S → C:

                                  S − Sektornummer von Cluster 2
                         C=                                      +2
                                         Sektoren/Cluster
     8
       Achtung! Nicht mit den Logical Blocks des Datenträgers (Sektoren) verwechseln; die Logischen Blöcke des
   Dateisystems sind gerade ein Vielfaches von denen!
                                                                                                                 31 / 64
Grundlegende Prinzipien
    I   jede Datei und jedes Verzeichnis besitzen genau einen
        Verzeichniseintrag (Name, Größe, Metadaten,
        Anfangscluster)
    I   welche Cluster zu einer Datei gehören, steht in Form einer
        Allokationskette in der File Allocation Table (FAT)
                 Verzeichniseintrag                  Cluster (Blöcke)        FAT

                                                           #42

                                                                              ...
            datei1.txt   6845 Bytes         #42
                                                                        41
                                                                        42   43
                                                                        43   EOF
                                                                        44
                                      Startcluster
                                                                        45
                                                                        46
                                                           #43

                                                                                ...
              Abbildung: Grundprinzip des FAT-Dateisystems

                                                                                      32 / 64
Allokationsketten

                                                            ...
     Verzeichniseintrag                            13    0016
                                                   14    0015
                                                   15    EOF
                                                   16    0014
                                                   17    0042

                                                                  ...
         Abbildung: Beispiel für eine Allokationskette mittels FAT

   Die abgebildete Datei besteht aus den Clustern 13, 16, 14, 15.

                                                                        33 / 64
Varianten des FAT-Dateisystems

    I   3 Varianten: FAT12, FAT16, FAT32 → bezieht sich auf
        maximale Größe der Clusternummer in Bit (aber: FAT32
        nutzt nur die niederwertigsten 28 Bit)
    I   Varianten sind abwärtskompatibel
    I   Ermittlung der Version implizit über Clusteranzahl des
        Dateisystems (CountofClusters):
            CoC < 4085     4086 ≤ CoC < 65525    CoC ≥ 65526
               FAT12              FAT16               FAT32

    I   zusätzlich: ExFAT für Flash-Medien > 32 GiB
        (inkompatibel, aber ähnlich strukturiert)

                                                                 34 / 64
Bestimmung der Clusteranzahl (CountofClusters)

  vgl. Microsoft, 2004, S. 14/15

                                             35 / 64
File Allocation Table (FAT)

    I   FAT besteht aus Einträgen, die Clusternummern enthalten
    I   FAT hat für jeden Cluster einen Eintrag (; Länge der FAT hängt
        von Größe der Data Area und der Clustergröße ab)
    I   Größe eines FAT-Eintrages hängt von Variante ab (FAT12 → 12
        Bit, FAT16 → 16 Bit, FAT32 → 32 Bit-Einträge)
        Beispiel: Die Data Area eines FAT32-Dateisystems umfasst die logischen Blöcke
        von 7726 bis 3946495; jeder Cluster ist 4 KiB groß (enthält also 8 Blöcke). Dann
        gibt es insgesamt d(3946495 − 7726 + 1)/8e = 492347 Cluster, wofür 492347*4
        Byte = 1969388 Byte ≈ 1.8 MiB für die FAT benötigt werden.

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

                                                                                           36 / 64
Gültige Werte für FAT-Einträge

    I   MAX = größtmögliche Clusternummer (=CountofClusters+1,
        da bei 2 angefangen wird zu zählen)

        FAT12       FAT16     FAT32          Bedeutung
        0x000       0x0000    0x0000.0000    unbenutzter Cluster
        0x002-MAX   0x0002-   0x0000.0002-   Cluster ist belegt (näch-
                    MAX       MAX            ste Clusternr.)
        0xFF7       0xFFF7    0xFFFF.FFF7    defekter Cluster
        0xFFF       0xFFFF    0xFFFF.FFFF    EOF (letzter Cluster der
                                             Datei)

                                                                         37 / 64
Physisches Layout

                  Kopf      FAT−Bereich           Daten (Cluster)
  Bootsektor
                           FAT 1     FAT 2

               Abbildung: Grundprinzip des FAT-Dateisystems

    I   Kopf: Start #0, Größe → Bootsektor (typisch: FAT12/16
        1 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

                                                                    38 / 64
Boot-Sektor (Reserved Area)
  Code
    I   Boot-Code (oder Boot-Virus)
  obligatorische Daten
    I   Anzahl FATs (typisch: 2)
    I   Größe FATs
    I   Anzahl Sektoren/Cluster
    I   Größe des Wurzelverzeichnisses (FAT12/16)
    I   Start-Adresse des Wurzelverzeichnisses (FAT32)
  informatorische Daten
    I   OEM-Name: Werkzeug, das zur Formatierung genutzt
        wurde
    I   Volume Serial Number
    I   Type String (8 Zeichen), z. B. „FAT12“
    I   Volumel Label (11 Zeichen)
                                                           39 / 64
Start und Größe der FAT

  FAT12/FAT16:

                 Name    Byte-Offset   Bytes   Bedeutung
        BPB_RsvdSecCnt       14         2      Anzahl Sektoren vor der FAT
          BPB_FATSz16        22         2      Anzahl Sektoren der FAT

  FAT32:

                 Name    Byte-Offset   Bytes   Bedeutung
        BPB_RsvdSecCnt       14         2      Anzahl Sektoren vor der FAT
          BPB_FATSz32        36         4      Anzahl Sektoren der FAT

    I   Die jeweils nicht verwendeten Einträge enthalten den Wert
        0!

                                                                             40 / 64
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 FAT
    I   Startsektor der Data Area
    I   Position des Wurzelverzeichnisses
    I   Clustergröße
  Wichtiges Werkzeug: fsstat

                                                                   41 / 64
Analyse der grundlegenden Struktur von FAT32
Beispiel der Ausgabe von fsstat

      robge@ipo51:~$ fsstat fat32.img
      File System Type: FAT32
      [...]
      Next Free Sector (FS Info): 3523094
      Free Sector Count (FS Info): 3556448
      Sectors before file system: 2048
      File 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 INFORMATION
      Sector Size: 512
      Cluster Size: 4096
      Total Cluster Range: 2 - 492347
      [...]                                    42 / 64
Verzeichnisse

    I   belegen 1 oder mehrere Cluster (vermerkt in FAT wie
        „normale“ Datei)
    I   jeder Verzeichniseintrag umfasst 32 Byte
    I   erste beide Einträge sind „.“ und „..“
    I   unbenutzte Einträge sind ausgenullt
    I   gelöschte Einträge haben an der ersten Stelle des
        Namens das Byte 0xE5 (alles andere verbleibt)

                                                              43 / 64
Wurzelverzeichnis (Root Directory)

    I   am Beginn der Data Area abgelegt (bei FAT32 prinzipiell
        überall möglich)
    I   erster Eintrag: Volume Label
    I   weder Eintrag für „.“ (aktuelles Vz.), noch „..“
        (übergeordnetes Vz.)
    I   danach Einträge für Dateien und Verzeichnisse in
        Allokationsreihenfolge

                                                                  44 / 64
Positionsermittlung Wurzelverzeichnis FAT12/16

    1. Start (ab Partitionstart, in Sektoren):
       FirstRootDirSecNum = BPB_ResvdSecCnt +
                           (BPB_NumFATs · BPB_FATSz16)
    2. Größe (in Bytes):
       FirstRootDirSize = BPB_RootEntCnt · 32

                       Feldname     Offset   Länge (Bytes)
              BPB_ResvdSecCnt         14           2
                  BPB_NumFATs         16           1
                BPB_RootEntCnt        17           2
                  BPB_FATSz16         22           2

     Tabelle: Positionen der beteiligten Felder in der Reserved Area

                                                                       45 / 64
Verzeichniseintrag
Allgemeine Struktur

                                                               3 Zeitstempel
            Eintrag frei oder 1. Zeichen Dateiname

                                                                           Hi               Lo
                      Dateiname            A        Creation      Acc.           Written    Cl.#        Größe
                                                                          Cl.#
        0       2      4    6     8   10       12    14   16     18      20    22    24    26      28     30

                      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)

                                                                                                                46 / 64
Attributflag

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

                  binär      hex     Bedeutung
               0000.0001     0x01    Read-only
               0000.0010     0x02    Versteckte Datei
               0000.0100     0x04    Systemdatei
               0000.1000     0x08    Volume Label
               0000.1111     0x0f    Langer Dateiname
               0001.0000     0x10    Verzeichnis
               0010.0000     0x20    Archivbit
           Tabelle: Mögliche Werte des Attributflags in FAT32

                                                                 47 / 64
Verzeichniseinträge
     I   maximale Dateigröße: 4 GiB, da entsprechendes Feld 4
         Byte umfasst
     I   1. Zeichen des Dateinamens entscheidet, ob Eintrag
         benutzt oder nicht
           I   0xe5 oder 0x00: → Eintrag frei
           I   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
        Eintrags
     I Verzeichnis (Dateilänge: 0)
     I Volume Label: genau ein Verzeichniseintrag pro
        Dateisystem enthält dieses
                                                                 48 / 64
Lange Dateinamen (Long File Names – LFN)

    I   Dateinamen dürfen in FAT32 nur 11 (d. h. 8+3) Zeichen
        lang 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. kaskadiert
        werden (bei sehr langem Namen), daher ist eine
        Sequenznummer vorangestellt
    I   zusätzlich wird ein „regulärer“ Verzeichniseintrag mit einem
        auf 8.3-Länge gekürzten Dateinamen angelegt
    I   Beispiel: wuestenplanet.txt → WUESTE~1.TXT

                                                                       49 / 64
characters in the extension. Longer names or names that use special characters require lon
   file name
Lange        (LFN) directory entries.
          Dateinamen          (Long   A file
                                         Filewill Names
                                                  have a normal
                                                             – entry
                                                                LFN) in addition to any LF
     entries, and the LFN entries will precede the normal entry. The LFN version of the directo
     entry has the fields shown in Table 10.7.
                         Table 10.7. Data structure for an LFN FAT directory entry.
     Byte         Description                                                                   Essenti
     Range
     0–0          Sequence number (ORed with 0x40) and allocation status (0xe5 if Yes
                  unallocated)
     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 sequenceBedeutung
     Abbildung:      number fieldderis a Bytes
                                         counterim
                                                 forVerzeichniseintrag
                                                     each entry needed to store
                                                                          einesthelangen
                                                                                    file name, and th
     first entry has a 9value of 1. The sequence number increases for each LFN entry until the fin
     Dateinamens
     entry, which is a bitwise OR with the value 0x40. When two values are bitwise ORe
     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 orde
     Therefore,
       9            the first entry that you will find in the directory will be the last LFN entry for th
         Bruce Carrier. File System Forensic Analysis. Addison Wesley, 2005, S. 195
     file and will have the largest sequence value. Unused characters are padded with 0xff,50and   / 64 th
Quiz (ohne zurückzublättern!)

    1. Was steht in der FAT?
    2. Wovon hängt die Größe der FAT ab?

                                           51 / 64
Antworten zum Quiz

   1. Clusternummern bzw. spezielle Marker („Cluster frei“,
      „EOF“, „Cluster defekt“)
   2. Größe des Mediums (genauer: der Data Area), Größe
      eines Clusters, Größe der FAT-Einträge aka
      Clusternummern (12, 16 bzw. 32 Bit)

                                                              52 / 64
Anlegen/Löschen von Dateien

  Anlegen:
   1. (Aufsuchen der Cluster, die das aktuelle Verzeichnis
      enthalten)
   2. Suchen eines freien Verzeichniseintrags (komplett mit 0x00
      gefüllt oder 0xe5 als erstes Byte im aktuellen Verzeichnis
   3. Eintragen des Dateinamens, Zeitstempel und Attribute in
      Verzeichniseintrag
   4. Suchen eines freien Clusters für Nutzdaten (0x00-Eintrag
      in der FAT); überschreiben mit EOF-Kennzeichen
   5. Eintragen der entsprechenden Clusternummer im
      Verzeichniseintrag
  Löschen?
   1.

                                                                   53 / 64
Wichtige Werkzeuge

    I   technische Informationen zum Datenträger: hdparm -I
    I   Diagnose der Platte: smartctl (Package smartmontools)
    I   forensisches Image anlegen: dd;
        Beispiel: sudo dd if=/dev/sda of=sda.img bs=512
        count=1M skip=4M
    I   Kryptographische Hashes erzeugen: md5sum, sha1sum
    I   Recovery gelöschter Dateien: photorec, testdisk
    I   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

                                                                54 / 64
Motivation: Verstecken von Informationen (Data
Hiding)

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

         “Knowing how data can be hidden within the media
         and file system structure means knowing how that
         data can be found. ”
   Verwandte Aspekte (hier nicht behandelt):
     I   Kryptografie
     I   Steganografie
     I   Digitale Wasserzeichen

                                                                55 / 64
Systematik potentieller Verstecke

                   Versteckmöglichkeiten

             In−Band                 Out−of−Band

                   dateisystem−
     generisch      spezifisch

                                                   56 / 64
Out-of-Band vs. In-Band
  Out-of-Band
    I Speicherung außerhalb der für die jeweilige
      Hierarchieebene gültigen Spezifikation
    I Daten sind schwer zugänglich (für Nutzer und Ermittler)

    I bei zielgerichteter Analyse schwer zu verstecken

    I große Kapazität

    I Beispiel: verschiedene Formen von Slack, Host Protected
      Area (HPA)
  In-Band
    I Speicherung innerhalb der für die jeweilige
      Hierarchieebene gültigen Spezifikation
    I schwer zu entdecken, da keine Auffälligkeiten

    I Beispiel: nichtalloziierte Blöcke, Alternative Data Streams
      (ADS)
    I Steganografie
                                                                    57 / 64
Konkrete potentielle Verstecke für Daten

   1. In-Band
    I   reguläre Dateien
    I   Dateien mit irreführendem Namen und Magic Marker
        (Bilder in .EXE usw.)
    I   reguläre Dateien in tiefen Verzeichnishierarchien
    I   Alternative Data Streams (ADS); nicht in VFAT32
   2. Out-of-Band, innerhalb des Dateisystems
    I   gelöschte Dateien (1. Zeichen des Dateinamens = 0xe5)
    I   gelöschte Dateien in gelöschten Verzeichnissen
    I   ungenutzte Blöcke in der Reserved Area, z.B. Nr. 2-5
    I   wenn Clustergröße > Sektorgröße, Nutzung der
        Restsektoren, die keinen ganzen Cluster mehr ergeben
    I   Nutzung unalloziierter Cluster

                                                                58 / 64
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 der
       Partitionstabelle und Beginn der ersten Partition)
                                              P
     I Blöcke außerhalb der Partition (Indiz:    Partitionen <
       Datenträger)
     I   Host Protected Area (HPA) und Device Configuration Overlay
         (DCO)

                                                                      59 / 64
Nutzung einer Host Protected Area (HPA)

    I   definiert im ATA-Standard (“Advanced Technology
        Attachment”)
    I   besonders geschützter Bereich einer Festplatte, auf den
        Betriebssystem (und damit das Dateisystem und dessen
        Werkzeuge, z. B. dd) sowie das BIOS keinen Zugriff haben
    I   zur Sicherung von Systemimages für die
        Wiederherstellung, 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_ADDRESS
          I   READ_NATIVE_MAX_ADDRESS

                                                                   60 / 64
Device Configuration Overlay (DCO)

    I   ab ATA-6
    I   erlaubt gewolltes Reduzieren der Kapazität und
        Funktionalität einer Festplatte
    I   PC-Hersteller können damit Festplatten unterschiedlicher
        Hersteller und Kapazitäten auf identische Anzahl Sektoren
        trimmen
    I   Kommandos:
          I   DEVICE_CONFIGURATION_SET
          I   DEVICE_CONFIGURATION_RESTORE
    I   Angabe einer maximalen LBA-Adresse
    I   unterstützte DMA-Modi und SMART-Funktionen sind
        ebenfalls manipulierbar
    I   Detektierung: TAFT (The ATA Forensics Tool, MS-DOS)

                                                                    61 / 64
Kombination von HPA und DCO

    I   DCO muss zuerst eingerichtet werden
    I   READ_NATIVE_MAX_ADDRESS liefert nicht mehr wahre
        Kapazität der Festplatte

    sichtbarer Teil der Festplatte            HPA   DCO

              DEVICE_CONFIGURATION_RESTORE

             DEVICE_CONFIGURATION_SET
              READ_NATIVE_MAX_ADDRESS

              SET_MAX_ADDRESS

                                                           62 / 64
Zusammenfassung

                  63 / 64
Nicht behandelt („Ausblick“)

    I   Auswertung Zeitstempel
    I   Restauration versehentlich oder absichtlich gelöschter
        („formatierter“) Partitionen
    I   ExFAT
    I   File Carving: Restauration von Dateien, insbesondere
        Bildern nur aus den Nutzdatenblöcken (Clustern)
    I   Restauration großer Mengen an Dateien, Werkzeuge zur
        Arbeitserleichterung

                                                                 64 / 64
Sie können auch lesen