[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M77W40K4QJB3HTK72MK2AFCS":3,"skill-same:01M77W40K4QJB3HTK72MK2AFCS":90},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":48,"commitSha":49,"skillDirectory":50,"forksCount":51,"repositoryHtmlUrl":52,"repositoryHomepageUrl":6,"ownerHtmlUrl":53,"ownerBlogUrl":54,"ownerDescription":6,"updatedAt":55,"install":56,"resources":69},"01M77W40K4QJB3HTK72MK2AFCS","analyzing-slack-space-and-file-system-artifacts",null,"Examine file system slack space, MFT entries, USN journal, and alternate data streams to recover hidden data and reconstruct file activity on NTFS volumes.","vdcworkshop\u002FSkills-Catalog","vdcworkshop","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F275270998?v=4","01M77R8FXSKYTB2X9SSVJN7ZRZ","αtef βouafif","01M77R8FYGECN2YWM6WVBVPMGS",1,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fvdcworkshop\u002FSkills-Catalog\u002Fblob\u002Fmain\u002F09 Research\u002F06 Astronomy & Physics\u002Fanalyzing-slack-space-and-file-system-artifacts\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fvdcworkshop\u002FSkills-Catalog\u002Fblob\u002Fmain\u002F09 Research\u002F06 Astronomy & Physics\u002Fanalyzing-slack-space-and-file-system-artifacts\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: analyzing-slack-space-and-file-system-artifacts\ndescription: Examine file system slack space, MFT entries, USN journal, and alternate\n  data streams to recover hidden data and reconstruct file activity on NTFS volumes.\ndomain: cybersecurity\nsubdomain: digital-forensics\ntags:\n- forensics\n- slack-space\n- ntfs\n- mft\n- usn-journal\n- alternate-data-streams\n- file-system-analysis\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- RS.AN-01\n- RS.AN-03\n- DE.AE-02\n- RS.MA-01\nmitre_attack:\n- T1070.006\n- T1564.004\n- T1070.004\n- T1005\n- T1006\n---\n\n# Analyzing Slack Space and File System Artifacts\n\n## When to Use\n- When searching for hidden or residual data in file system slack space\n- For analyzing NTFS Master File Table (MFT) entries for deleted file metadata\n- When reconstructing file operations from the USN Change Journal\n- For detecting Alternate Data Streams (ADS) used to hide data or malware\n- During deep forensic analysis requiring examination beyond standard file recovery\n\n## Prerequisites\n- Forensic disk image with NTFS file system\n- The Sleuth Kit (TSK) tools: istat, icat, fls, blkls, blkstat\n- MFTECmd (Eric Zimmerman) for MFT parsing\n- MFTExplorer for interactive MFT analysis\n- Understanding of NTFS structures (MFT, $UsnJrnl, $LogFile, ADS)\n- Python with analyzeMFT or mft library for automated parsing\n\n## Workflow\n\n### Step 1: Identify and Extract NTFS File System Artifacts\n\n```bash\n# Determine partition layout\nmmls \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd\n\n# Extract key NTFS system files\n# $MFT - Master File Table\nicat -o 2048 \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd 0 > \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002FMFT\n\n# $UsnJrnl:$J - USN Change Journal\nicat -o 2048 \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd 62-128 > \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002FUsnJrnl_J\n\n# $LogFile - Transaction log\nicat -o 2048 \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd 2 > \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002FLogFile\n\n# Extract all slack space from the volume\nblkls -s -o 2048 \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd > \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002Fslack_space.raw\n\n# Get file system information\nfsstat -o 2048 \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd | tee \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002Ffs_info.txt\n```\n\n### Step 2: Analyze the Master File Table (MFT)\n\n```bash\n# Parse MFT with MFTECmd (Eric Zimmerman)\nMFTECmd.exe -f \"C:\\cases\\ntfs\\MFT\" --csv \"C:\\cases\\analysis\\\" --csvf mft_analysis.csv\n\n# Parse with analyzeMFT (Python)\npip install analyzeMFT\n\nanalyzeMFT.py -f \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002FMFT \\\n   -o \u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fmft_analysis.csv \\\n   -c\n\n# Custom MFT analysis with Python\npython3 \u003C\u003C 'PYEOF'\nfrom mft import PyMft\nimport csv\n\nmft = PyMft(open('\u002Fcases\u002Fcase-2024-001\u002Fntfs\u002FMFT', 'rb').read())\n\ndeleted_files = []\nsuspicious_files = []\n\nfor entry in mft.entries():\n    if entry is None:\n        continue\n\n    filename = entry.get_filename()\n    if filename is None:\n        continue\n\n    is_deleted = not entry.is_active()\n    is_directory = entry.is_directory()\n    created = entry.get_created_timestamp()\n    modified = entry.get_modified_timestamp()\n    mft_modified = entry.get_mft_modified_timestamp()\n    size = entry.get_file_size()\n\n    # Flag deleted files for recovery\n    if is_deleted and not is_directory and size > 0:\n        deleted_files.append({\n            'filename': filename,\n            'size': size,\n            'created': str(created),\n            'modified': str(modified),\n            'entry_number': entry.entry_number\n        })\n\n    # Detect timestomping (MFT modified time != $SI modified time)\n    si_modified = entry.get_si_modified_timestamp()\n    fn_modified = entry.get_fn_modified_timestamp()\n    if si_modified and fn_modified:\n        if abs((si_modified - fn_modified).total_seconds()) > 86400:  # >1 day difference\n            suspicious_files.append({\n                'filename': filename,\n                'si_modified': str(si_modified),\n                'fn_modified': str(fn_modified),\n                'delta': str(si_modified - fn_modified)\n            })\n\nprint(f\"=== DELETED FILES (recoverable metadata) ===\")\nprint(f\"Total: {len(deleted_files)}\")\nfor f in deleted_files[:20]:\n    print(f\"  [{f['modified']}] {f['filename']} ({f['size']} bytes)\")\n\nprint(f\"\\n=== POTENTIAL TIMESTOMPING ===\")\nprint(f\"Total suspicious: {len(suspicious_files)}\")\nfor f in suspicious_files[:10]:\n    print(f\"  {f['filename']}: $SI={f['si_modified']}, $FN={f['fn_modified']} (delta: {f['delta']})\")\nPYEOF\n```\n\n### Step 3: Analyze Slack Space for Hidden Data\n\n```bash\n# Search slack space for strings\nstrings -a \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002Fslack_space.raw > \u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fslack_strings.txt\n\n# Search for specific patterns in slack space\ngrep -iab \"password\\|secret\\|confidential\\|credit.card\\|ssn\" \\\n   \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002Fslack_space.raw > \u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fslack_keywords.txt\n\n# Analyze individual file slack\npython3 \u003C\u003C 'PYEOF'\nimport struct\n\n# File slack consists of:\n# 1. RAM slack: bytes between file end and next sector boundary (filled with RAM content or zeros)\n# 2. Drive slack: remaining sectors in the cluster after the last file sector\n\n# Analyze slack for specific MFT entries\n# Using Sleuth Kit to get file slack for a specific file\nimport subprocess\n\n# Get file details\nresult = subprocess.run(\n    ['istat', '-o', '2048', '\u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd', '14523'],\n    capture_output=True, text=True\n)\nprint(result.stdout)\n\n# The output shows data runs - the last cluster may contain slack data\n# Calculate slack size: (allocated_size - file_size) bytes\nPYEOF\n\n# Search for file signatures in slack space (embedded files)\nforemost -t jpg,pdf,zip -i \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002Fslack_space.raw \\\n   -o \u002Fcases\u002Fcase-2024-001\u002Fcarved\u002Fslack_carved\u002F\n\n# Use bulk_extractor to find structured data in slack\nbulk_extractor -o \u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fbulk_extract\u002F \\\n   \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002Fslack_space.raw\n```\n\n### Step 4: Parse the USN Change Journal\n\n```bash\n# Parse USN Journal with MFTECmd\nMFTECmd.exe -f \"C:\\cases\\ntfs\\UsnJrnl_J\" --csv \"C:\\cases\\analysis\\\" --csvf usn_journal.csv\n\n# Python USN Journal parsing\npip install pyusn\n\npython3 \u003C\u003C 'PYEOF'\nimport struct\nimport csv\nfrom datetime import datetime, timedelta\n\ndef parse_usn_record(data, offset):\n    \"\"\"Parse a single USN_RECORD_V2.\"\"\"\n    if offset + 8 > len(data):\n        return None, offset\n\n    record_len = struct.unpack_from('\u003CI', data, offset)[0]\n    if record_len \u003C 56 or record_len > 65536 or offset + record_len > len(data):\n        return None, offset + 8\n\n    major_ver = struct.unpack_from('\u003CH', data, offset + 4)[0]\n    if major_ver != 2:\n        return None, offset + record_len\n\n    mft_ref = struct.unpack_from('\u003CQ', data, offset + 8)[0] & 0xFFFFFFFFFFFF\n    parent_ref = struct.unpack_from('\u003CQ', data, offset + 16)[0] & 0xFFFFFFFFFFFF\n    usn = struct.unpack_from('\u003CQ', data, offset + 24)[0]\n    timestamp = struct.unpack_from('\u003CQ', data, offset + 32)[0]\n    reason = struct.unpack_from('\u003CI', data, offset + 40)[0]\n    source_info = struct.unpack_from('\u003CI', data, offset + 44)[0]\n    security_id = struct.unpack_from('\u003CI', data, offset + 48)[0]\n    file_attrs = struct.unpack_from('\u003CI', data, offset + 52)[0]\n    filename_len = struct.unpack_from('\u003CH', data, offset + 56)[0]\n    filename_off = struct.unpack_from('\u003CH', data, offset + 58)[0]\n\n    name = data[offset + filename_off:offset + filename_off + filename_len].decode('utf-16-le', errors='ignore')\n\n    # Convert Windows FILETIME to datetime\n    ts = datetime(1601, 1, 1) + timedelta(microseconds=timestamp \u002F\u002F 10)\n\n    # Decode reason flags\n    reasons = []\n    reason_flags = {\n        0x01: 'DATA_OVERWRITE', 0x02: 'DATA_EXTEND', 0x04: 'DATA_TRUNCATION',\n        0x10: 'NAMED_DATA_OVERWRITE', 0x20: 'NAMED_DATA_EXTEND',\n        0x100: 'FILE_CREATE', 0x200: 'FILE_DELETE', 0x400: 'EA_CHANGE',\n        0x800: 'SECURITY_CHANGE', 0x1000: 'RENAME_OLD_NAME', 0x2000: 'RENAME_NEW_NAME',\n        0x4000: 'INDEXABLE_CHANGE', 0x8000: 'BASIC_INFO_CHANGE',\n        0x10000: 'HARD_LINK_CHANGE', 0x20000: 'COMPRESSION_CHANGE',\n        0x40000: 'ENCRYPTION_CHANGE', 0x80000: 'OBJECT_ID_CHANGE',\n        0x100000: 'REPARSE_POINT_CHANGE', 0x200000: 'STREAM_CHANGE',\n        0x80000000: 'CLOSE'\n    }\n    for flag, desc in reason_flags.items():\n        if reason & flag:\n            reasons.append(desc)\n\n    record = {\n        'timestamp': ts.strftime('%Y-%m-%d %H:%M:%S'),\n        'filename': name,\n        'mft_entry': mft_ref,\n        'parent_entry': parent_ref,\n        'reasons': '|'.join(reasons),\n        'usn': usn\n    }\n\n    return record, offset + record_len\n\n# Parse the journal\nwith open('\u002Fcases\u002Fcase-2024-001\u002Fntfs\u002FUsnJrnl_J', 'rb') as f:\n    data = f.read()\n\nrecords = []\noffset = 0\nwhile offset \u003C len(data) - 8:\n    record, offset = parse_usn_record(data, offset)\n    if record:\n        records.append(record)\n    else:\n        offset += 8  # Skip zeros\n\n# Filter for deletion events\ndeletions = [r for r in records if 'FILE_DELETE' in r['reasons']]\ncreations = [r for r in records if 'FILE_CREATE' in r['reasons']]\nrenames = [r for r in records if 'RENAME_NEW_NAME' in r['reasons']]\n\nprint(f\"Total USN records: {len(records)}\")\nprint(f\"File creations: {len(creations)}\")\nprint(f\"File deletions: {len(deletions)}\")\nprint(f\"File renames: {len(renames)}\")\n\nprint(\"\\n=== RECENT DELETIONS ===\")\nfor r in deletions[-20:]:\n    print(f\"  [{r['timestamp']}] DELETED: {r['filename']} (MFT#{r['mft_entry']})\")\n\n# Write full journal to CSV\nwith open('\u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fusn_journal.csv', 'w', newline='') as f:\n    writer = csv.DictWriter(f, fieldnames=['timestamp', 'filename', 'mft_entry', 'parent_entry', 'reasons', 'usn'])\n    writer.writeheader()\n    writer.writerows(records)\nPYEOF\n```\n\n### Step 5: Detect and Analyze Alternate Data Streams\n\n```bash\n# List all Alternate Data Streams in the image\nfind \u002Fmnt\u002Fevidence -exec getfattr -d {} \\; 2>\u002Fdev\u002Fnull | grep -i \"ads\\|zone\\|stream\"\n\n# Using Sleuth Kit to find ADS\nfls -r -o 2048 \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd | grep \":\" | \\\n   tee \u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fads_list.txt\n\n# Extract specific ADS content\n# Format: icat image inode:ads_name\nicat -o 2048 \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd 14523:hidden_stream \\\n   > \u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fextracted_ads.bin\n\n# Check Zone.Identifier streams (download origin tracking)\nfls -r -o 2048 \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd | grep \"Zone.Identifier\" | \\\n   while read line; do\n       inode=$(echo \"$line\" | awk '{print $2}' | tr -d ':')\n       echo \"=== $line ===\"\n       icat -o 2048 \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd \"${inode}:Zone.Identifier\" 2>\u002Fdev\u002Fnull\n       echo \"\"\n   done > \u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fzone_identifiers.txt\n\n# Zone.Identifier content reveals:\n# [ZoneTransfer]\n# ZoneId=3          (3 = Internet, indicating file was downloaded)\n# ReferrerUrl=https:\u002F\u002Fmalicious-site.com\u002Fpayload.exe\n# HostUrl=https:\u002F\u002Fcdn.malicious-site.com\u002Fpayload.exe\n```\n\n## Key Concepts\n\n| Concept | Description |\n|---------|-------------|\n| File slack | Unused space between file end and cluster boundary containing residual data |\n| RAM slack | Portion of slack from file end to sector boundary (historically filled with RAM) |\n| MFT ($MFT) | Master File Table - NTFS metadata database with entries for every file |\n| USN Journal ($UsnJrnl) | Change journal recording all file\u002Fdirectory modifications on NTFS |\n| Alternate Data Streams | NTFS feature allowing multiple data streams per file (hidden storage) |\n| $STANDARD_INFORMATION | MFT attribute with timestamps modifiable by user-mode applications |\n| $FILE_NAME | MFT attribute with timestamps only modifiable by the kernel |\n| Timestomping | Anti-forensic technique modifying file timestamps to avoid detection |\n\n## Tools & Systems\n\n| Tool | Purpose |\n|------|---------|\n| MFTECmd | Eric Zimmerman MFT and USN Journal parser with CSV output |\n| MFTExplorer | Interactive GUI tool for MFT analysis |\n| analyzeMFT | Python MFT parser with CSV\u002FJSON output |\n| The Sleuth Kit | File system forensics toolkit (fls, icat, blkls, istat) |\n| bulk_extractor | Feature extraction from raw data including slack space |\n| NTFS Log Tracker | Tool for parsing $LogFile transaction records |\n| streams.exe | Sysinternals tool for listing NTFS Alternate Data Streams |\n| Plaso | Super-timeline tool parsing MFT and USN Journal |\n\n## Common Scenarios\n\n**Scenario 1: Anti-Forensics Detection via Timestomping**\nCompare $STANDARD_INFORMATION timestamps with $FILE_NAME timestamps in MFT entries, flag files where $SI timestamps predate $FN timestamps (impossible in normal operation), identify timestomped files as evidence of deliberate manipulation, correlate with other timeline evidence.\n\n**Scenario 2: Hidden Data in Alternate Data Streams**\nScan for ADS attached to files beyond the standard Zone.Identifier, extract ADS content for analysis, check for hidden executables or documents stored in ADS, correlate ADS creation with user activity timeline, document findings for evidence.\n\n**Scenario 3: Deleted File Reconstruction from MFT**\nParse MFT for inactive (deleted) entries, extract filenames, sizes, and timestamps of deleted files, recover file content using icat if data clusters are not overwritten, build list of deleted evidence files, correlate with USN Journal delete events.\n\n**Scenario 4: File Activity Reconstruction from USN Journal**\nParse the USN Change Journal for the investigation period, identify file creation, modification, rename, and deletion events, reconstruct the sequence of file operations, detect evidence of data staging (create, copy, compress, delete pattern), identify anti-forensic file wiping.\n\n## Output Format\n\n```\nFile System Artifact Analysis:\n  Volume: NTFS (Partition 2, 465 GB)\n  Cluster Size: 4096 bytes\n\n  MFT Analysis:\n    Total Entries: 456,789\n    Active Files: 234,567\n    Deleted Entries: 12,345 (8,901 with recoverable metadata)\n    Timestomped Files: 23 (SI\u002FFN mismatch detected)\n\n  USN Journal:\n    Records Parsed: 2,345,678\n    Date Range: 2024-01-01 to 2024-01-20\n    File Creations: 45,678\n    File Deletions: 23,456\n    File Renames: 12,345\n\n  Alternate Data Streams:\n    Total ADS Found: 1,234\n    Zone.Identifier: 890 (downloaded files)\n    Custom\u002FSuspicious ADS: 5 (hidden data detected)\n\n  Slack Space:\n    Total Slack: 12.3 GB\n    Keyword Hits: 45 (passwords, credit cards)\n    Carved Files: 23 from slack space\n\n  Suspicious Findings:\n    - 23 files with timestomped timestamps\n    - 5 files with hidden ADS containing data\n    - USN shows mass deletion on 2024-01-18 (anti-forensics)\n    - Slack space contains residual email fragments\n\n  Reports: \u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002F\n```\n","# Analyzing Slack Space and File System Artifacts\n\n## When to Use\n- When searching for hidden or residual data in file system slack space\n- For analyzing NTFS Master File Table (MFT) entries for deleted file metadata\n- When reconstructing file operations from the USN Change Journal\n- For detecting Alternate Data Streams (ADS) used to hide data or malware\n- During deep forensic analysis requiring examination beyond standard file recovery\n\n## Prerequisites\n- Forensic disk image with NTFS file system\n- The Sleuth Kit (TSK) tools: istat, icat, fls, blkls, blkstat\n- MFTECmd (Eric Zimmerman) for MFT parsing\n- MFTExplorer for interactive MFT analysis\n- Understanding of NTFS structures (MFT, $UsnJrnl, $LogFile, ADS)\n- Python with analyzeMFT or mft library for automated parsing\n\n## Workflow\n\n### Step 1: Identify and Extract NTFS File System Artifacts\n\n```bash\n# Determine partition layout\nmmls \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd\n\n# Extract key NTFS system files\n# $MFT - Master File Table\nicat -o 2048 \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd 0 > \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002FMFT\n\n# $UsnJrnl:$J - USN Change Journal\nicat -o 2048 \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd 62-128 > \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002FUsnJrnl_J\n\n# $LogFile - Transaction log\nicat -o 2048 \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd 2 > \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002FLogFile\n\n# Extract all slack space from the volume\nblkls -s -o 2048 \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd > \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002Fslack_space.raw\n\n# Get file system information\nfsstat -o 2048 \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd | tee \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002Ffs_info.txt\n```\n\n### Step 2: Analyze the Master File Table (MFT)\n\n```bash\n# Parse MFT with MFTECmd (Eric Zimmerman)\nMFTECmd.exe -f \"C:\\cases\\ntfs\\MFT\" --csv \"C:\\cases\\analysis\\\" --csvf mft_analysis.csv\n\n# Parse with analyzeMFT (Python)\npip install analyzeMFT\n\nanalyzeMFT.py -f \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002FMFT \\\n   -o \u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fmft_analysis.csv \\\n   -c\n\n# Custom MFT analysis with Python\npython3 \u003C\u003C 'PYEOF'\nfrom mft import PyMft\nimport csv\n\nmft = PyMft(open('\u002Fcases\u002Fcase-2024-001\u002Fntfs\u002FMFT', 'rb').read())\n\ndeleted_files = []\nsuspicious_files = []\n\nfor entry in mft.entries():\n    if entry is None:\n        continue\n\n    filename = entry.get_filename()\n    if filename is None:\n        continue\n\n    is_deleted = not entry.is_active()\n    is_directory = entry.is_directory()\n    created = entry.get_created_timestamp()\n    modified = entry.get_modified_timestamp()\n    mft_modified = entry.get_mft_modified_timestamp()\n    size = entry.get_file_size()\n\n    # Flag deleted files for recovery\n    if is_deleted and not is_directory and size > 0:\n        deleted_files.append({\n            'filename': filename,\n            'size': size,\n            'created': str(created),\n            'modified': str(modified),\n            'entry_number': entry.entry_number\n        })\n\n    # Detect timestomping (MFT modified time != $SI modified time)\n    si_modified = entry.get_si_modified_timestamp()\n    fn_modified = entry.get_fn_modified_timestamp()\n    if si_modified and fn_modified:\n        if abs((si_modified - fn_modified).total_seconds()) > 86400:  # >1 day difference\n            suspicious_files.append({\n                'filename': filename,\n                'si_modified': str(si_modified),\n                'fn_modified': str(fn_modified),\n                'delta': str(si_modified - fn_modified)\n            })\n\nprint(f\"=== DELETED FILES (recoverable metadata) ===\")\nprint(f\"Total: {len(deleted_files)}\")\nfor f in deleted_files[:20]:\n    print(f\"  [{f['modified']}] {f['filename']} ({f['size']} bytes)\")\n\nprint(f\"\\n=== POTENTIAL TIMESTOMPING ===\")\nprint(f\"Total suspicious: {len(suspicious_files)}\")\nfor f in suspicious_files[:10]:\n    print(f\"  {f['filename']}: $SI={f['si_modified']}, $FN={f['fn_modified']} (delta: {f['delta']})\")\nPYEOF\n```\n\n### Step 3: Analyze Slack Space for Hidden Data\n\n```bash\n# Search slack space for strings\nstrings -a \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002Fslack_space.raw > \u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fslack_strings.txt\n\n# Search for specific patterns in slack space\ngrep -iab \"password\\|secret\\|confidential\\|credit.card\\|ssn\" \\\n   \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002Fslack_space.raw > \u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fslack_keywords.txt\n\n# Analyze individual file slack\npython3 \u003C\u003C 'PYEOF'\nimport struct\n\n# File slack consists of:\n# 1. RAM slack: bytes between file end and next sector boundary (filled with RAM content or zeros)\n# 2. Drive slack: remaining sectors in the cluster after the last file sector\n\n# Analyze slack for specific MFT entries\n# Using Sleuth Kit to get file slack for a specific file\nimport subprocess\n\n# Get file details\nresult = subprocess.run(\n    ['istat', '-o', '2048', '\u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd', '14523'],\n    capture_output=True, text=True\n)\nprint(result.stdout)\n\n# The output shows data runs - the last cluster may contain slack data\n# Calculate slack size: (allocated_size - file_size) bytes\nPYEOF\n\n# Search for file signatures in slack space (embedded files)\nforemost -t jpg,pdf,zip -i \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002Fslack_space.raw \\\n   -o \u002Fcases\u002Fcase-2024-001\u002Fcarved\u002Fslack_carved\u002F\n\n# Use bulk_extractor to find structured data in slack\nbulk_extractor -o \u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fbulk_extract\u002F \\\n   \u002Fcases\u002Fcase-2024-001\u002Fntfs\u002Fslack_space.raw\n```\n\n### Step 4: Parse the USN Change Journal\n\n```bash\n# Parse USN Journal with MFTECmd\nMFTECmd.exe -f \"C:\\cases\\ntfs\\UsnJrnl_J\" --csv \"C:\\cases\\analysis\\\" --csvf usn_journal.csv\n\n# Python USN Journal parsing\npip install pyusn\n\npython3 \u003C\u003C 'PYEOF'\nimport struct\nimport csv\nfrom datetime import datetime, timedelta\n\ndef parse_usn_record(data, offset):\n    \"\"\"Parse a single USN_RECORD_V2.\"\"\"\n    if offset + 8 > len(data):\n        return None, offset\n\n    record_len = struct.unpack_from('\u003CI', data, offset)[0]\n    if record_len \u003C 56 or record_len > 65536 or offset + record_len > len(data):\n        return None, offset + 8\n\n    major_ver = struct.unpack_from('\u003CH', data, offset + 4)[0]\n    if major_ver != 2:\n        return None, offset + record_len\n\n    mft_ref = struct.unpack_from('\u003CQ', data, offset + 8)[0] & 0xFFFFFFFFFFFF\n    parent_ref = struct.unpack_from('\u003CQ', data, offset + 16)[0] & 0xFFFFFFFFFFFF\n    usn = struct.unpack_from('\u003CQ', data, offset + 24)[0]\n    timestamp = struct.unpack_from('\u003CQ', data, offset + 32)[0]\n    reason = struct.unpack_from('\u003CI', data, offset + 40)[0]\n    source_info = struct.unpack_from('\u003CI', data, offset + 44)[0]\n    security_id = struct.unpack_from('\u003CI', data, offset + 48)[0]\n    file_attrs = struct.unpack_from('\u003CI', data, offset + 52)[0]\n    filename_len = struct.unpack_from('\u003CH', data, offset + 56)[0]\n    filename_off = struct.unpack_from('\u003CH', data, offset + 58)[0]\n\n    name = data[offset + filename_off:offset + filename_off + filename_len].decode('utf-16-le', errors='ignore')\n\n    # Convert Windows FILETIME to datetime\n    ts = datetime(1601, 1, 1) + timedelta(microseconds=timestamp \u002F\u002F 10)\n\n    # Decode reason flags\n    reasons = []\n    reason_flags = {\n        0x01: 'DATA_OVERWRITE', 0x02: 'DATA_EXTEND', 0x04: 'DATA_TRUNCATION',\n        0x10: 'NAMED_DATA_OVERWRITE', 0x20: 'NAMED_DATA_EXTEND',\n        0x100: 'FILE_CREATE', 0x200: 'FILE_DELETE', 0x400: 'EA_CHANGE',\n        0x800: 'SECURITY_CHANGE', 0x1000: 'RENAME_OLD_NAME', 0x2000: 'RENAME_NEW_NAME',\n        0x4000: 'INDEXABLE_CHANGE', 0x8000: 'BASIC_INFO_CHANGE',\n        0x10000: 'HARD_LINK_CHANGE', 0x20000: 'COMPRESSION_CHANGE',\n        0x40000: 'ENCRYPTION_CHANGE', 0x80000: 'OBJECT_ID_CHANGE',\n        0x100000: 'REPARSE_POINT_CHANGE', 0x200000: 'STREAM_CHANGE',\n        0x80000000: 'CLOSE'\n    }\n    for flag, desc in reason_flags.items():\n        if reason & flag:\n            reasons.append(desc)\n\n    record = {\n        'timestamp': ts.strftime('%Y-%m-%d %H:%M:%S'),\n        'filename': name,\n        'mft_entry': mft_ref,\n        'parent_entry': parent_ref,\n        'reasons': '|'.join(reasons),\n        'usn': usn\n    }\n\n    return record, offset + record_len\n\n# Parse the journal\nwith open('\u002Fcases\u002Fcase-2024-001\u002Fntfs\u002FUsnJrnl_J', 'rb') as f:\n    data = f.read()\n\nrecords = []\noffset = 0\nwhile offset \u003C len(data) - 8:\n    record, offset = parse_usn_record(data, offset)\n    if record:\n        records.append(record)\n    else:\n        offset += 8  # Skip zeros\n\n# Filter for deletion events\ndeletions = [r for r in records if 'FILE_DELETE' in r['reasons']]\ncreations = [r for r in records if 'FILE_CREATE' in r['reasons']]\nrenames = [r for r in records if 'RENAME_NEW_NAME' in r['reasons']]\n\nprint(f\"Total USN records: {len(records)}\")\nprint(f\"File creations: {len(creations)}\")\nprint(f\"File deletions: {len(deletions)}\")\nprint(f\"File renames: {len(renames)}\")\n\nprint(\"\\n=== RECENT DELETIONS ===\")\nfor r in deletions[-20:]:\n    print(f\"  [{r['timestamp']}] DELETED: {r['filename']} (MFT#{r['mft_entry']})\")\n\n# Write full journal to CSV\nwith open('\u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fusn_journal.csv', 'w', newline='') as f:\n    writer = csv.DictWriter(f, fieldnames=['timestamp', 'filename', 'mft_entry', 'parent_entry', 'reasons', 'usn'])\n    writer.writeheader()\n    writer.writerows(records)\nPYEOF\n```\n\n### Step 5: Detect and Analyze Alternate Data Streams\n\n```bash\n# List all Alternate Data Streams in the image\nfind \u002Fmnt\u002Fevidence -exec getfattr -d {} \\; 2>\u002Fdev\u002Fnull | grep -i \"ads\\|zone\\|stream\"\n\n# Using Sleuth Kit to find ADS\nfls -r -o 2048 \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd | grep \":\" | \\\n   tee \u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fads_list.txt\n\n# Extract specific ADS content\n# Format: icat image inode:ads_name\nicat -o 2048 \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd 14523:hidden_stream \\\n   > \u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fextracted_ads.bin\n\n# Check Zone.Identifier streams (download origin tracking)\nfls -r -o 2048 \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd | grep \"Zone.Identifier\" | \\\n   while read line; do\n       inode=$(echo \"$line\" | awk '{print $2}' | tr -d ':')\n       echo \"=== $line ===\"\n       icat -o 2048 \u002Fcases\u002Fcase-2024-001\u002Fimages\u002Fevidence.dd \"${inode}:Zone.Identifier\" 2>\u002Fdev\u002Fnull\n       echo \"\"\n   done > \u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002Fzone_identifiers.txt\n\n# Zone.Identifier content reveals:\n# [ZoneTransfer]\n# ZoneId=3          (3 = Internet, indicating file was downloaded)\n# ReferrerUrl=https:\u002F\u002Fmalicious-site.com\u002Fpayload.exe\n# HostUrl=https:\u002F\u002Fcdn.malicious-site.com\u002Fpayload.exe\n```\n\n## Key Concepts\n\n| Concept | Description |\n|---------|-------------|\n| File slack | Unused space between file end and cluster boundary containing residual data |\n| RAM slack | Portion of slack from file end to sector boundary (historically filled with RAM) |\n| MFT ($MFT) | Master File Table - NTFS metadata database with entries for every file |\n| USN Journal ($UsnJrnl) | Change journal recording all file\u002Fdirectory modifications on NTFS |\n| Alternate Data Streams | NTFS feature allowing multiple data streams per file (hidden storage) |\n| $STANDARD_INFORMATION | MFT attribute with timestamps modifiable by user-mode applications |\n| $FILE_NAME | MFT attribute with timestamps only modifiable by the kernel |\n| Timestomping | Anti-forensic technique modifying file timestamps to avoid detection |\n\n## Tools & Systems\n\n| Tool | Purpose |\n|------|---------|\n| MFTECmd | Eric Zimmerman MFT and USN Journal parser with CSV output |\n| MFTExplorer | Interactive GUI tool for MFT analysis |\n| analyzeMFT | Python MFT parser with CSV\u002FJSON output |\n| The Sleuth Kit | File system forensics toolkit (fls, icat, blkls, istat) |\n| bulk_extractor | Feature extraction from raw data including slack space |\n| NTFS Log Tracker | Tool for parsing $LogFile transaction records |\n| streams.exe | Sysinternals tool for listing NTFS Alternate Data Streams |\n| Plaso | Super-timeline tool parsing MFT and USN Journal |\n\n## Common Scenarios\n\n**Scenario 1: Anti-Forensics Detection via Timestomping**\nCompare $STANDARD_INFORMATION timestamps with $FILE_NAME timestamps in MFT entries, flag files where $SI timestamps predate $FN timestamps (impossible in normal operation), identify timestomped files as evidence of deliberate manipulation, correlate with other timeline evidence.\n\n**Scenario 2: Hidden Data in Alternate Data Streams**\nScan for ADS attached to files beyond the standard Zone.Identifier, extract ADS content for analysis, check for hidden executables or documents stored in ADS, correlate ADS creation with user activity timeline, document findings for evidence.\n\n**Scenario 3: Deleted File Reconstruction from MFT**\nParse MFT for inactive (deleted) entries, extract filenames, sizes, and timestamps of deleted files, recover file content using icat if data clusters are not overwritten, build list of deleted evidence files, correlate with USN Journal delete events.\n\n**Scenario 4: File Activity Reconstruction from USN Journal**\nParse the USN Change Journal for the investigation period, identify file creation, modification, rename, and deletion events, reconstruct the sequence of file operations, detect evidence of data staging (create, copy, compress, delete pattern), identify anti-forensic file wiping.\n\n## Output Format\n\n```\nFile System Artifact Analysis:\n  Volume: NTFS (Partition 2, 465 GB)\n  Cluster Size: 4096 bytes\n\n  MFT Analysis:\n    Total Entries: 456,789\n    Active Files: 234,567\n    Deleted Entries: 12,345 (8,901 with recoverable metadata)\n    Timestomped Files: 23 (SI\u002FFN mismatch detected)\n\n  USN Journal:\n    Records Parsed: 2,345,678\n    Date Range: 2024-01-01 to 2024-01-20\n    File Creations: 45,678\n    File Deletions: 23,456\n    File Renames: 12,345\n\n  Alternate Data Streams:\n    Total ADS Found: 1,234\n    Zone.Identifier: 890 (downloaded files)\n    Custom\u002FSuspicious ADS: 5 (hidden data detected)\n\n  Slack Space:\n    Total Slack: 12.3 GB\n    Keyword Hits: 45 (passwords, credit cards)\n    Carved Files: 23 from slack space\n\n  Suspicious Findings:\n    - 23 files with timestomped timestamps\n    - 5 files with hidden ADS containing data\n    - USN shows mass deletion on 2024-01-18 (anti-forensics)\n    - Slack space contains residual email fragments\n\n  Reports: \u002Fcases\u002Fcase-2024-001\u002Fanalysis\u002F\n```\n",{"name":5,"tags":25,"author":33,"domain":34,"license":15,"version":35,"nist_csf":36,"subdomain":41,"description":7,"mitre_attack":42},[26,27,28,29,30,31,32],"forensics","slack-space","ntfs","mft","usn-journal","alternate-data-streams","file-system-analysis","mahipal","cybersecurity","1.0",[37,38,39,40],"RS.AN-01","RS.AN-03","DE.AE-02","RS.MA-01","digital-forensics",[43,44,45,46,47],"T1070.006","T1564.004","T1070.004","T1005","T1006","main","cd5116e81009ad620d09c7bc8664ce8c37f88a99","09 Research\u002F06 Astronomy & Physics\u002Fanalyzing-slack-space-and-file-system-artifacts",0,"https:\u002F\u002Fgithub.com\u002Fvdcworkshop\u002FSkills-Catalog","https:\u002F\u002Fgithub.com\u002Fvdcworkshop","https:\u002F\u002Fvdcworkshop.com","2026-06-28 03:22:57",{"source":8,"skillName":5,"commands":57,"prompt":67,"zipAvailable":68},[58,61,64],{"tool":59,"command":60},"npx","npx skills add vdcworkshop\u002FSkills-Catalog --skill analyzing-slack-space-and-file-system-artifacts",{"tool":62,"command":63},"bunx","bunx skills add vdcworkshop\u002FSkills-Catalog --skill analyzing-slack-space-and-file-system-artifacts",{"tool":65,"command":66},"pnpm","pnpm dlx skills add vdcworkshop\u002FSkills-Catalog --skill analyzing-slack-space-and-file-system-artifacts","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fvdcworkshop\u002FSkills-Catalog\u002Fblob\u002Fmain\u002F09 Research\u002F06 Astronomy & Physics\u002Fanalyzing-slack-space-and-file-system-artifacts\u002FSKILL.md",true,[70,74,80,84],{"path":71,"resourceType":71,"resourceTypeDesc":72,"sizeBytes":73,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":75,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":78,"sourceHtmlUrl":79},"README.md","REFERENCE","参考文档",949,"https:\u002F\u002Fgithub.com\u002Fvdcworkshop\u002FSkills-Catalog\u002Fblob\u002Fmain\u002F09 Research\u002F06 Astronomy & Physics\u002Fanalyzing-slack-space-and-file-system-artifacts\u002FREADME.md",{"path":81,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":82,"sourceHtmlUrl":83},"references\u002Fapi-reference.md",1933,"https:\u002F\u002Fgithub.com\u002Fvdcworkshop\u002FSkills-Catalog\u002Fblob\u002Fmain\u002F09 Research\u002F06 Astronomy & Physics\u002Fanalyzing-slack-space-and-file-system-artifacts\u002Freferences\u002Fapi-reference.md",{"path":85,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":88,"sourceHtmlUrl":89},"scripts\u002Fagent.py","SCRIPT","脚本",6680,"https:\u002F\u002Fgithub.com\u002Fvdcworkshop\u002FSkills-Catalog\u002Fblob\u002Fmain\u002F09 Research\u002F06 Astronomy & Physics\u002Fanalyzing-slack-space-and-file-system-artifacts\u002Fscripts\u002Fagent.py",[91,99,106,113,120,127],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":95,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":20},"01M77XBV88FMNX83MKDZMXKQZ2","rhaios-staging","Interact with the Rhaios staging REST API for yield operations. Discover -> prepare -> setup-if-needed -> sign -> execute flow with pluggable signer backend. Triggers on requests involving DeFi yield, vault deposits, redeems, rebalancing, or Rhaios API.","MIT","https:\u002F\u002Fgithub.com\u002Fvdcworkshop\u002FSkills-Catalog\u002Fblob\u002Fmain\u002F12 Blockchain\u002F03 DeFi\u002Frhaios-staging\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":95,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":20},"01M77X7AFQGDCFHC25GQ7V92GZ","git-commit-push","Commit and push repository changes safely. Use when user asks to commit, push, or verify and push current changes.","https:\u002F\u002Fgithub.com\u002Fvdcworkshop\u002FSkills-Catalog\u002Fblob\u002Fmain\u002F12 Blockchain\u002F01 Smart Contracts\u002Fgit-commit-push\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":20},"01M77X71FJ1KR7PTBPRC7S2241","exec-slurm-compile","Compile TensorRT-LLM on a SLURM cluster. Covers submitting a batch job with a container image, monitoring the job, and verifying the build. Use when the user wants to compile TRT-LLM remotely via SLURM rather than on a local compute node.","https:\u002F\u002Fgithub.com\u002Fvdcworkshop\u002FSkills-Catalog\u002Fblob\u002Fmain\u002F12 Blockchain\u002F01 Smart Contracts\u002Fexec-slurm-compile\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":95,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":20},"01M77X4BQJ025SPPGRQ96X72QV","databases","Work with MongoDB (document database, BSON documents, aggregation pipelines, Atlas cloud) and PostgreSQL (relational database, SQL queries, psql CLI, pgAdmin). Use when designing database schemas, writing queries and aggregations, optimizing indexes for performance, performing database migrations, configuring replication and sharding, implementing backup and restore strategies, managing database users and permissions, analyzing query performance, or administering production databases.","https:\u002F\u002Fgithub.com\u002Fvdcworkshop\u002FSkills-Catalog\u002Fblob\u002Fmain\u002F11 Databases\u002F03 NoSQL Databases\u002Fdatabases\u002FSKILL.md",[],[],{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":95,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":20},"01M77WZYZGCV9DK5HA0XCWSK97","toast","Toast — restaurant POS, orders, menus, employees, revenue centers, and reporting.","https:\u002F\u002Fgithub.com\u002Fvdcworkshop\u002FSkills-Catalog\u002Fblob\u002Fmain\u002F10 Lifestyle\u002F06 Culinary Arts\u002Ftoast\u002FSKILL.md",[],[],{"skillNo":128,"name":129,"nameZh":6,"description":130,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":95,"licenseFileUrl":6,"sourceHtmlUrl":131,"categories":132,"keywords":133,"publishedAt":20},"01M77WYYESVCXT81ERPHM77SA9","k-schoollunch-menu","Use when the user asks for Korean school meal menus (급식 식단) by natural-language education office and school name, via k-skill-proxy NEIS school-search and school-meal routes.","https:\u002F\u002Fgithub.com\u002Fvdcworkshop\u002FSkills-Catalog\u002Fblob\u002Fmain\u002F10 Lifestyle\u002F06 Culinary Arts\u002Fk-schoollunch-menu\u002FSKILL.md",[],[]]