Skip to content
Path traversal Write-up Intermediate

Hacking the Dutch Government

The Tomcat manager endpoint was exposed through an Nginx reverse proxy due to a path normalisation mismatch, allowing access to the Tomcat web root. An attacker could view sensitive files and potentially deploy a malicious WAR file to achieve remote code execution if default credentials were unchanged.

Jackson Follow

Published on medium.com

{{media:0}}

Jackson, on medium.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

The target here is the Dutch government's public bug bounty programme, which offers swag, often a t-shirt, to anyone who can hack one of its websites. The scope is large: the researcher links to a public list of over 1000 domains. One of those domains is https://www.bodemloket.nl, the website of the Netherlands' Ministry of Infrastructure and Water Management. The interesting part of the site sits behind a Tomcat application server, fronted by Nginx as a reverse proxy. Tomcat normally exposes management endpoints such as manager/status and manager/html that should not be reachable by ordinary users.

Jackson
Jackson From the original on medium.com

Setup

No accounts, credentials or special roles were needed. The researcher picked targets from the published domain list at random and used FFUF to automate the search for domains exposing Tomcat endpoints:

Text
https://github.com/ffuf/ffuf

A couple of weeks were spent on XSS and SSRF attempts without success before the researcher moved to less popular vulnerability classes.

Finding it

Tomcat endpoints can be probed simply by appending them to the domain name, for example http://www.example.com/manager/html. An early request the researcher made against the target was:

HTTP
https://www.bodemloket.nl/manager/status

The response was a 403 Forbidden. That is a useful signal rather than a dead end: it shows the Tomcat endpoint exists and that access is being denied, rather than the path not existing at all.

The reasoning behind the bug is the interaction between Nginx and Tomcat. Tomcat normalises paths and Nginx often does not. Tomcat treats a path segment containing /..;/ as /../, while Nginx passes it through to Tomcat unchanged. So a traversal sequence placed after a Tomcat endpoint, such as /manager/..;/, looks harmless to the reverse proxy and is forwarded to Tomcat, which evaluates it as the root directory. The researcher points to Orange Tsai's DEF CON 26 presentation for a fuller explanation of the mechanism.

Or watch on YouTube
From the original on medium.com

Exploitation

Step 1: confirm the endpoint exists

Requesting the status endpoint directly returned 403 Forbidden, confirming that Tomcat's management interface was present behind the proxy but not publicly accessible.

Step 2: bypass the proxy with a traversal payload

The payload used was:

HTTP
https://www.bodemloket.nl/manager/..;/

Nginx sees nothing wrong with the path and forwards it. Tomcat normalises /..;/ to /../, which resolves to the Tomcat web root. The result was access to the root directory, which should not be reachable by the public.

Step 3: get a friendlier listing

Appending another slash to the URL produced a more readable view of the Tomcat root directory.

Step 4: note the additional exposure

The researcher was also able to reach the Tomcat example scripts, which are vulnerable to XSS and information disclosure. No screenshots of these were kept. A couple of high-severity CVEs affecting the Tomcat version in use were also identified. The researcher stopped at this point and submitted the report, noting in hindsight that the issue could probably have been pushed further.

Root cause

The mistake is the combination of Nginx as a reverse proxy with Tomcat and no added safeguards. Tomcat normalises paths, collapsing /..;/ into /../, while Nginx does not normalise the same way and passes the path through as received. Because the proxy's view of the path and the backend's view differ, a traversal sequence hidden behind a semicolon slips past the proxy and is resolved by Tomcat to the web root. The 403 on the direct request shows that access control was intended, but the normalisation mismatch defeats it.

Impact

The immediate impact is public access to the Tomcat web root and to the example scripts, which carry XSS and information disclosure issues, plus exposure of a Tomcat version with known high-severity CVEs. The larger prize is the Tomcat manager: access to it can lead to remote code execution because it allows uploading and deploying a .war file. Default manager credentials are tomcat:s3cret, and these are often left unchanged precisely because the manager endpoint is not supposed to be reachable. If the credentials have been changed, common combinations can be found online or brute-forced with a tool such as Burp Suite. The researcher notes that on a paid programme the escalation would have been pursued harder; here the goal was the t-shirt.

Fix

The vulnerability was reported on 06/11/23, confirmed by the NCSC on 07/11/23, and fixed and retested on 16/11/23. The researcher was asked to retest after the fix, and the report shows what the payload returns today. The report does not describe the specific configuration change made.

