Study guide
17.1 MySQL Forensics: Internal Architecture, Data Directory, Information Schema & Utility Programs
Computer Hacking Forensic Investigator CHFI 312-49
Track your progress as you read
Finished sections get a check mark.
1 Chapter 1: Foundations of Digital Forensics & Cybercrime Investigation
1.1 Cybercrime Classifications, Forensic Science Principles & Legal Admissibility 1.2 RFC 3227 Order of Volatility, Live vs. Dead Acquisition & Forensic Readiness 1.3 Indicators of Compromise (IoCs), Cyber Attribution & Threat Intelligence 1.4 AI-Assisted Forensics, GitOps, Automation/Orchestration & Forensics-as-a-Service (FaaS)
2 Chapter 2: Modern Forensic Environments & Emerging Threats
2.1 Fileless Malware, In-Memory Execution & Living-off-the-Land (LotL) 2.2 IoT & Operational Technology (OT/SCADA) Forensic Fundamentals 2.3 Dark Web, Tor Network, Onion Routing & Hidden Services Forensics 2.4 Blockchain Transactions, Cryptocurrency Tracing & Digital Asset Investigations
3 Chapter 3: Legal Frameworks, Search Warrants & Evidence Rules
3.1 Federal Rules of Evidence (FRE 702, 901, 902, 1001-1003) & Daubert/Frye Standards 3.2 Fourth Amendment, Warrant Exceptions, Workplace Search & Consent Protocols 3.3 International Standards: ISO/IEC 27037, ACPO Principles & ENFSI Guidelines 3.4 Cybercrime Statutes, Privacy Compliance, CAN-SPAM & International Cooperation
4 Chapter 4: eDiscovery, Chain of Custody & Professional Ethics
4.1 Electronic Discovery Reference Model (EDRM) & Legal Spoliation Holds 4.2 Chain of Custody Documentation, Evidence Packaging & Tamper-Evident Handling 4.3 Expert Witness Testimony, Report Writing Standards & EC-Council Code of Ethics
5 Chapter 5: Storage Architecture, Boot Sequences & Media Forensics
5.1 Storage Media Architecture: Sectors, Clusters, RAM/File Slack & Unallocated Space 5.2 Partition Tables & Boot Structures: MBR, GPT, VBR, BIOS vs. UEFI Secure Boot 5.3 RAID Reconstruction (RAID 0, 1, 5, 6, 10) & SSD Forensic Challenges (TRIM, Wear Leveling)
6 Chapter 6: Windows File Systems: NTFS & FAT
6.1 NTFS Architecture: Master File Table ($MFT) Record Structure & Attribute Headers 6.2 NTFS Artifacts: Alternate Data Streams (ADS), Volume Shadow Copies (VSS) & $LogFile 6.3 FAT12/16/32 and exFAT Architecture, Directory Entries & File Deletion Mechanics
7 Chapter 7: Non-Windows File Systems & File Signatures
7.1 Linux File Systems: ext2/ext3/ext4 Inode Architecture, Superblocks & Journaling Forensics 7.2 macOS File Systems: HFS+ and Apple File System (APFS) Architecture & Snapshots 7.3 File Signatures, Magic Bytes, Hex Headers/Footers & File Carving Techniques
8 Chapter 8: Investigation Lifecycle, Lab Setup & First Response
8.1 Forensic Laboratory Accreditation: ISO/IEC 17025 Standards & Hardware/Software Controls 8.2 First Responder Duties: Crime Scene Containment, Electronic Triage & Volatile Triage 8.3 Physical Evidence Packaging, Anti-Static/Faraday Protection & Transport Security
9 Chapter 9: Forensic Acquisition & Verification Methodology
9.1 Hardware and Software Write-Blockers: Operational Validation & Bridge Verification 9.2 Bit-Stream Disk Imaging, Physical vs. Logical vs. Targeted Acquisition Methodology 9.3 Forensic Image Formats (RAW/DD, E01, AFF) & Cryptographic Hashing Verification (MD5, SHA-256)
10 Chapter 10: Anti-Forensics Techniques & Countermeasures
10.1 Steganography Detection: Spatial/Frequency Domain Steganalysis & Hidden Carrier Extraction 10.2 Timestomping Countermeasures: Comparing $STANDARD_INFORMATION vs $FILE_NAME Timestamps 10.3 Secure Wiping, Degaussing, File Shredding Countermeasures & Residual Artifact Recovery
11 Chapter 11: Windows Operating System Forensics
11.1 Windows Registry Forensics: SYSTEM, SOFTWARE, SAM & NTUSER.DAT Hive Analysis 11.2 Execution Artifacts: Prefetch (.pf), Shimcache (AppCompatCache), Amcache.hve & UserAssist 11.3 User Activity Artifacts: ShellBags, LNK Shortcut Files, Jump Lists & Recycle Bin ($I/$R) 11.4 Windows Event Log Forensics: Security Audit IDs (4624, 4625, 4688, 4720, 7045) & EVTX Parsing
12 Chapter 12: Memory Forensics & Malware Analysis
12.1 Volatile Memory Acquisition: RAM Capture, Crash Dumps, Hiberfil.sys & Pagefile.sys 12.2 Memory Analysis with Volatility 3: pslist, pstree, malfind, netscan & Vadinfo 12.3 Static Malware Triage: Strings, PE Headers, Import Tables, Hashes & YARA Rule Matching 12.4 Dynamic Malware Analysis: Sandboxing, Process Monitor (Procmon), Regshot & Network Callouts 12.5 .NET Managed Malware Analysis & the GOOTLOADER Fileless Infection Chain
13 Chapter 13: Network, Web Application & Email Forensics
13.1 Network Forensics: PCAP Analysis, Protocol Dissection, Snort/Suricata & Flow Analysis 13.2 Web Server Forensics: Apache/IIS Access Logs, SQL Injection, XSS & Web Shell Detection 13.3 Email Forensics: RFC 5322 Headers, Authentication (SPF, DKIM, DMARC) & Mbox/PST Extraction 13.4 SIEM Event Correlation, Cross-Source Timeline Analysis & Super-Timeline Construction 13.5 Investigating Directory Traversal, Command Injection, Parameter Tampering, XXE, Cookie Poisoning & Brute Force 13.6 Network Device & Service Log Forensics: Firewall, IDS, Honeypot, Router, DHCP, Switch, VPN, DNS & SSH 13.7 Wireless Network Forensics: Rogue APs, Evil Twins, MAC Spoofing, Deauthentication & Jamming
14 Chapter 14: Mobile, Cloud & IoT Forensics
14.1 Mobile Device Forensics: Manual, Logical, File System & Physical Extraction (Android/iOS) 14.2 Mobile Artifact Analysis: Call Logs, SMS/Chat SQLite Databases, Location Data & Plists 14.3 Cloud Forensics: AWS CloudTrail, Azure Activity Logs & Multi-Tenant Evidence Collection 14.4 IoT Forensics: UART/JTAG Physical Interfaces, Firmware Extraction & Sensor Telemetry
15 Chapter 15: Commercial & Open-Source Forensic Suites
15.1 Commercial Forensic Platforms: EnCase Forensic, FTK (Forensic Toolkit) & FTK Imager 15.2 Open-Source Forensic Platforms: Autopsy, The Sleuth Kit (TSK) & SIFT/CAINE Workstations 15.3 Specialized DFIR Utilities: Eric Zimmerman Tools (EZ Tools) & Sysinternals Forensic Suite
16 Chapter 16: Analysis Toolkits, Python Scripting & Tool Validation
16.1 Reverse Engineering & Password Cracking: Ghidra, IDA Pro, Hashcat & John the Ripper 16.2 Python for Digital Forensics: Parsing Raw Artifacts, Custom Scapy Scripts & Evidence Automation 16.3 Forensic Tool Testing & Validation: NIST CFTT Methodology, ISO/IEC 17025 Standards & Daubert Compliance
17 Chapter 17: Database Forensics & Web Application Firewalls
17.1 MySQL Forensics: Internal Architecture, Data Directory, Information Schema & Utility Programs 17.2 SQL Server Forensics: SSMS, ApexSQL, SQLCMD Transaction-Log Collection, Plan Cache & Trace Files 17.3 Web Application Firewall (WAF) Architecture, Audit Logs, Benefits & Limitations
18 Chapter 18: Social, Virtualized, Multimedia & Browser Investigations
18.1 Social Media, Social Engineering, Insider Threat & Identity Theft Forensics 18.2 Virtualization, Container & Microservices Forensics, Bluetooth and Electron Chat Applications 18.3 Multimedia Forensics: Image, Audio & Video Authentication, EXIF, PRNU and Deepfake Detection 18.4 Browser Artifact Recovery, Private Browsing, USB Enumeration, Partition Recovery & Packer Unpacking Tools
17.1 MySQL Forensics: Internal Architecture, Data Directory, Information Schema & Utility Programs
Key Takeaways Explain This Topic AI
The MySQL data directory defaults to /var/lib/mysql on Linux and C:\ProgramData\MySQL\MySQL Server 8.0\Data on Windows, and its exact path is resolved from the datadir system variable rather than assumed.
InnoDB stores each table in its own tablespace file named table_name.ibd, while ibdata1 holds the shared system tablespace; undo tablespaces were moved out of ibdata1 into separate undo_001 and undo_002 files in MySQL 8.0.
The binary log records every data-modifying statement or row change and is the single richest MySQL forensic artifact; mysqlbinlog renders it readable, and the file header magic number is 0xFE62696E for unencrypted and 0xFD62696E for encrypted binary logs.
MySQL 8.0 eliminated the per-table .frm definition files by moving the data dictionary into the InnoDB mysql.ibd tablespace, so schema history is no longer recoverable from loose files on disk.
The INFORMATION_SCHEMA views expose table, column, privilege, and routine metadata, including CREATE_TIME and UPDATE_TIME values that date schema tampering and rogue account creation.
Last updated: September 2026
17.1 MySQL Forensics: Internal Architecture, Data Directory, Information Schema & Utility Programs
Quick Answer: Blueprint Domain 3 requires the internal architecture of MySQL , the structure of the data directory , data storage in SQL Server and MySQL , database evidence repositories , MySQL forensics , viewing the Information Schema , and MySQL utility programs for forensic analysis ; Domain 5 adds MySQL forensics for a WordPress website database . The data directory ( datadir , typically /var/lib/mysql ) holds one .ibd tablespace per table , the shared ibdata1 system tablespace, and the binary log — which is the highest-value artifact because it records every data-modifying operation with a timestamp and server ID.
MySQL Server Architecture in Forensic Terms
MySQL separates a server layer (connection handling, parser, optimizer, query cache in older versions) from a pluggable storage engine layer . For forensics, the storage engine determines where the bytes are :
Engine On-disk layout Forensic implication
InnoDB (default since 5.5) table.ibd per table, plus shared ibdata1 ; ACID with redo/undo logs Deleted rows often survive in pages until reorganization; undo and redo logs hold pre-images
- MyISAM (legacy) table.MYD (data), table.MYI (index), table.frm Simple carving target; no transaction log
- MEMORY RAM only Content exists only in a memory image — lost on service restart
- CSV / ARCHIVE Plain or compressed flat files Directly readable without the server
Important
Never trust a default path. Resolve the real one from the running server or the configuration file: SELECT @@datadir, @@log_bin_basename, @@general_log_file, @@slow_query_log_file, @@version; On Linux the configuration is /etc/my.cnf or /etc/mysql/my.cnf ; on Windows it is my.ini beside the install. Document the values in the case notes — a relocated datadir on a separate volume is common and easy to miss when imaging.
Structure of the Data Directory
- Object Purpose
- <dbname>/ One subdirectory per database (a "schema")
- <table>.ibd Per-table InnoDB tablespace: data pages plus indexes (default since 5.6)
- ibdata1 Shared system tablespace: change buffer, doublewrite buffer (pre-8.0.20), internal dictionary data
- mysql.ibd MySQL 8.0 data dictionary — the schema catalog that replaced per-table .frm files
- undo_001 , undo_002 Undo tablespaces, separated out of ibdata1 in MySQL 8.0
- ib_logfile0/1 , or #innodb_redo/ (8.0.30+) Redo log — physical page changes for crash recovery
- binlog.000001 , binlog.index Binary log and its index
- <host>.err Error log: startup, shutdown, crashes, aborted connections
- <host>-slow.log Slow query log
- <host>.pid , mysql.sock Runtime artifacts (presence indicates the server was running at acquisition)
- *.pem Server TLS key material
MySQL 8.0 changed schema forensics. In 5.x, every table had a readable .frm definition file, so an examiner could reconstruct dropped tables' structure from loose files. In 8.0 the dictionary moved into mysql.ibd , so a dropped table's definition disappears from the filesystem and must instead be recovered from the binary log's DDL statements or from a backup.
- The Logs, Ranked by Forensic Value
- 1. Binary Log — the Transaction Ledger
The binary log records every statement or row change that modified data, with timestamps, server ID, thread ID, and (in ROW format) the complete before-and-after image of each changed row. # Render a binary log as readable SQL with timestamps
mysqlbinlog --base64-output=DECODE-ROWS --verbose binlog.000017 > /evidence/binlog17.sql
# Constrain to the incident window
mysqlbinlog --start-datetime="2026-09-14 02:00:00" --stop-datetime="2026-09-14 06:00:00" --base64-output=DECODE-ROWS --verbose binlog.0000*
- binlog_format What is recorded Forensic value
- STATEMENT The literal SQL text Shows attacker syntax; non-deterministic statements may not replay identically
ROW (default in 8.0) Per-row before/after images Recovers deleted row contents even when the table was truncated
MIXED Statement, switching to row where unsafe Hybrid
File header magic number: unencrypted binary logs begin with FE 62 69 6E ( 0xFE + bin ); encrypted binary logs begin with FD 62 69 6E . That one byte tells the examiner immediately whether the log can be parsed directly or requires the server's keyring.
2. General Query Log — Everything, When Enabled
Records every statement received, including SELECT , plus connect and disconnect events with the client host. It is usually off in production for performance reasons, but when an attacker enables it, or when a security-conscious deployment leaves it on, it is the closest thing to a database keylogger.
3. Slow Query Log
Captures statements exceeding long_query_time . Mass-extraction queries — an unbounded SELECT * FROM wp_users or a blind-SQLi timing payload using SLEEP() or BENCHMARK() — are slow by nature, so this log frequently captures injection activity that no other log retained.
4. Error Log
Startup and shutdown times (which bracket periods where the server could not have been altered through SQL), crashes, Access denied failures, and aborted connections. A sudden restart immediately after a compromise often marks the attacker loading a plugin or a UDF.
Viewing the Information Schema
INFORMATION_SCHEMA is a set of read-only views over the data dictionary. These queries are the standard forensic sweep of a live or restored instance: -- Schema inventory with creation and last-update times
- SELECT TABLE_SCHEMA, TABLE_NAME, ENGINE, TABLE_ROWS, CREATE_TIME, UPDATE_TIME
- FROM INFORMATION_SCHEMA.TABLES
- WHERE TABLE_SCHEMA NOT IN ('mysql','information_schema','performance_schema','sys')
- ORDER BY CREATE_TIME DESC;
- - Accounts and their hosts, including anonymous or wildcard-host accounts
- SELECT user, host, plugin, account_locked, password_last_changed FROM mysql.user;
- - Who holds dangerous global privileges
- SELECT GRANTEE, PRIVILEGE_TYPE FROM INFORMATION_SCHEMA.USER_PRIVILEGES
- WHERE PRIVILEGE_TYPE IN ('SUPER','FILE','PROCESS','GRANT OPTION','CREATE USER');
- - Stored routines and triggers, a classic persistence hiding place
- SELECT ROUTINE_SCHEMA, ROUTINE_NAME, CREATED, LAST_ALTERED, ROUTINE_DEFINITION
- FROM INFORMATION_SCHEMA.ROUTINES ORDER BY LAST_ALTERED DESC;
- SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_OBJECT_TABLE, ACTION_STATEMENT, CREATED
- FROM INFORMATION_SCHEMA.TRIGGERS;
CREATE_TIME on a table created during the intrusion window, a mysql.user row with host = '%' , a FILE -privileged account, or a trigger that re-creates a backdoor row whenever it is deleted are all findings these queries surface directly.
Warning
FILE privilege is the pivot from database compromise to host compromise. It enables SELECT ... INTO OUTFILE to write a web shell into the document root and LOAD_FILE() to read /etc/passwd . Any account holding FILE that should not, and any INTO OUTFILE statement in the binary or general query log, is a server-compromise indicator, not merely a database one.
MySQL Utility Programs for Forensic Analysis
- Utility Forensic use
- mysqlbinlog Render binary logs as timestamped SQL; the primary reconstruction tool
- mysqldump Produce a logical, text-diffable snapshot of schema and data from a restored copy
- mysqlcheck Check and report table corruption without repairing (use --check only; never --repair on evidence)
- myisamchk Low-level MyISAM table inspection
- mysqladmin status , processlist , variables — live state capture including active connections
- ibd2sdi Extract serialized dictionary information from an .ibd file (8.0) to recover table structure
- innochecksum Verify InnoDB page checksums offline — detects direct tampering with tablespace files
- strings / hex editor Carve readable row fragments and deleted records directly from .ibd pages
- Worked Scenario: WordPress Database Compromise
WordPress is the blueprint's named case because it is the most common real-world MySQL victim.
Tables that matter: wp_users (login, user_pass as a phpass/bcrypt hash, user_email , user_registered ), wp_usermeta (holds wp_capabilities , which is what actually grants the administrator role), wp_options ( siteurl , home , active_plugins , plus _transient_ rows attackers abuse for payload storage), wp_posts (injected spam or SEO-poisoning content), and wp_comments .
Investigation sequence:
Acquire the data directory from a forensic image , not by querying the live compromised host, and hash every file.
Run INFORMATION_SCHEMA.TABLES ordered by CREATE_TIME and UPDATE_TIME — an administrator account inserted during the intrusion window shows as a recent wp_users update.
Parse the binary log across the window with mysqlbinlog --base64-output=DECODE-ROWS --verbose and search for INSERT INTO wp_users , UPDATE wp_usermeta ... wp_capabilities , and UPDATE wp_options targeting siteurl or active_plugins .
Check wp_usermeta for a wp_capabilities value of a:1:{s:13:"administrator";b:1;} on an account whose user_registered timestamp falls inside the window — the standard privilege-escalation artifact.
Search wp_options and wp_posts for Base64 or hex-encoded blobs, eval( , and injected <script> or hidden-link markup — the SEO-poisoning payload described in the GOOTLOADER chain.
Correlate each database timestamp to the Apache/IIS access log to identify the request that carried the injection, and to the filesystem for a web shell dropped via INTO OUTFILE .
MySQL timestamp caution: TIMESTAMP columns are stored in UTC and converted to the session time_zone on read, while DATETIME columns are stored literally with no zone conversion. Record SELECT @@global.time_zone, @@session.time_zone at acquisition, or the reconstructed timeline will be wrong by the offset.