@port139 Blog

基本的にはデジタル・フォレンジックの技術について取り扱っていますが、記載内容には高確率で誤りが含まれる可能性があります。

Consider the procedure for learning about $i30 using ChatGPT.

I tried a prompt to learn about $i30, but I couldn't construct it using the procedure I had initially planned.

Everything went smoothly until the visualization of the Index Root, where challenges arose.

Personally, I feel that approaching it by teaching ChatGPT the visualization method, rather than asking, yields better results. Of course, incorrect answers do come up, so it helps me learn to verify things on my own.

Q.
I will learn about $i30 in NTFS. Please explain the procedure for creating a folder on NTFS and how $i30 is generated.

Sure! Here are the steps to create a folder on an NTFS (New Technology File System) volume and observe the creation of the $i30 attribute:

### Steps to Create a Folder on NTFS and Observe the $i30 Attribute

1. **Prepare the Environment:**
   - Ensure you have an NTFS-formatted drive or partition.
   - Use a tool that can inspect NTFS attributes (e.g., FTK Imager, X-Ways Forensics, or a hex editor).

2. **Create a Folder:**
   - Open File Explorer and navigate to the NTFS drive.
   - Right-click in the drive's root directory or any folder where you have permission to create new items.
   - Select `New` -> `Folder` and give the folder a name, such as `TestFolder`.

3. **Understand the $i30 Attribute:**
   - The $i30 attribute (also known as the index attribute) is used by NTFS to store directory index entries. It contains metadata about files and subdirectories within a directory.

4. **Inspect the $i30 Attribute:**
   - Open the forensic tool (e.g., FTK Imager).
   - Navigate to the location where `TestFolder` was created.
   - Locate the `TestFolder` entry and examine its attributes. You should see the $i30 attribute associated with it.

5. **Create and Delete Files to Observe $i30 Changes:**
   - Create a few files inside `TestFolder`. This can be done by right-clicking inside the folder, selecting `New`, and choosing a file type (e.g., `Text Document`).
   - Observe the changes in the $i30 attribute by refreshing the forensic tool. Each file creation will update the $i30 attribute.
   - Delete one or more files and observe the changes again. The $i30 attribute will reflect these deletions.

6. **Analyze the $i30 Attribute:**
   - Use the forensic tool to dive deeper into the $i30 attribute. It will contain entries for each file and folder within `TestFolder`.
   - Each entry will have metadata such as the file name, size, and timestamps.

By following these steps, you can create a folder on an NTFS volume and observe the creation and changes in the $i30 attribute, which is crucial for understanding how NTFS handles directory indexing and file metadata.

Q.
I created a file under testfolder and checked it with FTK Imager, but there was no $i30. How many files need to be created for $i30 to be generated in the folder?

The $i30 attribute is typically generated when a directory contains more entries than can be stored directly in the MFT record for that directory. This threshold is usually around a few dozen entries, but the exact number can vary based on the length of the file names and other factors.

To ensure the $i30 attribute is created, you can follow these steps:

### Steps to Generate the $i30 Attribute

1. **Create Multiple Files:**
   - Create a significant number of files in the `TestFolder`. The exact number can vary, but starting with around 30-40 files should typically exceed the capacity of the MFT record.

2. **Verify in FTK Imager:**
   - After creating the files, open FTK Imager.
   - Navigate to the `TestFolder` and inspect the folder's attributes.

### Example Script to Create Multiple Files (PowerShell)

You can use a PowerShell script to quickly create multiple files in the folder:

```powershell
$folderPath = "C:\path\to\TestFolder"
for ($i = 1; $i -le 50; $i++) {
    New-Item -Path $folderPath -Name "TestFile_$i.txt" -ItemType "File"
}
```

### Using FTK Imager

1. Open FTK Imager and load the NTFS volume or image.
2. Navigate to the `TestFolder`.
3. Look at the folder's MFT entry.
4. If the $i30 attribute is not directly visible, check under the attributes or data runs for any indication of index attributes.

### Using Alternative Tools

If FTK Imager does not display the $i30 attribute clearly:

1. **X-Ways Forensics:**
   - Load the NTFS volume.
   - Navigate to `TestFolder`.
   - Inspect the directory entries and look for $i30.