Variants to test

  1. Probe Tomcat management paths on other hosts in scope, for example /manager/status and /manager/html. A 403 rather than a 404 is a positive result: the endpoint exists and is being blocked at the proxy.
  2. Try the traversal form after a Tomcat endpoint, such as /manager/..;/, and then add a trailing slash. A positive result is a directory listing of the Tomcat web root.
  3. Look for the example scripts under the exposed root. A positive result is reachable sample applications, which bring XSS and information disclosure with them.
  4. Identify the Tomcat version from what is exposed and check it against known CVEs. A positive result is a version with high-severity issues.
  5. If the manager is reachable, test the default tomcat:s3cret credentials, then common combinations or a brute-force run with Burp Suite. A positive result is a login to the manager, from which a .war file can be deployed.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 14 min read.

What happened, in plain words

A security researcher found a way to see a part of a Dutch government website that visitors are not supposed to see. The site runs on a piece of software called Tomcat, which has a private control area. Normally the public is blocked from that area. By adding a strange-looking piece of text to the end of a web address, the researcher got past the block and saw the private area's contents.

The researcher reported it, the NCSC confirmed it, and about ten days later it was fixed. The reward was a t-shirt and a letter.

This article walks through the same steps slowly, explaining every term as it appears, so that someone who has only ever used a browser can follow along.

Jackson
Jackson From the original on medium.com

The programme and the target

The Dutch government runs a public bug bounty programme. A bug bounty is an offer: if you find a security mistake in one of our systems and tell us about it, we will thank you, and sometimes pay or send a reward. Here the reward was swag, often the t-shirt in the picture above. Swag means promotional merchandise, things like t-shirts, stickers or mugs.

The programme covers a lot of ground. The researcher links to a public list of over 1000 domains, meaning over a thousand separate website addresses that belong to the government and are fair game to test:

Text
https://gist.github.com/R0X4R/[redacted]#file-domains-txt

That link points to a file on GitHub (a site where people share code and text files) that lists the domains. A domain is the part of a web address that names the site, like bodemloket.nl.

One address on that list is https://www.bodemloket.nl, the website of the Netherlands' Ministry of Infrastructure and Water Management. The interesting part of this site is not the pages a visitor clicks through. It sits behind a Tomcat application server, with a program called Nginx standing in front of it as a reverse proxy.

Two terms need unpacking there.

Tomcat is a free, open-source web application server. Think of a restaurant: the dining room is what customers see, and the kitchen is where the food is actually made. Tomcat is the kitchen. It prepares the pages and data, and it also has a staff-only back office with management screens. Those management screens live at addresses such as manager/status and manager/html. They are meant for administrators, not for the public.

Nginx (pronounced "engine-x") is a reverse proxy. A proxy is a middleman. A reverse proxy sits in front of the real server and receives every request from the outside world first, then decides whether and where to pass it on. Think of a receptionist in an office building: visitors talk to the receptionist, and the receptionist walks the message to the right desk inside. Nginx is that receptionist. It is also the place where the building can say "you are not allowed past this point".

So the setup is: your browser talks to Nginx, and Nginx talks to Tomcat. The public is supposed to reach the normal pages and never the management screens.

Setup: what was needed to start

No accounts, no passwords and no special permissions were needed. The researcher picked targets from the published domain list at random. That is the whole starting position: a browser, a list of addresses, and permission to poke at them.

To search many domains quickly for Tomcat's management addresses, the researcher used a tool called FFUF:

Text
https://github.com/ffuf/ffuf

FFUF is a tool the researcher links to for automating the search for domains exposing Tomcat endpoints. This is called fuzzing, and it is the automated version of knocking on every door in a corridor to see which ones open.

Before finding this bug, the researcher spent a couple of weeks trying two other kinds of attack, XSS and SSRF, without success, and then moved on to less popular vulnerability types. Those two terms are worth knowing because they come up everywhere:

  • XSS (cross-site scripting) is when an attacker manages to get their own code to run inside another visitor's browser on a trusted site. The browser cannot tell that the code did not come from the site, so it runs it with the site's permissions.
  • SSRF (server-side request forgery) is when an attacker tricks a server into making a request on the attacker's behalf, for example to an internal address the attacker cannot reach directly. The server becomes an unwitting courier.

Neither worked here. What worked was a path traversal, explained below.

Finding it

Tomcat's management addresses can be probed simply by sticking them onto the end of a domain name. If a site runs Tomcat, then an address like http://www.example.com/manager/html might exist. example.com is a placeholder domain used in documentation, not a real target.

The first request the researcher made against the real target was:

HTTP
https://www.bodemloket.nl/manager/status

Line by line, in plain words:

  • https:// is the secure version of the protocol browsers use to fetch pages. The s stands for secure: the traffic is encrypted, so nobody in between can read it.
  • www.bodemloket.nl is the domain, the name of the government site.
  • /manager/status is the path. A path is like a folder route inside the site. manager is the name of Tomcat's management area, and status is a page inside it that shows the server's health.

So the request is simply: "show me the status page of the management area on this site".

