java shellcode execution

28
JAVA EXECUTION SH3LL C0DE

Upload: ryan-wincey

Post on 19-Nov-2014

884 views

Category:

Technology


2 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Java Shellcode Execution

JAVA

EXECUTION

SH3LL C0DE

Page 2: Java Shellcode Execution

Me

Page 3: Java Shellcode Execution

Ryan Wincey

-Security Researcher-Coder-Penetration Tester

Me

Page 4: Java Shellcode Execution

WHY JAVA

Page 5: Java Shellcode Execution

WHY JAVA

Page 6: Java Shellcode Execution

WHY JAVA•CROSS-

PLATFORM

Page 7: Java Shellcode Execution

WHY JAVA•CROSS-

PLATFORM•EXTENSIVE LIBRARY

Page 8: Java Shellcode Execution

WHY JAVA•CROSS-

PLATFORM•EXTENSIVE LIBRARY•WIDELY

DEPLOYED

Page 9: Java Shellcode Execution

PROBLEM:

Page 10: Java Shellcode Execution

PROBLEM:

HOW CAN I RUN SHELLCODE FROM

JAVA?

Page 11: Java Shellcode Execution

 #NOPSchar shellcode[] = "\x90\x90\x90\x90”   int main(int argc, char **argv){

int (*f)();        f = (int (*)())shellcode;        (int)(*f)();}

Page 12: Java Shellcode Execution

http://blog.strategiccyber.com/2013/08/29/how-to-inject-shellcode-from-java/

Page 13: Java Shellcode Execution

https://github.com/schierlm/JavaPayload. 

Page 14: Java Shellcode Execution

package javapayload.stage;/** Running shellcode from Java without JNI (i. e. loading a DLL from disk).(c) 2011 Michael Schierl <schierlm at gmx dot de> (Twitter @mihi42)

Page 15: Java Shellcode Execution

* This version has been tested on:* * Oracle 1.4.2_11 Win32 (-client, -server)* Oracle 1.5.0_06 Win32 (-client, -server) * Oracle 1.6.0_19 Win32 (-client, -server)* Oracle 1.7.0_01 Win32 (-client, -server)* * Oracle 1.6.0_26 Linux32 (-client, -server)* Oracle 1.7.0_01 Linux32 (-client, -server)

Page 16: Java Shellcode Execution
Page 17: Java Shellcode Execution

http://www.research.ibm.com/trl/projects/jit/index_e.htm

Page 18: Java Shellcode Execution
Page 19: Java Shellcode Execution
Page 20: Java Shellcode Execution
Page 21: Java Shellcode Execution
Page 22: Java Shellcode Execution
Page 23: Java Shellcode Execution
Page 24: Java Shellcode Execution

DEMO

Page 25: Java Shellcode Execution

//=========================================================================== /** * Java method that gets overwritten by shellcode * The native method pointer is then overwritten with a * pointer to this method */ private static void jitme() { executed = true;

// On x86: each volatile inc/dec needs 18 bytes, // all 320 of them need 5760 bytes, // whole JIT method needs 5842 bytes. // if you need more shellcode, make a longer method v1++; v2++; v3++; v4++; v5++; v1++; v2++; v3++; v4++; v5--; v1++; v2++; v3++; v4--; v5++; v1++; v2++; v3++; v4--; v5--; v1++; v2++; v3--; v4++; v5++; v1++; v2++; v3--; v4++; v5--; v1++; v2++; v3--; v4--; v5++; v1++; v2++; v3--; v4--; v5--; v1++; v2--; v3++; v4++; v5++; v1++; v2--; v3++; v4++; v5--; v1++; v2--; v3++; v4--; v5++; v1++; v2--; v3++; v4--; v5--; v1++; v2--; v3--; v4++; v5++; v1++; v2--; v3--; v4++; v5--; v1++; v2--; v3--; v4--; v5++; v1++; v2--; v3--; v4--; v5--; executed = true;

Page 26: Java Shellcode Execution

DEMO2

Page 27: Java Shellcode Execution

Questions?

Page 28: Java Shellcode Execution

Ryan Wincey @rwincey [email protected]

      https://github.com/rwincey

Contacts

Michael Schierl @mihi42https://github.com/schierlm/

JavaPayload