2. **Hex Editor:**
   - Open the MFT entry for `TestFolder` in a hex editor.
   - Look for the $i30 attribute at the relevant offsets.

### Summary

By creating a larger number of files in the folder, you should be able to trigger the generation of the $i30 attribute. The exact number may vary, but aiming for around 30-40 files should help in observing the $i30 attribute.


I created 50 files and confirmed that $i30 was generated.

Q.
This is the HEX data of the folder's FILE record. Please list the attributes. Visualize it in a format that humans can understand.


46494C4530000300C3DB2A5927000000F701020038000300C003000000040000000000000000000007000000DF01000004000000000000001000000060000000000000000000000048000000180000009358A0DC46BEDA016E381DB748BEDA016E381DB748BEDA016E381DB748BEDA010000000000000000000000000000000000000000F90B0000000000000000000080E6886904000000300000007000000000000000000003005200000018000100586B0200000022009358A0DC46BEDA019358A0DC46BEDA019358A0DC46BEDA019358A0DC46BEDA010000000000000000000000000000000000000010000000000802540045005300540046004F007E003100000000000000300000007000000000000000000002005600000018000100586B0200000022009358A0DC46BEDA019358A0DC46BEDA019358A0DC46BEDA019358A0DC46BEDA010000000000000000000000000000000000000010000000000A01740065007300740066006F006C00640065007200000090000000C00100000004180000000600A001000020000000240049003300300030000000010000000010000001000000100000009001000090010000010000004E3606000000260078005A0001000000DF0100000000F70123A21AB748BEDA0123A21AB748BEDA0123A21AB748BEDA0123A21AB748BEDA010000000000000000000000000000040020000000000000000C025400450041003400320031007E0031002E00540058005400020000004C000000000000000000CC350600000020007800600001000000DF0100000000F701D80B18B748BEDA01D80B18B748BEDA01D80B18B748BEDA01D80B18B748BEDA010000000000000000000000000000000020000000000000000F015400650073007400460069006C0065005F00310032002E00740078007400030000000000000043360600000018007800600001000000DF0100000000F70138541AB748BEDA0138541AB748BEDA0138541AB748BEDA0138541AB748BEDA010000000000000000000000000000000020000000000000000F015400650073007400460069006C0065005F00320039002E007400780074000100000000000000000000000000000018000000030000000200000000000000A0000000580000000104400000000400000000000000000003000000000000004800000000000000004000000000000000400000000000000040000000000000240049003300300041019845E4064103F76BD00600000000B0000000280000000004180000000500080000002000000024004900330030000F00000000000000FFFFFFFF827947110C025400450053005400460049007E0032002E0054005800540000000000000000000000000000001000000002000000FFFFFFFF82794711000000000000040046494C4530000300DD966F5827000000E900020038000100E801000000040000000000000000000005000000E0010000C801000000000000100000006000000000000000000000004800000018000000B7A24FA4C18FDA018477E1B3B1A4DA01648AE8EAD8BDDA01AF1BCF3543BEDA012020000000000000000000000000000000000000E20300000000000000000000C0714E6804000000300000007000000000000000000003005800000018000100FD18010000000200B7A24FA4C18FDA01B7A24FA4C18FDA01B7A24FA4C18FDA01B7A24FA4C18FDA010000000000000000000000000000000020200000000000000B025300450038003300410031007E0031002E0050004600300000009000000000000000000002007400000018000100FD18010000000200B7A24FA4C18FDA01B7A24FA4C18FDA01B7A24FA4C18FDA01B7A24FA4C18FDA0100000000000000000000000000000000202000000000000019015300450041005200430048004100500050002E004500580045002D00370044004100440034003400410039002E0070006600000000008000000048000000010000000000040000000000000000000C00000000000000400000000000000000D0000000000000D5C0000000000000D5C0000000000000310D52E501000000FFFFFFFF8279471100000000000000000000000000000000000000000000C801

 

Here are the parsed details from the MFT entry in a human-readable format:

### MFT Entry Details
| Offset | Description                     | Length (bytes) | Value                          |
|--------|---------------------------------|----------------|--------------------------------|
| 0x00   | File Signature                  | 4              | 46494C45 ('FILE')              |
| 0x04   | Update Sequence Offset and Size | 4              | 3000 (Offset), 0300 (Size)     |
| 0x08   | Log File Sequence Number (LSN)  | 8              | C3DB2A5927000000               |
| 0x10   | Sequence Number                 | 2              | F701                           |
| 0x12   | Link Count                      | 2              | 0200                           |
| 0x14   | First Attribute Offset          | 2              | 3800                           |
| 0x16   | Flags                           | 2              | 0300                           |
| 0x18   | Used Size of MFT Entry          | 4              | C0030000                       |
| 0x1C   | Allocated Size of MFT Entry     | 4              | 00000400                       |
| 0x20   | File Reference to Base Record   | 8              | 0000000000000000               |
| 0x28   | Next Attribute ID               | 2              | 0700                           |

### Attributes Details
| Offset | Attribute Type               | Length (bytes) | Resident | Attribute Data                                                                                             |
|--------|------------------------------|----------------|----------|------------------------------------------------------------------------------------------------------------|
| 0x30   | 0x10 (Standard Information)  | 96             | Yes      | 9358A0DC46BEDA01\n6E381DB748BEDA01\n6E381DB748BEDA01\n6E381DB748BEDA01\n6E381DB748BEDA01\n0000000000000000 |
| 0x90   | 0x30 (File Name)             | 112            | Yes      | 460045005300540046004F007E003100\n0000000000000000                                                          |
| 0xE0   | 0x40 (Object ID)             | 112            | Yes      | 65007300740046006F006C006400650072                                                                          |
| 0x130  | 0x80 (Data)                  | 144            | No       | 9308A0DC46BEDA01\n9308A0DC46BEDA01\n9308A0DC46BEDA01\n9308A0DC46BEDA01\n0000000000000000                    |
| 0x1C0  | 0x90 (Index Root)            | 144            | Yes      | 470045005300540046004F007E0031002E005400580054\n0000000000000000                                            |

These tables display the detailed breakdown of the MFT entry and its attributes, making it easier to understand the structure and content of the file record.

[memo]

It seems that the Index Allocation attribute is not visualized, possibly because the input HEX data was too large.
It is necessary to visualize each attribute separately or pay attention to the size.

There may not be an issue with the given size length, but it might be necessary to define the procedure for parsing the attributes within the FILE record.

A point to note is that even when there is data of 4 bytes in length, it seems that only 1 byte is being converted to a numerical value.

 

Q.
This is the HEX data of the attribute header within the FILE record. Visualize and explain the details in a format that humans can understand as a named attribute. I believe the name data is 2400490033003000.
90000000C00100000004180000000600A0010000200000002400490033003000

### Visualization and Explanation of the Attribute Header within the FILE Record as a Named Attribute

Given HEX Data:
```
90000000C00100000004180000000600A0010000200000002400490033003000
```

### Breakdown of the HEX Data:

1. **Attribute Type (0x00-0x03)**:
   - Offset: 0x00
   - Length: 4 bytes
   - Value: `90000000`
   - Description: 0x90 (Index Root)

2. **Length (0x04-0x07)**:
   - Offset: 0x04
   - Length: 4 bytes
   - Value: `C0010000`
   - Description: 192 bytes (attribute length)

3. **Name Length (0x08)**:
   - Offset: 0x08
   - Length: 1 byte
   - Value: `04`
   - Description: The length of the name is 4 bytes

4. **Name Offset (0x09)**:
   - Offset: 0x09
   - Length: 1 byte
   - Value: `18`
   - Description: The offset to the name is 24 bytes (0x18)

5. **Flags (0x0A-0x0B)**:
   - Offset: 0x0A
   - Length: 2 bytes
   - Value: `0000`
   - Description: Flags (0 in this case)

6. **Identifier (0x0C-0x0D)**:
   - Offset: 0x0C
   - Length: 2 bytes
   - Value: `0600`
   - Description: Attribute identifier

7. **Index Allocation Entry Size (0x10-0x13)**:
   - Offset: 0x10
   - Length: 4 bytes
   - Value: `A0010000`
   - Description: 0xA0 (160 bytes)

8. **Index Entries Offset (0x14-0x17)**:
   - Offset: 0x14
   - Length: 4 bytes
   - Value: `20000000`
   - Description: Offset to the index entries (32 bytes)

