Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Security and hardening

Redis logs a possible security attack from POST or Host commands

ErrorPossible SECURITY ATTACK detected. It looks like somebody is sending POST or Host: commands to Redis.

Short answer

Redis writes this warning when a client sends text that looks like an HTTP request (POST or Host:) to its port. It closes that connection. A browser or scanner is talking to Redis, so the port is reachable by something it should not be. Find the source address, bind Redis to loopback, firewall the port and require authentication.

  • Applies to Redis 7, Redis 8, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Find who is connected to the port and which address Redis listens on.

    sudo ss -tnp '( sport = :6379 )'
    redis-cli CONFIG GET bind
    redis-cli CONFIG GET protected-mode
  2. 2Match what you see, then jump to its fix

    1. 1ss shows a listener on 0.0.0.0 or a public IP, and the log names a remote address.Redis is reachable from the networkFix
    2. 2redis-cli from a machine you do not control returns PONG without AUTH, and ACL LIST shows the default user with nopass.No password, so the default user accepts anyoneFix
    3. 3The log shows an address of your own app server, office or monitoring tool, a single time.A browser or tool is simply pointed at the Redis portFix

What does the error look like?

  • Possible SECURITY ATTACK detected. It looks like somebody is sending POST or Host: commands to Redis.

Cause 1 of 3

Redis is reachable from the network

1Check

Redis is meant for trusted clients in trusted networks. If its port is open to the internet, anyone can send it anything, including FLUSHALL.

redis-cli CONFIG GET bind
sudo ss -ltn '( sport = :6379 )'

2Fix

Bind Redis to the loopback interface (or the one private address the app needs) in redis.conf, restart it, and block the port in the firewall.

# redis.conf
bind 127.0.0.1
# firewall (ufw)
sudo ufw deny 6379/tcp

3Verify

From another machine the port no longer answers.

nc -vz your-server-ip 6379

Confirmed by redis.io

Did this fix it?

Cause 2 of 3

No password, so the default user accepts anyone

1Check

A fresh instance has a default user that is on, with no password and access to everything.

redis-cli ACL LIST

2Fix

Give the default user a strong password with ACL, or define a dedicated user for the app. Then put the same password into the app's connection string.

redis-cli ACL GENPASS
redis-cli ACL SETUSER default on '>PASTE_THE_GENERATED_PASSWORD' '~*' '&*' '+@all'

3Verify

An unauthenticated command is now refused.

redis-cli ping

Confirmed by redis.io

Did this fix it?

Cause 3 of 3

A browser or tool is simply pointed at the Redis port

1Check

Someone typed http://host:6379 in a browser, or a health check or reverse proxy uses HTTP against the wrong port. Redis rejects it and logs the warning.

sudo grep -R '6379' /etc/nginx /etc/haproxy 2>/dev/null

2Fix

Point the HTTP client at the web port. A Redis health check must speak the Redis protocol, for example redis-cli ping.

redis-cli -h 127.0.0.1 ping

3Verify

The warning stops appearing for that address.

sudo tail -n 20 /var/log/redis/redis-server.log

Confirmed by redis.io

Did this fix it?

How do I stop it coming back?

  • Keep protected mode on and bind to loopback unless a private address is needed.
  • Allow port 6379 only from your application servers in the firewall.
  • Use ACL users with narrow command lists instead of one shared full-access password.
  • Run Redis as an unprivileged user, never as root.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.