dmolsen / Detector

Detector is a simple, PHP- and JavaScript-based browser- and feature-detection library that can adapt to new devices & browsers on its own without the need to pull from a central database of browser information.
http://detector.dmolsen.com/
MIT License
844 stars 80 forks source link

[Security] XSS in _contactform.inc.php #35

Open seongil-wi opened 3 years ago

seongil-wi commented 3 years ago

Describe the bug Reflected Cross-Site Scripting (XSS) may allow an attacker to execute JavaScript code in the context of the victim’s browser. This may lead to unauthorized actions being performed, unauthorized access to data, stealing of session information, denial of service, etc. An attacker needs to coerce a user into visiting a link with the XSS payload to be properly exploited against a victim.

To Reproduce Steps to reproduce the behavior:

  1. Go to the page with following parameter: http://[localhost]/Detector/web/templates/_contactform.inc.php?cid=%3C/textarea%3E%3Cscript%3Ealert(1);%3C/script%3E
  2. Boom!

Screenshots

Where the Issue Occurred The code below displays the user-controlled parameter cid without sufficient sanitization: https://github.com/dmolsen/Detector/blob/f697794be555b4a2ce070a0b1265a1eb5f87fb58/web/templates/_contactform.inc.php#L22