nicky bloor - barmie - poking java's back door - 44con 2017

102
BaRMIe – Poking Java’s Back Door Nicky Bloor 44CON 2017

Upload: nicky-bloor

Post on 22-Jan-2018

1.790 views

Category:

Technology


5 download

TRANSCRIPT

Page 1: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

BaRMIe – Poking Java’s Back Door

Nicky Bloor 44CON 2017

Page 2: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

whoami

Nicky Bloor

• Managing Security Consultant at NCC Group

• Ex software developer

• Desktop, web, games, industrial control systems

• Problem solver, breaker, builder, hacker

• Hiker and rock climber

• @NickstaDB on the Interwebz

Page 3: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

A Story of Pwn

• On-site Java application assessment

• No credentials provided until day 3…

• Supporting infrastructure was in scope

• One network service stood out…

Page 4: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

A Story of Pwn

Java Remote Method Invocation???

…gave me the server before I got those credentials.

Too easy! This left me really intrigued!

Page 5: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

RMI?

• How common is RMI?

• How often is it so insecure?

• What else can we do with it?

Page 6: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Java Remote Method Invocation

Page 7: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

A Brief Introduction to RMI

• Remote Method Invocation

• RPC for Java

• Execute methods within another Java virtual machine (JVM)

• Local or remote

• Simple to implement

• RMI takes care of connection and transport

• Developer does not need to be aware that RMI is in use

• RMI != arbitrary remote code execution

• Only execute methods that are implemented within the other JVM

Page 8: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

8

A Brief Introduction to RMI

Client Application

IFoo.Bar()

RMI RMIServer Application

FooImpl.Bar()

IFoo.Bar();

Page 9: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

The RMI Registry Service

• Directory of Java objects

• Maps Java objects to names

• Listens on TCP port 1099 by default

• Interaction via java.rmi.Registry class

• void bind(String name, Remote obj)

• String[] list()

• Remote lookup(String name)

• void rebind(String name, Remote obj)

• void unbind(String name)

Page 10: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

The RMI Registry Service

• void rebind(String name, Remote obj)

• Rebind a bound object name to another object

• Potential free man-in-the-middle attack?

• void unbind(String name)

• Unbind an object from the registry

• Potential free denial of service attack?

Page 11: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

The RMI Registry Service

• void rebind(String name, Remote obj)

• Rebind a bound object name to another object

• Potential free man-in-the-middle attack?

• void unbind(String name)

• Unbind an object from the registry

• Potential free denial of service attack?

• Cannot bind/rebind/unbind from non-localhost

Page 12: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Implementing RMI

• Very easy – perhaps part of the problem!

• Server-side

• Implement java.rmi.Remote

• Instantiate object

• Bind object to RMI registry

• Client-side

• Lookup object from RMI registry

• Use as normal

Page 13: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

What’s the Problem?

• Fairly reasonable looking method

• Authenticate first, then read the file

Page 14: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

What’s the Problem?

What if ApplicationObjectFactory returns a remote object?

Page 15: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

What’s the Problem?

Client Server

authenticateUser(user,pass)

readFile(filename)

true

file contents

Page 16: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

What’s the Problem?

Client ServerreadFile(filename)

file contents

Page 17: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

RMI Security?

• Authentication?

• No.

• Session management?

• No.

• Encryption?

• No.

• Message integrity checking/anti-tampering?

• No.

• Access controls?

• Yes. Kind of… Fine. No.

Page 18: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

RMI Security?

• Encryption

• SSLSocketFactory can be used

• Access controls

• bind/rebind/unbind can only be called from localhost

• Risky code executes BEFORE the localhost check…

• (Pre-Java 6u131, 7u121, 8u112)

Page 19: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

RMI Security

Page 20: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

RMI Security

• This is a bit unfair

• RMI wasn’t designed to be secure

• RMI was designed to facilitate remote method invocation

• To compare:

• HTTP wasn’t designed to be secure

• HTTP was designed to facilitate the transfer of textual information

Page 21: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

RMI Security

• HTTP is far more prevalent

• HTTP has evolved to support security

• Web application frameworks improve security by default

• Authentication, session management, access controls etc…

• Developers don’t need to be particularly security aware

• RMI has none of this!

• Security must be explicitly incorporated in remotely exposed classes

Page 22: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Insecure Use of RMI

Page 23: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Insecure Use of RMI

• RMI not a secure protocol

• Original attack:

• Ignore authenticate method

• Call readFile/writeFile/executeQuery directly

• How often is RMI used this insecurely?

Page 24: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Insecure Use of RMI

• First step: Identify software using RMI

• Little success initially searching Google & Github

