ingQangY / JavaRce

对照实战场景梳理较通用的 Java Rce 相关漏洞的利用方式

Home Page:https://github.com/Whoopsunix/JavaRce

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JavaRceDemo

By. Whoopsunix

0x00 do what?

🚀 记录贴 对照实战场景梳理较通用的 Java Rce 相关漏洞的利用方式或知识点

🚩 对于实际环境遇到过的组件如有必要会针对可利用版本进行一个梳理 慢更

🚧 长期项目 不定期学习后更新......

目录

0x01 Command

执行Demo

参考 javaweb-sec 有很详细的例子

  • Runtime
  • ProcessBuilder
  • ProcessImpl
  • ProcessImpl & UnixProcess
  • ProcessImpl & UnixProcess by unsafe + Native
  • Thread
  • ScriptEngineManager
  • jni

执行结果输出(InputStream 处理Demo)

  • java.lang.StringBuilder
  • java.io.ByteArrayOutputStream
  • java.util.Scanner
  • java.io.BufferedReader
  • java.io.InputStream.readNBytes > JDK 9
  • org.springframework:spring-core
  • org.apache.commons:commons-io
  • 普通执行demo、jsEngine:get、set方式
  • 有sout的回显 (Ps. 通过 Servlet 的回显移到 RceEcho 章节介绍)
    • 明文
    • 套一层base64加密
  • 探测用Payload
    • DNSLOG、HTTPLOG
    • 延时
  • runtime 回显
  • jsEngine 回显
  • Scriptlet 标记写法(放在这里对照)
  • runtime 回显
  • 探测用Payload
    • DNSLOG、HTTPLOG
    • 延时

参考 JDBC-Attackpyn3rd blog 有很详细的例子

  • 文件读取
  • 反序列化
    • statementInterceptors
    • detectCustomCollations
  • CVE-2022-21724 RCE
    • AbstractXmlApplicationContext 实现类
  • 文件写入
    • loggerLevel / loggerFile
      • 原始方式写入 EL
      • 截断方式写入 jsp
  • RUNSCRIPT 远程sql加载
  • 代码执行
    • INIT转义分号
    • TriggerJS
    • Groovy
  • JNDI
  • JNDI
  • Serialize
  • RCE
  • static 触发
  • 构造方法触发
  • 方法触发
  • static 触发
  • 构造方法触发
  • 方法触发
  • 命令执行 Runtime、ProcessBuilder、js
  • 探测用Payload
    • DNSLOG、SOCKETLOG
    • 延时
  • JNDI
  • BCEL
  • RemoteJar

XStream

主要为 CVE 不具体展开,<= 1.4.17 的生成集成在 yso 项目中

0x05 RceEcho

慢更版本适配

结合 java-object-searcher 工具挖掘

Version Test

  • 6.0.53
  • 7.0.59、7.0.109
  • 8.0.53、8.5.82
  • 9.0.65

Version Test

  • spring-boot-starter-web
    • [2.2.x, 2.7.x]

Version Test

  • 7.x、8.x、9.x、10.x 全版本

WildFly 默认容器用的 Undertow

Version Test

  • spring-boot-starter-undertow
    • 2.7.15

Thanks

感谢师傅们的研究 带来了很大的帮助 :)

https://github.com/javaweb-sec/javaweb-sec

https://github.com/yzddmr6/Java-Js-Engine-Payloads

https://github.com/su18/JDBC-Attack

https://pyn3rd.github.io/

https://forum.butian.net/share/886

https://github.com/woodpecker-appstore

https://www.yulegeyu.com/archives/

https://github.com/c0ny1/java-object-searcher

https://github.com/feihong-cs/Java-Rce-Echo

Stargazers over time

About

对照实战场景梳理较通用的 Java Rce 相关漏洞的利用方式

https://github.com/Whoopsunix/JavaRce


Languages

Language:Java 99.5%Language:C++ 0.2%Language:C 0.2%Language:PLpgSQL 0.1%