How a Forgotten Apache Tomcat Instance Led to Session Hijacking o
An old Apache Tomcat instance exposed default example pages, including a servlet that displays the user's session cookie. Because the site lacked X-Frame-Options and CSP, an attacker could frame that page and trick a victim into copying and submitting their own JSESSIONID, leading to session hijacking.
Md Tanjimul Islam Sifat Follow
Published on medium.com
I was hunting on http://www.ncaor.gov.in/ — the National Centre for Antarctic and Ocean Research, an Indian government scientific institution. The site runs over plain HTTP, which immediately caught my attention.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the server ran an outdated Tomcat with default example applications left enabled, including a servlet that displays session cookies, and lacked security headers (X-Frame-Options, CSP) that would prevent framing.
Impact
An attacker could steal a victim's JSESSIONID and hijack their session, gaining full account access to the calendar application, though the attack relies on social engineering and the victim's interaction.
What the attacker needed
Victim visits attacker-controlled page; victim copies and submits cookie; Tomcat examples directory exposed; no X-Frame-Options header
The fix
The default example applications should be removed from production, and security headers such as X-Frame-Options and Content-Security-Policy with frame-ancestors should be added.
How it was found
- Resolve the domain to its IP address using ping.
- Scan the subnet to find live hosts and identify an Apache Tomcat instance on port 8080.
- Access the /examples/ directory, which had directory listing enabled.
- Locate the Cookie Example servlet that displays the user's session cookie.
- Create a fake lottery page that iframes the cookie page and instructs the victim to copy and submit their cookie.
- Receive the submitted cookie on an out-of-band server, confirming session hijacking.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A session cookie is a short code a website gives your browser after you log in, so it knows who you are on each page. If someone else gets that code, they can pretend to be you. Here, an old demo page showed the code on screen, and the site allowed that page to be embedded in another site, so a fake page could trick people into handing the code over.
What is UI spoofing?
The interface lies to the user: a framed page catches their clicks, or a browser shows the wrong address or a fake prompt. Paid when it leads to a sensitive action or convincing phishing.