Exploiting Redis Through Ssrf Attack
The article explains how an SSRF vulnerability can be used to send commands to a Redis instance, which can lead to remote code execution by writing files such as cron jobs or SSH keys, or by injecting a malicious serialized session. The attacker could then execute arbitrary commands on the server.
Published on infosecwriteups.com
Redis is an in-memory data structure store that is used to store data in the form of key-values and can be used as a database, serialized/session storage, cache, and job queue.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the root cause is that the application allows user-controlled URLs to be fetched without proper validation, enabling access to internal services like Redis, which is not designed to be exposed to untrusted input.
Impact
An attacker could achieve remote code execution on the server hosting Redis, potentially leading to full system compromise.
What the attacker needed
SSRF vulnerability in the application; Redis instance accessible from the vulnerable server; Redis running with sufficient privileges to write files
The fix
The application should validate and restrict user-supplied URLs to prevent SSRF, and Redis should be configured with authentication and not exposed to untrusted networks.
How it was found
- Set up the lab environment using Docker Compose.
- Generate a payload with the provided Python script for the desired attack (cron, SSH, or pickle).
- Submit the generated gopher URL to the SSRF lab web interface.
- For cron: the payload writes a crontab file that executes a reverse shell.
- For SSH: the payload writes an SSH public key to authorized_keys, allowing login.
- For pickle: the payload overwrites a session value with a malicious serialized object, leading to code execution when deserialized.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
This is a tutorial about a common security weakness called SSRF (Server-Side Request Forgery), where an attacker tricks a server into making requests to internal services. The article shows how to use that to talk to Redis, a fast database often used for caching, and then abuse Redis features to run commands on the server. It is not a report of a specific bug but a general explanation with lab examples.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.