Memcache Commands
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
![](https://book.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2Fpentest.eu%2FRENDER_WebSec_10fps_21sec_9MB_29042024.gif&width=768&dpr=4&quality=100&sign=bc0743d1&sv=1)
Commands Cheat-Sheet
From https://lzone.de/cheat-sheet/memcached
The supported commands (the official ones and some unofficial) are documented in the doc/protocol.txt document.
Sadly the syntax description isn’t really clear and a simple help command listing the existing commands would be much better. Here is an overview of the commands you can find in the source (as of 19.08.2016):
Command | Description | Example |
---|---|---|
get | Reads a value |
|
set | Set a key unconditionally |
|
add | Add a new key |
|
replace | Overwrite existing key |
|
append | Append data to existing key |
|
prepend | Prepend data to existing key |
|
incr | Increments numerical key value by given number |
|
decr | Decrements numerical key value by given number |
|
delete | Deletes an existing key |
|
flush_all | Invalidate all items immediately |
|
flush_all | Invalidate all items in n seconds |
|
stats | Prints general statistics |
|
Prints memory statistics |
| |
Print higher level allocation statistics |
| |
Print info on items |
| |
| ||
| ||
Resets statistics counters |
| |
lru_crawler metadump | Dump (most of) the metadata for (all of) the items in the cache |
|
version | Prints server version. |
|
verbosity | Increases log level |
|
quit | Terminate session |
|
Traffic Statistics
You can query the current traffic statistics using the command
You will get a listing which serves the number of connections, bytes in/out and much more.
Example Output:
Memory Statistics
You can query the current memory statistics using
Example Output:
If you are unsure if you have enough memory for your memcached instance always look out for the “evictions” counters given by the “stats” command. If you have enough memory for the instance the “evictions” counter should be 0 or at least not increasing.
Which Keys Are Used?
There is no builtin function to directly determine the current set of keys. However you can use the
command to determine how many keys do exist.
This at least helps to see if any keys are used. To dump the key names from a PHP script that already does the memcache access you can use the PHP code from 100days.de.
![](https://book.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2Fpentest.eu%2FRENDER_WebSec_10fps_21sec_9MB_29042024.gif&width=768&dpr=4&quality=100&sign=bc0743d1&sv=1)
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
Last updated