mysql> SELECT ExtractValue('<a>c</a><b/>', '/&a');ERROR 1105 (HY000): XPATH syntax error: '&a'
mysql> SELECT ExtractValue('<a>c</a><b', '//a');+-----------------------------------+| ExtractValue('<a>c</a><b', '//a') |+-----------------------------------+| NULL |+-----------------------------------+1 row in set, 1 warning (0.00 sec)mysql> SHOW WARNINGS\G*************************** 1. row ***************************Level: WarningCode: 1525Message: Incorrect XML value: 'parse error at line 1 pos 11:END-OF-INPUT unexpected ('>' wanted)'1 row in set (0.00 sec)mysql> SELECT ExtractValue('<a>c</a><b/>', '//a');+-------------------------------------+| ExtractValue('<a>c</a><b/>', '//a') |+-------------------------------------+| c |+-------------------------------------+1 row in set (0.00 sec)
//user[login/text()='neapolitan' and password/text()='1c3cr34m']/attribute::id
SELECT id FROM users WHERE login='neapolitan' AND password='1c3cr34m';
<?php$file = "users.xml";$login = $POST["login"];$password = $POST["password"];$xpath = "//user[login/text()=$login and password/text()=$password]/attribute::id";if( file_exists($file) ){$xml = simplexml_load_file($file);if($result = $xml->xpath($xpath))echo "You are now logged in as user $result[0].";elseecho "Invalid login name or password.";}elseexit("Failed to open $file.");?>
//user[login/text()='' or 1=1 and password/text()='' or 1=1]/attribute::id
//user/attribute::id
$xpath = "//user[login/text()='$login' and password/text()='$password']/attribute::id";
mysql> SELECT ExtractValue(-> LOAD_FILE('users.xml'),-> '//user[login/text()="" or 1=1 and password/text()="" or 1=1]/attribute::id'-> ) AS id;+-------------------------------+| id |+-------------------------------+| 00327 13579 02403 42354 28570 |+-------------------------------+1 row in set (0.01 sec)
mysql> SELECT @id = ExtractValue(-> LOAD_FILE('users.xml'),-> '//user[login/text()="" or 1=1 and password/text()="" or 1=1]/attribute::id'-> );Query OK, 0 rows affected (0.00 sec)mysql> SELECT IF(-> INSTR(@id, ' ') = 0,-> @id,-> 'Unable to retrieve user ID')-> AS singleID;+----------------------------+| singleID |+----------------------------+| Unable to retrieve user ID |+----------------------------+1 row in set (0.00 sec)
文章转载自数据库杂货铺,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