The answer was 403 Forbidden. A status code is a short number a server sends back with every response to say how it went. You have probably seen 404, which means "not found". 403 means something different: "I understood your request, the thing you asked for exists, but you are not allowed to have it".

That distinction matters enormously. A 404 would mean there is nothing there, and the researcher would move on. A 403 is a useful signal: it proves the Tomcat management area is present behind the proxy and that someone has deliberately put a lock on the door. A locked door is more interesting than a wall.

The reason the lock can be picked comes from how Nginx and Tomcat each read a path. This is the heart of the bug.

  • Tomcat normalises paths. Normalising means tidying up an address into its simplest, standard form before acting on it. If a path contains a piece meaning "go up one folder", Tomcat tidies that away and works out the real destination.
  • Nginx often does not normalise the same way. It takes the path more or less as written and passes it to Tomcat unchanged.

Specifically, Tomcat treats a path segment containing /..;/ as if it were /../. The .. means "go up one level", the way cd .. does in a file system. The semicolon and the rest is extra text that Tomcat strips out during tidying. Nginx, by contrast, does not recognise /..;/ as anything special and forwards it as-is.

So if a traversal sequence is placed after a Tomcat address, such as /manager/..;/, the receptionist (Nginx) sees nothing wrong and walks the message to the kitchen (Tomcat). Tomcat tidies the path, the .. takes it up out of the manager folder, and it ends up at the root directory of the Tomcat web space. The root is the top-level folder, the one that contains everything else.

For a fuller explanation of this mechanism, the researcher points to Orange Tsai's DEF CON 26 presentation. DEF CON is a long-running security conference, and a presentation there is a talk given on stage.

Or watch on YouTube
From the original on medium.com

Exploitation: step by step

Step 1: confirm the endpoint exists

Requesting the status address directly returned 403 Forbidden. That confirmed Tomcat's management interface was present behind the proxy but not publicly accessible. This step is about evidence: before trying to get around a lock, you establish that there is a door and that it is locked.

Step 2: bypass the proxy with a traversal payload

The payload used was:

HTTP
https://www.bodemloket.nl/manager/..;/

A payload, in security, is the piece of input an attacker crafts to make a system behave in a way it was not meant to. Here it is the odd-looking /manager/..;/ at the end.

Line by line:

  • https://www.bodemloket.nl is the same site as before.
  • /manager is Tomcat's management folder, the locked door.
  • /..;/ is the trick. To Nginx it looks like a folder name made of dots and a semicolon, nothing to worry about, so it passes it through. To Tomcat, the .. means "go up one level", and the semicolon is noise it removes while tidying. Going up one level from manager lands on the root.

Nginx sees nothing wrong with the path and forwards it. Tomcat normalises /..;/ to /../, which resolves to the Tomcat web root. The result was access to the root directory, which should not be reachable by the public. In other words, the receptionist delivered the message to the kitchen, and the kitchen, following the instructions literally, handed over the keys to the whole building.

Step 3: get a friendlier listing

Appending another slash to the address produced a more readable view of the Tomcat root directory. A directory listing is what a server shows when you ask for a folder rather than a specific page: a plain list of the files and subfolders inside. It is not a designed page, just an index, but it tells you what is there.

Step 4: note the additional exposure

The researcher could also reach the Tomcat example scripts. These are sample applications that ship with Tomcat to demonstrate features. They are not meant for production, and they are vulnerable to XSS and information disclosure. Information disclosure means the server reveals details it should keep quiet, such as version numbers, file paths or configuration hints, which help an attacker plan the next move. No screenshots of these were kept.

A couple of high-severity CVEs affecting the Tomcat version in use were also identified. A CVE is a publicly catalogued security flaw, each with its own ID number, so that everyone can refer to the same issue. "High severity" means the flaw is rated as serious. Knowing the exact version of a piece of software is often enough to look up which known flaws apply to it.

The researcher stopped at this point and submitted the report, noting in hindsight that the issue could probably have been pushed further.

Why it worked: the root cause

The mistake is the combination of Nginx as a reverse proxy with Tomcat, with no added safeguards. Tomcat normalises paths, collapsing /..;/ into /../, while Nginx does not normalise the same way and passes the path through as received. Because the proxy's view of the path and the backend's view differ, a traversal sequence hidden behind a semicolon slips past the proxy and is resolved by Tomcat to the web root.

This class of bug is called path traversal. The name is literal: the attacker uses .. to walk up out of the folder they are confined to, like someone in a hotel who is told they may only enter room 101 but finds that the room numbers can be edited on the door signs. The 403 on the direct request shows that access control was intended, but the normalisation mismatch defeats it. Two components each doing something reasonable on their own, but disagreeing about what a path means, is enough to open the door.

Impact: why it mattered

The immediate impact is public access to the Tomcat web root and to the example scripts, which carry XSS and information disclosure issues, plus exposure of a Tomcat version with known high-severity CVEs.

