Skip to content
Path traversal Disclosed report Beginner

Unauthenticated LFI (Local File Inclusion) using the symbol `!` At the target `https://████/`

The Jolokia endpoint for compilerDirectivesAdd allowed unauthenticated path traversal using the exclamation mark as a directory separator, enabling reading of local files such as /etc/passwd and /etc/crontab. An attacker could read sensitive files on the server without authentication.

todayisnew- Follow

Originally disclosed on HackerOne

  • Triaged in 3 days
  • Fixed in 6 days
  • Disclosed after 13 days

Hi DOD Team,

Summary:

  • When accessing the endpoint on https://██████████/jolokia/exec/com.sun.management:type=DiagnosticCommand/compilerDirectivesAdd/ it is possible to path traversal on the machine and reading local files by using ! at every new directory injected allowing an attacker to read local files with even being Unauthenticated leads to a catastrophic impact on the main server.

Steps to reproduce:

1. Read the listed users on the instance ---> /etc/passwd:

  • https://███/jolokia/exec/com.sun.management:type=DiagnosticCommand/compilerDirectivesAdd/!/etc!/passwd

2. Read Crontab jobs on the instance ---> /etc/crontab:

  • https://████/jolokia/exec/com.sun.management:type=DiagnosticCommand/compilerDirectivesAdd/!/etc!/crontab

PoC Video:

  • ████

Mitigation/Fix:

  • Sanitize user input and don't trust user inputs that come for your server in a GET method after the endpoint /compilerDirectivesAdd/{Attackers_Coming_From_Here_To_Read_Local_Files}, it would be better to maintain a whitelist of acceptable filenames and use a unique corresponding identifier to access the file. Then any request containing an invalid identifier can just be rejected. Additionally, you could also sanitize any path traversal characters that may be present in any GET request.

Impact

An attacker could read local files on the web server that they would normally not have access to, such as the application source code or configuration files containing sensitive information on how the website is configured, etc...

Best Regards, Youssef

The original report as published on HackerOne, by todayisnew-. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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. 3 min read.

Context

The target is a U.S. Department of Defence host reachable at https://████/. The exposed feature is a Jolokia endpoint, which is a remote JMX/JSON bridge that lets a client invoke MBeans over HTTP. The specific MBean here is com.sun.management:type=DiagnosticCommand, and the operation being called is compilerDirectivesAdd.

The report describes the result as an unauthenticated local file inclusion (LFI) reached through path traversal, classified as Path Traversal with high severity.

Setup

No account, role or tooling is described. The key precondition is that the Jolokia endpoint is reachable without authentication: the researcher states that the file read works "even being Unauthenticated". The only input needed is a crafted URL, so a browser or any HTTP client is sufficient.

Finding it

Because the operation reads a file from the server's filesystem, the filename supplied in the URL is a path that the attacker controls.

Exploitation

The base endpoint is:

Text
https://██████████/jolokia/exec/com.sun.management:type=DiagnosticCommand/compilerDirectivesAdd/

Everything after compilerDirectivesAdd/ is the attacker-controlled path. Each directory separator in the target path is written as !, so /etc/passwd becomes !/etc!/passwd appended to the base endpoint.

Step 1: Read /etc/passwd

HTTP
https://███/jolokia/exec/com.sun.management:type=DiagnosticCommand/compilerDirectivesAdd/!/etc!/passwd

This requests the local file /etc/passwd through the compilerDirectivesAdd operation. The report states that this returns the listed users on the instance, confirming that the server reads and returns a file outside the intended directives directory.

Step 2: Read /etc/crontab

HTTP
https://████/jolokia/exec/com.sun.management:type=DiagnosticCommand/compilerDirectivesAdd/!/etc!/crontab

The same technique is applied to /etc/crontab, which the report says returns the crontab jobs on the instance. This second file shows the technique works against more than one path on the host.

A proof-of-concept video is referenced in the report but is not reproduced here.

Root cause

The compilerDirectivesAdd operation takes a filename from the request and reads that file from the server's filesystem. The endpoint does not restrict the supplied path to an expected directory or filename, and the ! character is accepted as a path separator, so a caller can walk to local files such as /etc/passwd. Because the endpoint is reachable without authentication, no credential check stands between the caller and the file read. The report frames the underlying mistake as trusting user input that arrives in a GET request after /compilerDirectivesAdd/.

Impact

An unauthenticated attacker can read local files on the web server that they would not normally have access to. The report gives application source code and configuration files containing sensitive information about how the website is configured as examples of what could be exposed. The researcher characterises the impact on the main server as catastrophic.

Fix

The report recommends sanitising user input and not trusting input that arrives in a GET request after /compilerDirectivesAdd/{Attackers_Coming_From_Here_To_Read_Local_Files}. Specifically, it suggests maintaining a whitelist of acceptable filenames and using a unique corresponding identifier to access the file, so that any request containing an invalid identifier is rejected. It also suggests sanitising any path traversal characters present in GET requests. The report does not state that a fix was applied.

