Shiro 红队漏洞挖掘神器 VS Shiro 蓝队反序列化数据包解密神器

admin 2022年5月5日02:09:08评论875 views字数 4246阅读14分9秒阅读模式

Shiro 红队漏洞挖掘神器 VS Shiro 蓝队反序列化数据包解密神器

Shiro 红队漏洞挖掘神器 VS Shiro 蓝队反序列化数据包解密神器


Shiro 红队漏洞挖掘神器

不知道大家批量shiro的时候,会不会很慢,也不能批量。鄙人写的这个经过测试,可以批量全网,有不足之处,还请师傅们轻喷。

———铁皮石斛,白术

Shiro 红队漏洞挖掘神器 VS Shiro 蓝队反序列化数据包解密神器

image-20220504225557929

Shiro 红队漏洞挖掘神器 VS Shiro 蓝队反序列化数据包解密神器

image-20220504225634964

用法

ShiroKeyCheck.exe -f urls.txt

可选参数:

-ua User-Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36-m 发送请求的方式 GET/POST-content 以 POST 方式发送的内容(-m POST时有效)-timeout 每个请求的超时时间 3-interval 请求之间间隔的时间 0-proxy HTTP代理如 http://127.0.0.1:8080-key 指定需要检测的KEY-t 并发数量 50-k 标签指定keys文件

优点

单个目标爆破时间短,多目标并发检测平均速度更快检测准确率高内置大量已公开KEY且可自行拓展

关键代码

main.go
func KeyCheck(TargetUrl string) (bool, string) {
Content, _ := base64.StdEncoding.DecodeString(CheckContent)
isFind, Result := false, ""
if SKey != "" {
time.Sleep(time.Duration(Interval) * time.Second)
isFind, Result = FindTheKey(SKey, Content, TargetUrl)
} else {
isFind = false
for i := range ShiroKeys { // 遍历Key列表
time.Sleep(time.Duration(Interval) * time.Second)
isFind, Result = FindTheKey(ShiroKeys[i], Content, TargetUrl)
if isFind {
break // 找到任意Key既返回结果
}
}
}
return isFind, Result
}
f, err := os.Open(UrlFile)
if err != nil {
panic(err)
}
defer f.Close()
rd := bufio.NewReader(f)
startTime := time.Now()
for {
UnFormatted, _, err := rd.ReadLine() // 逐行读取目标
if err == io.EOF {
break
}
TargetUrl := string(UnFormatted)
if !strings.Contains(TargetUrl, "http://") && !strings.Contains(TargetUrl, "https://") {
TargetUrl = "https://" + TargetUrl
}
wg.Add(1)
pool.Submit(func() { // 提交并发爆破任务
StartTask(string(TargetUrl))
wg.Done()
})
}
wg.Wait()
functions.go
if strings.ToUpper(Method) == "POST" {
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
}
req.Header.Set("User-Agent", UserAgent)
req.Header.Set("Cookie", "rememberMe="+RememberMe) // 设置请求头
return !strings.Contains(SetCookieAll, "rememberMe=deleteMe;"), nil // 检测是否包含"deleteMe"

开源地址

https://github.com/Peony2022/shiro_killer

https://github.com/Peony2022/shiro_killer/releases

Shiro 蓝队反序列化数据包解密神器

这个小工具的编写源于一个HW蓝队项目,我曾经作为蓝队人员值守了2周,期间发现很多蓝队人员对于反序列化系列漏洞原理不清楚,导致对设备告警的各种反序列化攻击不能有效地研判,也就是说不能底气十足地告诉客户,这个告警是设备误报、是扫描行为、是攻击行为、还是Web应用的用户正常行为。于是在这个项目中,我就慢慢变成了一个攻击流量研判的角色了,帮助客户对这些设备的告警进行研判。

——— abc123info

难点

1. 攻击行为全过程都是流量加密的,单看数据包看不出啥来,就是一堆脏数据。当时的监控设备只要是数据包出现了rememberMe字段,就会告警,这显然是不准确的。而且告警设备只会把数据包贴出来,都是加密的没法查看。

2. 即便解密出明文数据包,很多蓝队工作人员并不了解java反序列化漏洞,辨别不出明文数据包里是正常的Java类,还是攻击者所用的恶意Java类。

3. Github上搜索了各种脚本,有的有bug,有的不支持GCM加密模式,有的功能不完善。

原理

shiro反序列化攻击行为不能有效分析的原因,主要是由于这种攻击行为需要提前知道一个key值,攻击者用这个key值把含有攻击行为代码的数据包进行加密,也就说蓝队人员需要有这个key值才能把数据包解密了。但是我的想法是,常用的key值大概就100多个左右,用这些key去遍历解密数据包,直到解密成功还原出明文文本为止,再通过各种检测规则,去研判解密后的明文数据包中是否真实含有反序列化攻击代码。

使用

将“rememberMe”的值填入文本框中,点击“使用列表中的Key进行解密”,程序会尝试用“Key值列表”中所有的key对数据包进行解密,一旦解密成功,紧接着对还原出的明文数据包中的java危险类名进行检测,继续判断数据包中是否有反序列化攻击代码。

Shiro 红队漏洞挖掘神器 VS Shiro 蓝队反序列化数据包解密神器

img

如果想手工分析,本程序还提供了一个“使用指定Key手工分析”的选项卡,填入“rememberMe”值之后,填入“AES Key”,选择CBC加密模式或GCM加密模式,点击“使用指定Key进行解密”按钮,即可看到解密后的文本。

Shiro 红队漏洞挖掘神器 VS Shiro 蓝队反序列化数据包解密神器

img

来源

http://mp.weixin.qq.com/s?__biz=MzkzMjI1NjI3Ng==&mid=2247484123&idx=1&sn=cb9c039ef92311e56e7742c7c38f6e8a&chksm=c25fcda0f52844b6088b39b769a63b2f6e7a29e8b3ab710961918218d7569089ee4e00072ad9#rd

地址


链接:https://pan.baidu.com/s/1DIlQemsEZq-MFuOAtVSzyQ
提取码:1234

其余工具

shiro550反序列化漏洞利用工具

https://github.com/SummerSec/ShiroAttack2
https://github.com/sv3nbeast/ShiroScan
https://github.com/insightglacier/Shiro_exploit
https://github.com/3ndz/Shiro-721
https://github.com/jas502n/SHIRO-550
https://github.com/jas502n/SHIRO-721
https://github.com/insightglacier/Shiro_exploit
https://github.com/acgbfull/Apache_Shiro_1.2.4_RCE
https://github.com/sunird/shiro_exp
https://github.com/teamssix/shiro-check-rce
https://github.com/wyzxxz/shiro_rce
https://github.com/bkfish/Awesome_shiro
https://github.com/zhzyker/shiro-1.2.4-rce
https://github.com/pmiaowu/BurpShiroPassiveScan
https://github.com/feihong-cs/ShiroExploit
https://github.com/potats0/shiroPoc
https://github.com/tangxiaofeng7/Shiroexploit
https://github.com/fupinglee/ShiroScan
https://github.com/Ares-X/shiro-exploit
https://github.com/j1anFen/shiro_attack
https://github.com/Veraxy01/Shiro-EXP
https://github.com/admintony/shiro_rememberMe_Rce
https://github.com/j1anFen/ysoserial_echo
https://github.com/Veraxy00/Shiro-EXP
https://github.com/mmioimm/shiro_echo
https://github.com/dr0op/shiro-550-with-NoCC
https://github.com/M4da0/ShiroExploit
https://github.com/inspiringz/Shiro-721
https://github.com/KpLi0rn/ShiroTool
https://github.com/KpLi0rn/ShiroExploit
https://github.com/safe6Sec/ShiroExp
https://github.com/longofo/PaddingOracleAttack-Shiro-721

原文始发于微信公众号(利刃藏锋):Shiro 红队漏洞挖掘神器 VS Shiro 蓝队反序列化数据包解密神器

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年5月5日02:09:08
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Shiro 红队漏洞挖掘神器 VS Shiro 蓝队反序列化数据包解密神器http://cn-sec.com/archives/973814.html

发表评论

匿名网友 填写信息