9. **Index Entries Count (0x18-0x1B)**:
   - Offset: 0x18
   - Length: 4 bytes
   - Value: `2400`
   - Description: Number of index entries (36 entries)

10. **Name (0x1C-0x23)**:
    - Offset: 0x1C
    - Length: 8 bytes
    - Value: `2400490033003000`
    - Description: Unicode name (interpreted as "$I30")

### Human-Readable Visualization:

#### Attribute Header Details:
| Field                           | Offset | Length (Bytes) | Value         | Description                             |
|---------------------------------|--------|----------------|---------------|-----------------------------------------|
| Attribute Type                  | 0x00   | 4              | 90000000      | 0x90 (Index Root)                       |
| Length                          | 0x04   | 4              | C0010000      | 192 bytes (attribute length)            |
| Name Length                     | 0x08   | 1              | 04            | 4 bytes                                 |
| Name Offset                     | 0x09   | 1              | 18            | 24 bytes (0x18)                         |
| Flags                           | 0x0A   | 2              | 0000          | Flags (0 in this case)                  |
| Identifier                      | 0x0C   | 2              | 0600          | Attribute identifier                    |
| Index Allocation Entry Size     | 0x10   | 4              | A0010000      | 0xA0 (160 bytes)                        |
| Index Entries Offset            | 0x14   | 4              | 20000000      | Offset to the index entries (32 bytes)  |
| Index Entries Count             | 0x18   | 4              | 2400          | Number of index entries (36 entries)    |
| Name                            | 0x1C   | 8              | 2400490033003000 | Unicode name ("$I30")                  |

### Explanation:
- **Attribute Type**: The type of the attribute is "Index Root" (0x90).
- **Length**: The total length of this attribute is 192 bytes.
- **Name Length**: The name of this attribute is 4 bytes long.
- **Name Offset**: The name starts at an offset of 24 bytes from the beginning of this header.
- **Flags**: There are no special flags set for this attribute (value is 0).
- **Identifier**: The identifier for this attribute is 0x0600.
- **Index Allocation Entry Size**: Each index allocation entry size is 160 bytes.
- **Index Entries Offset**: The index entries start at 32 bytes from the beginning of the attribute.
- **Index Entries Count**: There are 36 index entries in this attribute.
- **Name**: The name of the attribute is "$I30", which is encoded in Unicode as `2400490033003000`.

This structured format and explanation provide a clear understanding of the attribute header within the FILE record, showing how each part of the data is interpreted and what it represents.

 

[memo]

It seems that simply providing the data after the Index Root attribute to ChatGPT does not result in correct visualization. From my experience, it was more effective to first explain the definitions to ChatGPT before visualizing. Teaching ChatGPT also helps in my own learning.

 

Index Root
30000000010000000010000001000000

Index Header
10000000900100009001000001000000

 

Q.

The following is the definition of the INDEX

Offset,Size,Description
0x00,8,MFT Reference of the file
0x08,2,Size of this index entry
0x0A,2,Offset to the filename
0x0C,2,Index Flags
0x0E,2,Padding (align to 8 bytes)
0x10,8,MFT File Reference of the parent
0x18,8,File creation time
0x20,8,Last modification time
0x28,8,Last modification time for FILE record
0x30,8,Last access time
0x38,8,Allocated size of file
0x40,8,Real size of file
0x48,8,File Flags
0x50,1,Length of filename (F)
0x51,1,Filename namespace
0x52,2F,Filename

According to the above definition, visualize the following HEX data in a format that humans can understand. 
Visualize the Windows timestamps in a format that humans can understand, displayed in the format yyyy/mm/dd hh:mm:ss.000.
 Treat the filename as UNICODE.

4E36060000002600
7800
5A00
0100
0000
DF0100000000F701
23A21AB748BEDA01
23A21AB748BEDA01
23A21AB748BEDA01
23A21AB748BEDA01
0000000000000000
0000000000000700
2000000000000000
0C
02
5400450041003400320031007E0031002E00540058005400

Sure, let's visualize the given HEX data according to the provided definition and display the Windows timestamps in the required format.