• Can I identify RMI software packages remotely?

Page 25: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Insecure Use of RMI

• Recalled an early test program which called Registry.lookup()

• Exception reveals fully-qualified class names

• Often identifies vendor

• Sometimes identifies the application itself

• Can we identify RMI software packages remotely?

• Yes!

• Internet search for fully-qualified class names

Page 26: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Insecure Use of RMI

• So, we can extract fully-qualified class names…

• What else can we learn from RMI network traffic?

• How can we extract this information?

Page 27: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

RMI Enumeration

Page 28: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

RMI Enumeration

Page 29: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

RMI Enumeration

Page 30: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

RMI Enumeration

Page 31: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

RMI Enumeration

Page 32: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Insecure Use of RMI

• A lot of time was spent in these tools

• Along the way code was produced to parse RMI traffic and extract

useful data…

Page 33: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

BaRMIe - Enumeration

Page 34: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

BaRMIe - Enumeration

• Proxy-based enumeration of RMI registries

• Start TCP proxy for RMI registry connection

• Request remote objects

• Buffer RMI ‘ReplyData’ packets

• Parse the packet contents to extract useful data

Page 35: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Knocking on Java’s Back Door

• Find RMI software

• Found over 14,000 RMI services on Shodan

• Over 27,000 Java objects exposed over RMI

Page 36: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Knocking on Java’s Back Door

• Find RMI software

• Found over 14,000 RMI services on Shodan

• Over 27,000 Java objects exposed over RMI

• Not all exposed externally

Page 37: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Knocking on Java’s Back Door

• Find RMI software

• Found over 14,000 RMI services on Shodan

• Over 27,000 Java objects exposed over RMI

• Not all exposed externally

Page 38: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Knocking on Java’s Back Door

• Find RMI software

• Found over 14,000 RMI services on Shodan

• Over 27,000 Java objects exposed over RMI

• Not all exposed externally

• Many probably shouldn’t be exposed

Page 39: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Knocking on Java’s Back Door

• Find RMI software

• Found over 14,000 RMI services on Shodan

• Over 27,000 Java objects exposed over RMI

• Not all exposed externally

• Many probably shouldn’t be exposed

DbVehicleSearchService drivingLicenseManagercarUseRecordManager

Page 40: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Knocking on Java’s Back Door

• Find RMI software

• Found over 14,000 RMI services on Shodan

• Over 27,000 Java objects exposed over RMI

• Not all exposed externally

• Many probably shouldn’t be exposed

DbVehicleSearchService drivingLicenseManagercarUseRecordManager

CameraCapturedImages CCPaymentService superviseOilManager

Page 41: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Knocking on Java’s Back Door

• Find RMI software

• Found over 14,000 RMI services on Shodan

• Over 27,000 Java objects exposed over RMI

• Not all exposed externally

• Many probably shouldn’t be exposed

DbVehicleSearchService drivingLicenseManagercarUseRecordManager

CameraCapturedImages CCPaymentService superviseOilManager

SecurityServer ROOT_TERMINAL AdminAPI system UserConfigAPI

Page 42: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Knocking on Java’s Back Door

• Find RMI software

• Found over 14,000 RMI services on Shodan

• Over 27,000 Java objects exposed over RMI

• Not all exposed externally

• Many probably shouldn’t be exposed

DbVehicleSearchService drivingLicenseManagercarUseRecordManager

CameraCapturedImages CCPaymentService superviseOilManager

SecurityServer ROOT_TERMINAL AdminAPI system UserConfigAPI

chainGunAPI

Page 43: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Knocking on Java’s Back Door

• Find RMI software

• Found over 14,000 RMI services on Shodan

• Over 27,000 Java objects exposed over RMI

• Not all exposed externally

• Many probably shouldn’t be exposed

DbVehicleSearchService drivingLicenseManagercarUseRecordManager

CameraCapturedImages CCPaymentService superviseOilManager

SecurityServer ROOT_TERMINAL AdminAPI system UserConfigAPI

chainGunAPI beerMachineApi

Page 44: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Knocking on Java’s Back Door

• Find RMI software

• Found over 14,000 RMI services on Shodan

• Over 27,000 Java objects exposed over RMI

• Not all exposed externally

• Many probably shouldn’t be exposed

DbVehicleSearchService drivingLicenseManagercarUseRecordManager

CameraCapturedImages CCPaymentService superviseOilManager

SecurityServer ROOT_TERMINAL AdminAPI system UserConfigAPI

chainGunAPI beerMachineApi praiseService

Page 45: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Knocking on Java’s Back Door

• Find RMI software

• Found over 14,000 RMI services on Shodan

• Over 27,000 Java objects exposed over RMI

