How a Redis Server Got Hijacked and What You Can Do to Prevent It

This article recounts a Redis server hijacking incident, details the step‑by‑step investigation and remediation process, and offers practical security recommendations to protect Redis deployments on Linux environments.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
How a Redis Server Got Hijacked and What You Can Do to Prevent It

Hijack Incident

A Redis service across development, testing, and production servers suddenly stopped, severely impacting development and online environments, prompting a deep dive into security investigation.

Investigation Steps

Checked Redis services on all servers (dev:251, test:204, prod:164,165); many were not running.

Verified Redis processes using ps -ef | grep redis and confirmed connectivity with Redis Desktop Manager.

Attempted to restart Redis with ./redis-server & after killing the existing process ( kill -9 PID), but the service failed to start.

Discovered a malicious process consuming high CPU via top, suspected to be injected via cron or startup scripts.

Examined crontab entries, removed suspicious tasks, and deleted malicious files such as /var/spool/cron/root, /var/spool/cron/crontabs/root, ~/.ssh/authorized_keys, and temporary files in /tmp.

Downloaded and analyzed pm.sh from the attacker’s site to understand the payload, confirming a mining operation.

Deleted all identified malicious files and Redis dump files ( /tmp/dump.rdb, /usr/local/redis/bin/dump.rdb, /var/spool/cron/dump.rdb), then successfully restarted all Redis services.

Redis process check
Redis process check

Redis Protection Recommendations

Do not use the default port 6379.

Configure a Redis username and password.

Bind Redis to specific IP addresses in redis.conf.

Keep Redis servers off the public internet.

Enable firewall rules (e.g., iptables) to restrict access.

Run Redis inside containers (Docker, etc.) for easier recovery and isolation.

References

CentOS7 installation Redis hijacked by AnXqV mining program.

Alibaba Cloud server mining intrusion solution.

Google infrastructure security design overview (translation and guide).

Dockerized Codis and Pika as Redis alternatives.

Conclusion

Security is paramount; thorough investigation and prioritizing a stable development environment are essential to mitigate and prevent similar incidents.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

redisSecurityinformation securityIntrusion
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.