JamesHeinrich / getID3

http://www.getid3.org/
Other
1.15k stars 245 forks source link

Reflected XSS Vulnerability in demo.browse.php (all version?) #446

Closed j3rech0 closed 2 months ago

j3rech0 commented 3 months ago

File Location: \demos\demo.browse.php Vulnerable Parameter: filename=

Steps to Reproduce:

  1. Downloaded the file via github.
  2. Browse /demos/demo.browse.php and comment out the code in Line 15 or 16 that says die('For security reasons, this demo has been disabled. It can be enabled by removing line '.__LINE__.' in demos/'.basename(__FILE__));
  3. Then browse eg. https://YOUR_LOCAL_DOMAIN/getID3-VERSION/demos/demo.browse.php?filename=%3Cscript%3Ealert(1)%3C/script%3E

Affected version:

Tested in getID3-1.9.8, getID3-1.9.20, getID3-1.9.23, getID3-2.0.0-beta6 probably all?

PoC:

image

I have PoC on some running websites if you want other proof. Cheers!

JamesHeinrich commented 2 months ago

Please feel free to submit a proposed fix if you have one.

j3rech0 commented 2 months ago

@JamesHeinrich

https://github.com/JamesHeinrich/getID3/blob/641549245699b8f0c3c01cb201f39a7f22b49f1b/demos/demo.browse.php#L91

try wrapping with htmlentities

die(htmlentities(getid3_lib::iconv_fallback($FileSystemEncoding, $PageEncoding, $_REQUEST['filename']).' does not exist'));
JamesHeinrich commented 2 months ago

Changed in https://github.com/JamesHeinrich/getID3/commit/a1785afcccb4d32b41f2417c17fcd02bba072dc3