• Not all exposed externally

• Many probably shouldn’t be exposed

DbVehicleSearchService drivingLicenseManagercarUseRecordManager

CameraCapturedImages CCPaymentService superviseOilManager

SecurityServer ROOT_TERMINAL AdminAPI system UserConfigAPI

chainGunAPI beerMachineApi praiseService

Page 46: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Knocking on Java’s Back Door

• Honestly, no idea what any of these do!

• These are just examples of what people expose over RMI.

• This is bad if these services are implemented as insecurely as

that first ‘writeFile’ example

Page 47: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Examples of Insecure RMI

Page 48: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Apache JMeter

• org.apache.jmeter.engine.RemoteJMeterEngineImpl_Stub

• Open source!

• Download source and review

• Locate classes that implement java.rmi.Remote

Page 49: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Apache JMeter

Page 50: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Apache JMeter

• Looks like anyone can configure this service!

Page 51: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Temis RemoteAdminServer

• com.temis.admin.remote.RemoteAdminServer_Stub

• Unable to locate source code or client jar

• BaRMIe revealed an interesting annotation…

Page 52: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Temis RemoteAdminServer

• Remote methods:

• UserProfile authenticate(String, String)

Page 53: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Temis RemoteAdminServer

• Remote methods:

• UserProfile authenticate(String, String)

Looks like they thought about security?

(UserProfile – could be a session-like object?)

Page 54: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Temis RemoteAdminServer

• Remote methods:

• UserProfile authenticate(String, String)

• boolean configure(Properties)

…or not!

Page 55: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Temis RemoteAdminServer

• Remote methods:

• UserProfile authenticate(String, String)

• boolean configure(Properties)

• String getAdminKey()

Page 56: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Temis RemoteAdminServer

• Remote methods:

• UserProfile authenticate(String, String)

• boolean configure(Properties)

• String getAdminKey()

• int addUser(String, String, String, String)

Page 57: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Temis RemoteAdminServer

• Account takeover?

• List<UserProfile> getAllUserList()

• int changePassword(UserProfile, String)

Page 58: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Temis RemoteAdminServer

• Account takeover?

• List<UserProfile> getAllUserList()

• int changePassword(UserProfile, String)

• UserProfile methods:

• String getPassword()

Page 59: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Temis RemoteAdminServer

• More remote methods:

• String getDatabaseIP()

• String getDatabasePort()

• String getDatabaseName()

• String getDatabaseType()

Page 60: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Temis RemoteAdminServer

• More remote methods:

• String getDatabaseIP()

• String getDatabasePort()

• String getDatabaseName()

• String getDatabaseType()

• String getUsername()

• String getPassword()

Page 61: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

RMI: What’s the Problem?

Page 62: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

RMI: What’s the Problem?

It gets worse…

Page 63: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Deserialization

Page 64: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Deserialization

• Process of converting data into runtime objects

• Often implemented/used insecurely

• Deserializing untrusted data is usually bad

• RMI is heavily dependent on Java serialization

Page 65: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Adobe ColdFusion

• Most commonly exposed RMI service in my scans

• coldfusion.flex.rmi.DataServicesCFProxyServer_Stub

• No strikingly interesting remote methods

Page 66: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Adobe ColdFusion

• Most commonly exposed RMI service in my scans

• coldfusion.flex.rmi.DataServicesCFProxyServer_Stub

• No strikingly interesting remote methods

• Except…

Page 67: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Adobe ColdFusion

• Most commonly exposed RMI service in my scans

• coldfusion.flex.rmi.DataServicesCFProxyServer_Stub

• No strikingly interesting remote methods

• Except…

Page 68: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Adobe ColdFusion

• Most commonly exposed RMI service in my scans

• coldfusion.flex.rmi.DataServicesCFProxyServer_Stub

• No strikingly interesting remote methods

• Except…

Page 69: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Adobe ColdFusion

• Most commonly exposed RMI service in my scans

• coldfusion.flex.rmi.DataServicesCFProxyServer_Stub

• No strikingly interesting remote methods

• Except…

• Call fill() to deserialize any object…

Page 70: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Demo Time!

• Adobe ColdFusion 2016, fully up-to-date as of 11th September 2017

• Default install except for one setting

• Unauthenticated remote method invocation…

Page 71: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Demo Time!

Page 72: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Deserialization

It’s worse than that…

Page 73: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Java’s Back Door

Page 74: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Java’s Back Door

• Testing some code

• Suddenly realised I’d made a mistake…

• …but the code worked…

Page 75: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Full RMI Proxy

• Successfully proxying RMI registry connections

• RMI registry does not handle method invocations

• Invocation handled by remote objects

