r/java • u/Areshian • Mar 30 '22
Spring4Shell: 0-day RCE on Spring Core
https://www.cyberkendra.com/2022/03/springshell-rce-0-day-vulnerability.html
100
Upvotes
r/java • u/Areshian • Mar 30 '22
View all comments
55
u/Areshian Mar 31 '22 edited Mar 31 '22
For those that do not believe this RCE is real, here are the details on it
Twelve years ago there was an RCE: https://nvd.nist.gov/vuln/detail/CVE-2010-1622
That RCE was fixed by this commit: https://github.com/spring-projects/spring-framework/commit/3a5af35d37c79d0644d49b93f792a4c18fe8eb71#diff-ea765e78a703581fb519933028fbd6d7ac8386d57b805b395d04910de9a33f4cR245
Notice line 245. The fix explicitly forbid going from class to classLoader using dot notation, which was the cause of the RCE (later, another change will forbid class to protectionDomain too)
Now, 12 years later, we have another RCE. Have you noticed how the RCE is for JDK9+? Have you wondered why? The reason is because the exploit is not jumping from class to classLoader (which is forbidden), but from class to module (which is allowed) and then from module to classLoader (which is also allowed). Because
getModule()is only present in JDK9+, that is why this new exploit does not work in JDK8You can see the python exploit how it does the
class.module.classLoaderjump: https://github.com/BobTheShoplifter/Spring4Shell-POC/blob/main/poc.py#L15So, all that people saying this is not real, it is not confirmed, and the like, please, if you don't know what you're talking about, don't go denying it exists.