Memcache - Port 11211
Become VeryLazyTech member! π
Follow us on:
β Twitter @VeryLazyTech.
πΎ Github @VeryLazyTech.
π Medium @VeryLazyTech.
πΊ YouTube @VeryLazyTech.
π© Telegram @VeryLazyTech.
π΅οΈββοΈ My Site @VeryLazyTech.
Visit our shop for e-books and courses. π
Basic info
What is Memcached?
Memcached is an in-memory key-value store that provides:
High-speed caching - Microsecond latency
Distributed architecture - Multiple servers
Simple protocol - Text-based commands
LRU eviction - Least Recently Used
No persistence - Pure RAM cache
Horizontal scalability - Add nodes easily
Architecture
Default Port
Port 11211 - Memcached
Additional Protocols:
TCP (default)
UDP (optional, dangerous for DDoS)
Reconnaissance & Enumeration
Port Scanning
Basic Nmap Scan
Sample Output:
Banner Grabbing
Using Netcat
Using Telnet
Service Fingerprinting
Version Detection
Statistics Gathering
Shodan Queries
Authentication Testing
Check Authentication
SASL Authentication (Rare)
Default Behavior
SASL Brute Force (If Enabled)
Data Enumeration & Exfiltration
Understanding Slabs
What are Slabs?
Memcached organizes memory into slabs of different chunk sizes:
Active slabs: Those currently storing data
Enumerate Items
List Items per Slab
Dump Keys (Pre-1.4.31)
Stats Cachedump Method
Complete Enumeration Script
Dump Keys (1.4.31+)
LRU Crawler Method (Recommended)
Extract Just Key Names
Retrieve Cached Data
Get Values by Key
Complete Data Exfiltration
Using libmemcached Tools
Install Tools
memcstat - Statistics
memcdump - Dump Keys
memccat - Get Values
Complete Workflow
Memcached Commands Reference
Storage Commands
SET - Store Value
ADD - Add New Key
REPLACE - Replace Existing
APPEND - Append Data
PREPEND - Prepend Data
Retrieval Commands
GET - Retrieve Value
GETS - Get with CAS
Modification Commands
INCR - Increment
DECR - Decrement
DELETE - Remove Key
FLUSH_ALL - Clear Cache
Statistics Commands
STATS - General Statistics
STATS SLABS - Memory Info
STATS ITEMS - Item Statistics
STATS SIZES - Size Distribution
STATS SETTINGS - Configuration
Administrative Commands
VERSION - Get Version
VERBOSITY - Log Level
QUIT - Close Connection
Exploitation Techniques
Session Hijacking
Enumerate Sessions
Steal Session Tokens
Session Injection
Cache Poisoning
Poison Application Cache
XSS via Cache Poisoning
Data Exfiltration
Extract Sensitive Data
Denial of Service
Flush All Cache
Memory Exhaustion
UDP Amplification DDoS
Check UDP Support
Amplification Attack (For Testing Only)
Post-Exploitation
Persistence
Inject Backdoor Sessions
Monitor Cache for Credentials
Lateral Movement
Extract Database Credentials
Extract API Keys
Defense & Hardening
Enable Authentication (SASL)
Compile with SASL Support
Configure SASL
Client Authentication
Network Security
Bind to Localhost
Firewall Rules
Disable UDP Completely
Resource Limits
Set Memory Limit
Connection Limits
Monitoring & Detection
Enable Verbose Logging
Monitor Connections
Log Analysis
Intrusion Detection
Application-Level Security
Encrypt Sensitive Data
Use Namespaces
Tools & Scripts
Essential Tools
netcat/telnet - Manual interaction
nmap - Discovery and scanning
libmemcached-tools - Official tools
Metasploit - Automated exploitation
Custom scripts - Python/Bash automation
Metasploit Modules
Python Automation Script
Cheat Sheet
Quick Reference
Important Commands
Additional Resources
Last updated