Variants to test

  1. A positive result is a response containing file contents or a filesystem error that reveals the path was processed.
  2. A positive result is any response that returns content from outside the intended directory.
  3. A positive result is a response containing configuration values or secrets.
  4. A positive result is the same file content returned to an anonymous caller, confirming the unauthenticated condition.

Hunting notes

This bug hides in exposed management interfaces, particularly Jolokia endpoints that bridge JMX over HTTP and expose DiagnosticCommand operations. The researcher demonstrated impact by reading two distinct system files, /etc/passwd and /etc/crontab, which shows the traversal is general rather than tied to one path, and by doing so without credentials.

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. 9 min read.

What happened, in plain words

A security researcher found that a web server belonging to the U.S. Department of Defence would happily hand over files that live on the server itself, to anyone who asked, without needing a username or password. The server read the file and sent its contents back.

To understand why this is serious, imagine a hotel reception desk that has a drawer of guest records. Normally the clerk only fetches a record when you give a valid room number. Now imagine the clerk also accepts the instruction "fetch whatever is written on this slip of paper", and you write "the staff payroll folder" on the slip. The clerk walks to the back office and brings it to you. That is roughly what happened here: a feature meant to read one specific kind of file was persuaded to read any file on the machine.

The researcher showed it by reading two well-known system files, /etc/passwd and /etc/crontab. Neither of those is a password database in the modern sense, but they reveal who has accounts on the machine and what scheduled jobs run on it, which is useful information for someone planning a further attack. The report rates the issue as high severity and calls the potential impact on the main server catastrophic.

The pieces involved

Before walking through the steps, here are the ideas you need. Each one is explained from scratch.

A URL is just an address

When you type something into your browser's address bar, you are sending a request to a computer somewhere. The address has parts: the machine to talk to (https://████/), the path to a feature on that machine (/jolokia/...), and sometimes extra data at the end. Everything in this report happens by changing the path part of the address. No special software is needed; a browser is enough.

What an API is

An API (application programming interface) is a way for one program to ask another program to do something, using a fixed set of addresses and rules. Think of a restaurant menu: you do not walk into the kitchen, you pick an item from the menu and the kitchen prepares it. An API is the menu, and each address on it is one dish. The server in this report exposes an API over ordinary web requests, which is why a browser can talk to it.

What Jolokia is

Jolokia is a small piece of software that sits in front of a Java program's management system and lets you reach it over HTTP, the same protocol your browser uses. Java programs have a built-in management facility called JMX, which lets an operator inspect and control the running program. Normally JMX is reached with special Java tools. Jolokia translates those operations into web addresses so that any HTTP client, including a browser, can call them.

Each manageable thing inside a Java program is called an MBean (managed bean). You can think of an MBean as a control panel with labelled buttons. Each button is an operation you can invoke. Jolokia's /jolokia/exec/ address is how you press one of those buttons from outside.

The MBean and operation in this report

The MBean here is named com.sun.management:type=DiagnosticCommand. "Diagnostic" means it is there to help operators diagnose problems in a running Java program. The particular button being pressed is compilerDirectivesAdd.

That is the design decision that becomes the vulnerability.

What local file inclusion and path traversal mean

Local file inclusion (LFI) means a program is tricked into including, or reading, a file from the machine it runs on, rather than only the files it was meant to serve. Path traversal is the technique of crafting a file path that escapes the folder you were supposed to stay in and reaches somewhere else. If a program expects directives/mine.txt and you instead give it a path that climbs out to /etc/passwd, you have traversed out of the intended folder.

In this case the traversal is done with an unusual character. The report says the ! symbol is used "at every new directory injected", meaning each slash in the target path is written as !. So the path /etc/passwd is written as !/etc!/passwd when appended to the endpoint. The server accepts ! as a separator and walks to the file.

What "unauthenticated" means

Authentication is how a system checks who you are, usually with a username and password, or with a cookie or token that proves you logged in earlier. A cookie is a small piece of data your browser stores and sends back with each request; a token is similar but usually carried in a header. "Unauthenticated" means the feature works without any of that. The researcher states the file read works "even being Unauthenticated", so no login, cookie or token was needed.

Setting up

The report describes no account, no role and no special tooling. The only precondition is that the Jolokia endpoint can be reached without logging in. Because the whole attack is a crafted URL, a browser or any program that can fetch a web address is enough. There is nothing to install.

Finding it

Since the operation reads a file from the server's disk, the filename in the URL is a path the caller controls.

Exploitation

The base endpoint, the address of the button before any filename is added, is:

Text
https://██████████/jolokia/exec/com.sun.management:type=DiagnosticCommand/compilerDirectivesAdd/

Reading this address from left to right: https:// is the protocol, ██████████ is the server, /jolokia/exec/ says "invoke an operation through Jolokia", com.sun.management:type=DiagnosticCommand names the MBean (the control panel), and compilerDirectivesAdd/ names the button. Everything typed after that final slash is treated as the filename argument.

That last part is the important bit. The endpoint expects a filename there. The attacker supplies a path instead, and each directory separator in that path is written as !. So to ask for /etc/passwd, the attacker appends !/etc!/passwd to the base endpoint.

Step 1: Read /etc/passwd