• Different port

• Potentially different host

• Built a proxy to MitM method invocations

Page 76: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Proxying RMI

RMI Client

RMI Registry

RMI Object

Page 77: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Proxying RMI

RMI Client

RMI Registry

RMI Object

Registry Proxy

First, we create an RMI registry proxy

Page 78: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Proxying RMI

RMI Client

RMI Registry

RMI Object

Registry Proxy

Which is configured to connect directly to the target RMI registry

Page 79: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Proxying RMI

RMI Client

RMI Registry

RMI Object

Registry Proxy

Our RMI client requests an object via the proxy

Page 80: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Proxying RMI

RMI Client

RMI Registry

RMI Object

Registry Proxy

The object data is intercepted and parsed

Page 81: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Proxying RMI

RMI Client

RMI Registry

RMI Object

Registry Proxy

Object Proxy

3) Creates Object Proxy

The RMI registry proxy then creates an RMI object proxy

Page 82: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Proxying RMI

RMI Client

RMI Registry

RMI Object

Registry Proxy

Object Proxy

3) Creates Object Proxy

Which is configured to connect directly to the RMI object

Page 83: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Proxying RMI

RMI Client

RMI Registry

RMI Object

Registry Proxy

Object Proxy

3) Creates Object Proxy

We modify the object data to point at the new proxy and return it to the client

Page 84: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Proxying RMI

RMI Client

RMI Registry

RMI Object

Registry Proxy

Object Proxy

3) Creates Object Proxy

We can now MitM remote method invocation traffic!

Page 85: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Java’s Back Door

• So, what was that mistake?!

• Experimenting with network-level payload injection and ysoserial

• Called obj.foo(String) in RMI client, rather than obj.foo(Object)

Page 86: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Java’s Back Door

• So, what was that mistake?!

• Experimenting with network-level payload injection and ysoserial

• Called obj.foo(String) in RMI client, rather than obj.foo(Object)

• Proxy replaced the parameter…

Page 87: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Java’s Back Door

• So, what was that mistake?!

• Experimenting with network-level payload injection and ysoserial

• Called obj.foo(String) in RMI client, rather than obj.foo(Object)

• Proxy replaced the parameter…

Page 88: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Poking Java’s Back Door

• Invoking void printString("AAAAAAAAAA") looks like this:

Page 89: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Poking Java’s Back Door

• Invoking void printString("AAAAAAAAAA") looks like this:

• A simple serialized object, new Dummy(), looks like this:

Page 90: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Poking Java’s Back Door

• The proxy did this (with a ysoserial payload):

Page 91: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Poking Java’s Back Door

• The proxy did this (with a ysoserial payload):

• Remotely invoked an illegal method call

Page 92: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Poking Java’s Back Door

• The proxy did this (with a ysoserial payload):

• Remotely invoked an illegal method call

• void printString(new Dummy()):

Page 93: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Poking Java’s Back Door

• The proxy did this (with a ysoserial payload):

• Remotely invoked an illegal method call

• void printString(new Dummy()):

• Server-side exception

• Dummy is not compatible with java.lang.String

Page 94: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Poking Java’s Back Door

• The proxy did this (with a ysoserial payload):

• Remotely invoked an illegal method call

• void printString(new Dummy()):

• Server-side exception

• Dummy is not compatible with java.lang.String

• Payload had already been deserialized

Page 95: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Java’s Back Door

If we invoke a remote method, we can replace parameters with incompatible payloads

Page 96: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Caveat

• Slight caveat, due to Java serialization format/protocol

• Method parameter that we replace must be non-primitive

• int, long, boolean etc cannot be replaced

• Integer, int[], ArrayList, and objects of arbitrary classes can

Page 97: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

BaRMIe

Page 98: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

BaRMIe

• RMI often exposes legitimate but dangerous methods

• writeFile(), executeQuery()

• Proxy-based attacks can introduce further risk

• Vulnerabilities where there wouldn’t otherwise be a vulnerability

• Requires knowledge of remote classes/method signatures

Page 99: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

BaRMIe

• Written a lot of code during this research…

• Enumeration of remote objects (identify classes)

• Attacks for various targets

• Executing legitimate methods

• Deserialization attacks using Object type parameters

• Deserialization attacks through illegal parameter replacement

• BaRMIe is an all-in-one RMI enumeration and attack tool

Page 100: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Conclusion

Page 101: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Conclusion

• RMI lacks maturity

• Often used very insecurely

• Object injection/deserialization attacks are almost always a

possibility

• Old and ‘uninteresting’ technology can be a fun and fruitful

research target!

Page 102: Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017

Questions?

https://nickbloor.co.uk/