The larger prize is the Tomcat manager. The manager is a web-based control panel for the server. Access to it can lead to remote code execution, which means an attacker can make the server run their own code. That is about as serious as web vulnerabilities get, because from there an attacker can often take over the machine entirely.

The route from manager access to code execution is a .war file. A WAR file is a packaged web application: a bundle of files that Tomcat can deploy, meaning install and start running. If you can upload and deploy one through the manager, you can make the server run whatever you put inside it.

Default manager credentials are tomcat:s3cret, and these are often left unchanged precisely because the manager address is not supposed to be reachable. A default credential is a username and password that come pre-set with the software, the same on every installation unless someone changes them. The username here is tomcat and the password is s3cret. If the credentials have been changed, common combinations can be found online or brute-forced with a tool such as Burp Suite. Brute-forcing means trying many passwords in sequence until one works. Burp Suite is a widely used tool for inspecting and modifying web traffic.

The researcher notes that on a paid programme the escalation would have been pursued harder. Here the goal was the t-shirt.

Fix and timeline

The vulnerability was reported on 06/11/23 and confirmed by the NCSC on 07/11/23. The NCSC is the National Cyber Security Centre, the government body that handles security incidents and reports. It was fixed and retested on 16/11/23. The researcher was asked to retest after the fix, and the report shows what the payload returns today. The report does not describe the specific configuration change made.

A timeline of the whole thing:

Date What happened
06/11/23 Vulnerability reported
07/11/23 NCSC confirmed the vulnerability
16/11/23 Fixed and retested
14/12/23 T-shirt and letter received

Variants to test

If you want to look for the same kind of mistake on other sites, here is the same approach laid out as a checklist. Each item says what to try and what a positive result looks like.

  1. Probe Tomcat management paths on other hosts in scope, for example /manager/status and /manager/html. A 403 rather than a 404 is a positive result: the endpoint exists and is being blocked at the proxy.
  2. Try the traversal form after a Tomcat endpoint, such as /manager/..;/, and then add a trailing slash. A positive result is a directory listing of the Tomcat web root.
  3. Look for the example scripts under the exposed root. A positive result is reachable sample applications, which bring XSS and information disclosure with them.
  4. Identify the Tomcat version from what is exposed and check it against known CVEs. A positive result is a version with high-severity issues.
  5. If the manager is reachable, test the default tomcat:s3cret credentials, then common combinations or a brute-force run with Burp Suite. A positive result is a login to the manager, from which a .war file can be deployed.

Glossary

  • Bug bounty: a programme that rewards people for finding and reporting security flaws in an organisation's systems.
  • Swag: promotional merchandise given as a reward, such as a t-shirt.
  • Domain: the part of a web address that names a site, for example bodemloket.nl.
  • Tomcat: a free, open-source web application server that runs web applications and has a management area.
  • Nginx: a web server and reverse proxy that sits in front of backend servers and forwards requests to them.
  • Reverse proxy: a middleman server that receives requests from the outside world first and passes them to the real backend.
  • Endpoint: a specific address on a server that does a particular job, such as a status page.
  • Path: the part of a web address after the domain that points to a folder or page, such as /manager/status.
  • Path traversal: an attack that uses .. to climb out of the folder a user is confined to and reach other parts of the file system.
  • Normalisation: tidying an address into its simplest standard form before acting on it.
  • 403 Forbidden: a server response meaning the requested thing exists but you are not allowed to access it.
  • 404 Not Found: a server response meaning the requested thing does not exist.
  • Status code: a short number a server sends with each response to say how the request went.
  • Payload: the crafted piece of input an attacker sends to make a system behave unexpectedly.
  • XSS (cross-site scripting): an attack that gets an attacker's code to run inside another visitor's browser on a trusted site.
  • SSRF (server-side request forgery): an attack that tricks a server into making requests on the attacker's behalf.
  • Information disclosure: when a server reveals details it should keep private, such as versions or file paths.
  • CVE: a publicly catalogued security flaw with its own ID number.
  • Severity: a rating of how serious a flaw is.
  • Remote code execution (RCE): an attack that makes a server run the attacker's own code.
  • WAR file: a packaged web application that Tomcat can deploy and run.
  • Deploy: to install and start running an application on a server.
  • Default credentials: a username and password that come pre-set with software and are the same on every installation unless changed.
  • Brute-force: trying many passwords or combinations in sequence until one works.
  • Burp Suite: a widely used tool for inspecting and modifying web traffic.
  • FFUF: a command-line tool that sends many requests automatically to discover addresses on a server.
  • Fuzzing: automatically trying many inputs to see which ones produce an interesting response.
  • NCSC: the National Cyber Security Centre, the government body that handles security incidents and reports.
  • DEF CON: a long-running security conference where researchers present their work.

More from Dutch Government

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.