HTTP
https://███/jolokia/exec/com.sun.management:type=DiagnosticCommand/compilerDirectivesAdd/!/etc!/passwd

Line by line, in plain words:

  • https://███ is the server being contacted.
  • /jolokia/exec/ tells Jolokia that an operation is being invoked.
  • com.sun.management:type=DiagnosticCommand selects the diagnostic control panel.
  • compilerDirectivesAdd/ selects the button that loads a directives file.
  • !/etc!/passwd is the argument: the path /etc/passwd, with each slash written as !.

Why this step: /etc/passwd is a standard file on Unix-like systems that lists the user accounts on the machine. It is a convenient first target because it is always present and its contents are easy to recognise. The report states that this request returns the listed users on the instance, which confirms the server read and returned a file from outside the intended directives directory.

Step 2: Read /etc/crontab

HTTP
https://████/jolokia/exec/com.sun.management:type=DiagnosticCommand/compilerDirectivesAdd/!/etc!/crontab

Line by line:

  • The address is the same up to compilerDirectivesAdd/.
  • The argument is now !/etc!/crontab, which is the path /etc/crontab with ! as the separator.

Why this step: /etc/crontab is the system file that defines scheduled jobs, tasks the machine runs automatically at set times. Reading it tells an attacker what runs and when, which is useful for planning further attacks. It shows the read is not limited to one well-known file.

The report also references a proof-of-concept video, but it is not reproduced here.

Why it works

The compilerDirectivesAdd operation takes a filename from the request and reads that file from the server's disk. The endpoint does not restrict the supplied path to an expected folder or filename, and it accepts ! as a path separator, so a caller can walk to local files such as /etc/passwd. Because the endpoint is reachable without authentication, there is no credential check between the caller and the file read. The report frames the underlying mistake as trusting user input that arrives in a GET request after /compilerDirectivesAdd/.

A GET request is the ordinary kind of request your browser makes when you open a page: it asks the server to give you something. The report's point is that the server took whatever came in that request and used it as a file path without checking it.

Impact

An unauthenticated attacker can read local files on the web server that they would not normally have access to. The report gives application source code and configuration files containing sensitive information about how the website is configured as examples of what could be exposed. The researcher characterises the impact on the main server as catastrophic.

Fix

The report recommends sanitising user input and not trusting input that arrives in a GET request after /compilerDirectivesAdd/{Attackers_Coming_From_Here_To_Read_Local_Files}. "Sanitising" means cleaning the input so that dangerous characters or paths cannot be used. Specifically, it suggests keeping a whitelist of acceptable filenames and using a unique corresponding identifier to access the file, so that any request containing an invalid identifier is rejected. A whitelist is the opposite of a blacklist: instead of trying to block bad values, you allow only a known list of good ones. It also suggests sanitising any path traversal characters present in GET requests. The report does not state that a fix was applied.

Other things worth trying

These are follow-up checks in the same spirit, useful if you ever meet a similar endpoint.

  1. A positive result is a response containing file contents, or a filesystem error that shows the path was processed.
  2. A positive result is any response that returns content from outside the intended directory.
  3. A positive result is a response containing configuration values or secrets.
  4. A positive result is the same file content returned to an anonymous caller, confirming the unauthenticated condition.

How to spot this kind of bug

This bug hides in exposed management interfaces, particularly Jolokia endpoints that bridge JMX over HTTP and expose DiagnosticCommand operations. The researcher demonstrated impact by reading two distinct system files, /etc/passwd and /etc/crontab, which shows the traversal is general rather than tied to one path, and by doing so without credentials.

Glossary

  • API: a fixed set of addresses and rules that lets one program ask another to do something, like a restaurant menu.
  • Authentication: the process of proving who you are, usually with a username and password or a stored cookie or token.
  • Cookie: a small piece of data a website stores in your browser, which the browser sends back with later requests.
  • Crontab: a system file that defines jobs the machine runs automatically on a schedule.
  • DiagnosticCommand: a Java management MBean that exposes diagnostic operations, including compilerDirectivesAdd.
  • GET request: the ordinary web request a browser makes to ask a server for something.
  • HTTP: the protocol browsers and servers use to exchange requests and responses.
  • Java virtual machine (JVM): the program that runs Java code.
  • JMX: Java's built-in management facility for inspecting and controlling a running Java program.
  • Jolokia: software that exposes JMX operations over HTTP so any web client can call them.
  • Local file inclusion (LFI): tricking a program into reading a file from the machine it runs on, beyond the files it was meant to serve.
  • MBean: a manageable component inside a Java program, like a control panel with labelled buttons.
  • Path traversal: crafting a file path that escapes the intended folder to reach another location.
  • Sanitising: cleaning input so dangerous characters or paths cannot be used.
  • Token: a piece of data, usually sent in a request header, that proves a previous login.
  • Unauthenticated: reachable without any login, cookie or token.
  • URL: the address of something on the web, typed into a browser or sent by a program.
  • Whitelist: a list of values that are allowed, with everything else rejected.

More by todayisnew-

View all

2 more disclosed reports, best first.

More from U.S. Dept Of Defense

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.