【红日Day12-CTF】htmlentities造成的SQL注入
练习记录 复现代码: index.php <?php require 'config.php' ; if ( isset ( $_REQUEST [ 'username' ] ) ) { if ( preg_match ( "/(?:\w*)\W*?[a-z].*(R|ELECT|OIN|NTO|HERE|NION)/i" , $_REQUEST [ 'username' ] ) ) { die ( "Attack detected!!!" ) ; } } if ( isset ( $_REQUEST [ 'password' ] ) ) { if ( preg_match ( "/(?:\w*)\W*?[a-z].*(R|ELECT|OIN|NTO|HERE|NION)/i" , $_REQUEST [ 'password' ] ) ) { die ( "Attack detected!!!" ) ; } } function clean ( $str ) { if ( get_magic_quotes_gpc ( ) ) { $str = stripslashes ( $str ) ; } return htmlentities ( $str , ENT_QUOTES ) ; } $username = @ clean ( ( string ) $_GET [