//Walkthrough - Tomwhat
I have successfully retrieved the flag from the remote instance.
>Challenge Analysis
The challenge consists of a Tomcat server with two custom web applications: light and dark.
-
lightallows setting ausernamesession attribute, but explicitly forbids "darth_sidious". -
darkhas anAdminServlet that reveals the flag if the
usernamesession attribute is "darth_sidious". -
The server is configured with
PersistentManagerusingFileStorein a shared directory (temp/sessions) andsessionCookiePath="/". This means sessions are shared across all web applications on the server.
>Exploitation Path
- Reconnaissance: I discovered that the default Tomcat
/examplesapplication was accessible on the remote server. This application is often removed in production but was present here. - Vulnerability Identification: The
/examples/servlets/servlet/SessionExampleservlet allows users to set arbitrary session attributes. - Exploitation:
-
I used the
SessionExampleservlet to set theusernamesession attribute todarth_sidious. This bypassed the check inLightServlet because I wasn't using
LightServlet to set the session.
-
Because of the shared session storage (
PersistentManager), the session created in/examplesis valid and accessible in/dark. -
I accessed
/dark/adminusing the same session ID. -
The
AdminServlet read the
usernameattribute ("darth_sidious") from the shared session and revealed the flag.
-
>Flag
Hero{a2ae73558d29c6d438353e2680a90692}