Memcached Bulk Cache Dump and Exfiltration
After confirming unauthenticated access and identifying high-value keys, the next step is capturing the full cache contents for offline analysis and evidence. This covers extracting all keys and values, staging the output, and transferring it off the target network.
Estimate Cache Size Before Dumping
Check the total data volume before committing to a full dump:
STAT curr_items 2841 STAT bytes 18432910
bytes is the raw cache size in bytes. 18MB is fast to dump and transfer. Caches above a few hundred MB may warrant selective extraction rather than a full dump.
Dump All Keys with lru_crawler metadump
lru_crawler metadump returns all keys across all slabs in a single command and is the fastest way to get a complete key list:
Check the key count:
Extract just the key names for the next step:
If the target runs Memcached below 1.4.31, fall back to per-slab cachedump:
Retrieve All Values
Pull the value for every key and write to a single output file:
For large key counts this loop can be slow due to one TCP connection per key. Batch multiple keys per request to speed it up:
This sends 10 keys per request. Adjust the number of - arguments to change batch size. Memcached accepts multiple keys in a single get command.
Combine and Compress
Merge the key metadata and values into a single archive:
Check compressed size before transferring:
Transfer Off the Target Network
If you are running commands from your own machine directly against the target, the files are already local. If you are operating through a pivot host, transfer the archive to your machine:
If SCP is not available, serve the file over HTTP from the pivot:
Then retrieve it from your machine:
Parse and Triage the Dump Offline
Once the dump is on your machine, search for high-value content:
Extract all JSON values for structured review:
Decode any base64 payloads found in values:
Clean Up
Remove staging files after transfer:
References
-
Memcached — Protocol Commandsgithub.com/memcached/memcached/wiki/Commands (opens in new tab)
Full text protocol reference including lru_crawler metadump and batch get
Was this helpful?
Your feedback helps improve this page.