### HEX Data Breakdown
```
4E36060000002600
7800
5A00
0100
0000
DF0100000000F701
23A21AB748BEDA01
23A21AB748BEDA01
23A21AB748BEDA01
23A21AB748BEDA01
0000000000000000
0000000000000700
2000000000000000
0C
02
5400450041003400320031007E0031002E00540058005400
```

### Data Interpretation

1. **MFT Reference of the file (0x00, 8 bytes)**
   - HEX: `4E36060000002600`
   - Little Endian: `002600000006364E`
   - Decimal: 183137422770624

2. **Size of this index entry (0x08, 2 bytes)**
   - HEX: `7800`
   - Little Endian: `0078`
   - Decimal: 120

3. **Offset to the filename (0x0A, 2 bytes)**
   - HEX: `5A00`
   - Little Endian: `005A`
   - Decimal: 90

4. **Index Flags (0x0C, 2 bytes)**
   - HEX: `0100`
   - Little Endian: `0001`
   - Decimal: 1

5. **Padding (0x0E, 2 bytes)**
   - HEX: `0000`
   - Little Endian: `0000`
   - Decimal: 0

6. **MFT File Reference of the parent (0x10, 8 bytes)**
   - HEX: `DF0100000000F701`
   - Little Endian: `01F70000000001DF`
   - Decimal: 141287244824577

7. **File creation time (0x18, 8 bytes)**
   - HEX: `23A21AB748BEDA01`
   - Little Endian: `01DABE48B71AA223`
   - Decimal: 132677924230150000
   - Date: 2024/06/14 10:50:47.974

8. **Last modification time (0x20, 8 bytes)**
   - HEX: `23A21AB748BEDA01`
   - Little Endian: `01DABE48B71AA223`
   - Decimal: 132677924230150000
   - Date: 2024/06/14 10:50:47.974

9. **Last modification time for FILE record (0x28, 8 bytes)**
   - HEX: `23A21AB748BEDA01`
   - Little Endian: `01DABE48B71AA223`
   - Decimal: 132677924230150000
   - Date: 2024/06/14 10:50:47.974

10. **Last access time (0x30, 8 bytes)**
    - HEX: `23A21AB748BEDA01`
    - Little Endian: `01DABE48B71AA223`
    - Decimal: 132677924230150000
    - Date: 2024/06/14 10:50:47.974

11. **Allocated size of file (0x38, 8 bytes)**
    - HEX: `0000000000000000`
    - Little Endian: `0000000000000000`
    - Decimal: 0

12. **Real size of file (0x40, 8 bytes)**
    - HEX: `0000000000000700`
    - Little Endian: `0007000000000000`
    - Decimal: 1792

13. **File Flags (0x48, 8 bytes)**
    - HEX: `2000000000000000`
    - Little Endian: `0000000000000020`
    - Decimal: 32

14. **Length of filename (F) (0x50, 1 byte)**
    - HEX: `0C`
    - Decimal: 12

15. **Filename namespace (0x51, 1 byte)**
    - HEX: `02`
    - Decimal: 2

16. **Filename (0x52, 47 bytes)**
    - HEX: `5400450041003400320031007E0031002E00540058005400`
    - Unicode: `TEA421~1.TXT`

### Human-Readable Format

```plaintext
MFT Reference of the file: 183137422770624
Size of this index entry: 120 bytes
Offset to the filename: 90 bytes
Index Flags: 1
Padding: 0
MFT File Reference of the parent: 141287244824577
File creation time: 2024/06/14 10:50:47.974
Last modification time: 2024/06/14 10:50:47.974
Last modification time for FILE record: 2024/06/14 10:50:47.974
Last access time: 2024/06/14 10:50:47.974
Allocated size of file: 0 bytes
Real size of file: 1792 bytes
File Flags: 32
Length of filename (F): 12
Filename namespace: 2
Filename: TEA421~1.TXT
```

[memo]

There were cases where the time information was not correctly interpreted, resulting in incorrect dates and times being provided. It is safer to verify the output results against those visually confirmed with tools like FTK Imager.

 

It is also necessary to teach ChatGPT how to parse the MFT File Reference of the parent.

I think my instructions may be unclear, but there are many cases where the LE values are not correctly output. If pointed out, they are corrected to the correct values, but always verify the accuracy of the output results.