---
title: "Skill assessment pt1"
date: 2025-01-27
draft: false
---


 although source code of teh upload php script suggests only png,jpg,jpeg is allowed, it seems to accept the svg content-type 
![](/img/Pasted image 20241205070909.png)

this is great news for us. we can read source code (or even just directly read the flag at this point) - jk name of flag is not flag.txt in root so we need to get code execution, or we could even fuzz common files using the xxe exploit here but its likely a better decision to just get code execution.  

```bash
Content-Disposition: form-data; name="uploadFile"; filename="cat.jpg"

Content-Type: image/svg+xml
```

![](/img/Pasted image 20241205082707.png)

Basically: 
Retrieved upload source code page: 
![](/img/Pasted image 20241205104413.png)

Big notes here: 
Blacklist just checks only for php, phps, and phtml. *Important for later.

Whitelist just checks if the ending of the filename (last 2-3chars) ends with `g` 

MIME test checks if filetype mime is a valid image MIME type. 

Gives us file naming convention and upload destination 

This Burpsuite request is crafted using the source code: 

![](/img/Pasted image 20241205104529.png)
Filename is `malicious.phar.jpg` - passes the blacklist, and the whitelist. 
MIME type would match SVG, which passes the MIME filetype test. 
Filename contains `phar` meaning it is valid for php code execution. 

`http://94.237.59.180:53698/contact/user_feedback_submissions/241205_malicious.phar.jpg?cmd=cat%20/flag_2b8f1d2da162d8c44b3696a1dd8a91c9.txt` 

in addition to `ls /` etc allowed us to get code execution on the webserver to get the flag. 



