ISC Stormcast For Wednesday, February 28th 2018

How did this Memcache thing happen?

Published: 2018-02-28
Last Updated: 2018-02-28 03:18:55 UTC
by Kevin Liston (Version: 1)
5 comment(s)

As pointed out earlier ( this memcached reflected DDoS thing is pretty bad.  How bad?  Well, US-CERT updated its UDP-Based Amplification Attacks advistory ( to add Memcache to the list of potential attack vectors.  The really telling bit is the chart that shows the Bandwidth Amplification Factor.  Before memcache was added the largest factor was 556.9 from NTP where each byte sent in to a vulnerable server would return about 557 bytes in attack traffic.  Memecache is listed as 10,000 to 51,000.  That's remarkably large.

How common is an internet-facing memcache daemon?  I did a little poking with Shodan ( and it had identified 100k or so systems.  Mostly in cloud provider spaces as you would expect.

So how did this happen?  I don't know much about memcache myself, so I think that makes me particulary qualified to take a stab at the answer.  Since I don't know what it is, or how to install it, I turn to google to help me out.  Buried in the wiki for memcached ( under the networking section one might read:

"By default memcached listens on TCP and UDP ports, both 11211. -l allows you to bind to specific interfaces or IP addresses. Memcached does not spend much, if any, effort in ensuring its defensibility from random internet connections. So you must not expose memcached directly to the internet, or otherwise any untrusted users. Using SASL authentication here helps, but should not be totally trusted."

But who has time for instructions, right?  What's Google tell me to do?  The top answer gives us:

Change the memcached configuration setting for CACHESIZE and -l :

  1. Open /etc/memcached.conf in a text editor.
  2. Locate the -m parameter.
  3. Change its value to at least 1GB.
  4. Locate the -l parameter.
  5. Change its value to or localhost.
  6. Save your changes to memcached.conf and exit the text editor.
  7. Restart memcached. 


Hey, that looks right.  What about Digital Ocean's instructions (they have a lot of these open)?

It has this as how it's started:

/usr/bin/memcached -m 64 -p 11211 -u memcache -l

That looks fine too.  So it's not a rash of bad instructions on the Internet.

Okay, how about stackoverflow/serverfault?  In the top question about memcache ( we find an illuminating answer:

"The -l option regulates to which interfaces memcached will listen to, not which hosts will be served."

I wonder how many web-admins thought they needed to open up access to all of their clients. 

Keywords: memcached
5 comment(s)


Diary Archives