Getting a MySQL dump file (.sql) during a pentest, red-team exercise, or incident response is usually one of the highest-value moments of the job. Even a 1–5 GB file can be turned into usable usernames + password hashes in under 10 minutes if you know the right patterns to grep for and how to crack the hashes quickly.
Tools (All Free & Lightweight)
1. ripgrep (rg) , way faster than grep on huge files
2. grep (fallback)
3. strings (sometimes useful)
4. Use John the Ripper or Use Hashcat to crack using the GPU
5. Text editor that allows you to edit very large files such as VS Code + large file extension, Sublime Text or just less.
Step-by-step - Actual Commands/Flow
1. Quick Size and Structure Check
ls –lh dump.sql # How much are we working with?
head –n 200 dump.sql | grep –i “create table” # Table Names.
Look for anything that looks like users e.g. users, admin_users, accounts, members,
customers, wp_users, auth_user, user_accounts, sys_users, login, tbl_users,
user_login, etc.
2. Find All Candidate User Tables
rg -i "create table.*(user|admin|account|member|customer|auth|login|tbl_user)" dump.sql
Usually gives 3–15 hits in seconds.
3. Extract INSERT Queries For Targeted Tables
The easiest one to pull is usually Users:
rg -A 1000 "INSERT INTO `users`" dump.sql > users_inserts.sql
Alternatively, you may search for:
rg -i "INSERT INTO.*(user|admin|account|member|customer)" dump.sql > all_user_inserts.sql
4. Extract Username & Password/Hash in the Same Command
Pattern In Dumps That Are Commonly Seen:
INSERT INTO `users` (`id`, `username`, `email`, `password`, `role`) VALUES
(1, 'admin', 'admin@site.com', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'admin');
Command To Extract Quickly:
rg -o "INSERT INTO.*?VALUES\s*\([^)]*'\s*([^']*)'\s*,\s*'[^']*'\s*,\s*'[^']*'\s*,\s*'([^']*)'" all_user_inserts.sql | head -20
Or Some Other Simpler Way Which Extract 2 Quoted Values Close To Where The Word "Password" Is:
rg -i "password|passwd|hash" all_user_inserts.sql | rg -o "'[^']+','[^']+'" | head -30
Typical Output Example:
'admin','$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'
'john.doe','$2y$10$7f8e9d2a1b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t1u2v3w4x'
5. Determine Which Hash Type It Is and Then Immediately Commit To Cracking That Hash
From dump types common for 2026:
1. $2y$10$... + $2a$10$... → bcrypt → hashcat -m 3200
2. $P$Bx... → WordPress bcrypt → Use same hashcat technique as before
3. PBKDF2_SHA256$... → Django → hashcat -m 10000
4. 5f4dcc3b5aa765d61d8327deb882cf99 → raw MD5 → hashcat -m 0
5. All passwords in plaintext → have already been cracked
Extract hashes only:
rg -o '\$2y?\$2a?\$[^\s,]+' all_user_inserts.sql > hashes.txt
# or for MD5:
rg -o '[0-9a-f]{32}' all_user_inserts.sql > md5_hashes.txt
Crack (bcrypt example):
# John
john --format=bcrypt --wordlist=/usr/share/wordlists/rockyou.txt hashes.txt
# hashcat (GPU, much faster)
hashcat -m 3200 -a 0 hashes.txt /usr/share/wordlists/rockyou.txt -O
Real example output after ~20–40 minutes on a decent GPU:
admin:password123!
john.doe:Summer2025
You now have valid credentials.
Quick Tips
1. Wordpress - Always found in wp_users table hashed using bcrypt ($P$...)
2. Laravel - Always found in users table using either bcrypt or Argon2.
3. Old custom PHP apps → sometimes plaintext passwords (yes, still exists)
4. Very large files (>2 GB) → use rg or grep --line-buffered so you don’t wait forever
5. Never edit the original dump , always work on a copy
6. Search also for api_key, token, secret, access_token , they often live in the same tables
A single targeted rg or grep on even a multi-GB dump can give you every username and crackable hash in minutes. It’s one of the highest return-on-time skills in pentesting and incident response.