html - html_entity_decode doesn't seem to work laravel php -
i'm trying decode html entities of javascript code. doesn't seem work, still outputs encoded html elements. %3cscript%3 needs become < script >
array content array ( [0] => http://localhost:8888//index.php?email=%3cscript%3ealert%28%27biatg906op%27%29%3c%2fscript%3e%0a [1] => http://localhost:8888//index.php?email=%3cscript%3ealert%28%22biatg906op%22%29%3c%2fscript%3e%0a [2] => http://localhost:8888//index.php?email=%3cscript%3ealert%28%27biatg906op%27%29%3c%2fscript%3e%0a [3] => http://localhost:8888//index.php?email=%3cscript%3ealert%28%22biatg906op%22%29%3c%2fscript%3e%0a ... ) $xss_array = explode("=", $value); $xss_attack = html_entity_decode($xss_array[1]); echo 'attack: ' . $xss_attack.php_eol; output attack: %3cscript%3ealert%28%27khp9s5z73u%27%29%3c%2fscript%3e%0a attack: %3cscript%3ealert%28%22khp9s5z73u%22%29%3c%2fscript%3e%0a attack: %3cscript%3ealert%28%27khp9s5z73u%27%29%3c%2fscript%3e%0a attack: %3cscript%3ealert%28%22khp9s5z73u%22%29%3c%2fscript%3e%0a
this not html not decode html_entity_decode().
you can resolve using urldecode().
code:
<?php $val= "http://localhost:8888//index.php?email=%3cscript%3ealert%28%27biatg906op%27%29%3c%2fscript%3e%0a"; $xss_array = explode("=", $val); $xss_attack = urldecode($xss_array[1]); echo 'attack: ' . $xss_attack.php_eol; output:
attack: <script>alert('biatg906op')</script> demo: click here
Comments
Post a Comment