Shiro
Last updated
Was this helpful?
Last updated
Was this helpful?
Apache Shiro is a powerful and easy-to-use Java security framework that performs authentication, authorization, cryptography, and session management.
In order to maintain user's login status, Shiro implemented the rememberMe
cookie. This cookie is encrypted. However, Shiro used a hardcoded AES encryption key kPH+bIxk5D2deZiIxcaaaA==
. This allows an attacker to forge a cookie containing an malicious object that causes RCE. Shiro will then decrypt this cookie and deserialize it, and then the RCE payload will be triggered.
This is how rememberMe
cookie is processed by the server side:
This is how we achieve RCE by reversing the above logic:
If you find rememberMe=deleteMe
in a failed login attempt, then the web app is vulnerable to Shiro deserialization.
Spawn a Docker instance:
The vulnerable application will be hosted on http://localhost:8080
. Log in with credential admin:vulhub
.
Generate RCE payload using ysoserial:
Encrypt the payload using the hardcoded key:
Send the output as rememberMe
cookie. Verify that the RCE works: