PTS2022

Finding Java deserialization gadgets with CodeQL
2022-07-06, 14:20–14:55 (Europe/Paris), Amphitheater

Arbitrary object deserialisation vulnerability in Java applications can be really dangerous, but also worthless if you are not able to find a gadget chain.

Some gadgets chains are known and can be used without much consideration, but most of them don't work anymore.

Indeed, most known gadgets are 3 or 5 year olds. This can be explained by the fact that finding such chains is hard and few tools exist to automate this process. In this talk I want to present a new technique to easily find new gadgets by leveraging the power of CodeQL. CodeQL is a very powerful static code analyzer that provides a way to analyze code by querying it like a data store. It's open source and can work on open source projects as it requires the source code of the analysed application. CodeQL can find paths between different methods and calls inside an application. This is really useful for gadget chain as we need to look for code paths from a deserialization method to a dangerous one which can lead to arbitrary code execution.


I'll first describe what a deserialization vulnerability is and how gadgets are constructed / found to perform malicious actions. Then I'll introduce CodeQL and the different possibility of this tool and finally I'll present a new technique to automate the process of finding Java gadget chains with CodeQL.

See also: 🎥 video

See also: slides

I'm a pentester at Synacktiv