Php注入点构造
把下面保存成 Test.php
<?
$mysql_server_name = "localhost";
$mysql_username = "root";
$mysql_password = "password";
$mysql_database = "phpzr"; //??ݿ??
$conn=mysql_connect( $mysql_server_name, $mysql_username, $mysql_password );
mysql_select_db($mysql_database,$conn);
$id=$_GET['id'];
$sql = "select username,password from admin where id=$id";
$result=mysql_db_query( $mysql_database, $sql,$conn );
$row=mysql_fetch_row($result);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Php Sql Injection Test </title>
</head>
<body>
<p align="center"><b><font color="#FF0000" size="5" face="华文行楷"> </font><font color="#FF0000" size="5" face="华文新魏">PHP
注入测试专用</font></b></p>
<table width="100%" height="25%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><?=$row[0]?></td>
</tr>
<tr>
<td><?=$row[1]?></td>
</tr>
</table>
<p><u><font color="#0000FF">94yy</font></u></p>
<p><font color="#0000FF">Blog: Http://www.cnblogs.com/94yy</font></p>
<p> </p>
</body>
</html>
看到了吧ID没有任何过滤就提交到数据库
在MYSQL命令行下执行下面的SQL语句就行,你也可以
保存成test.sql 使用phpmyadmin执行就ok了,在MYSQL命令行下执行CREATE DATABASE `phpzr` ; 然后输入USE phpzr 就是进入这个数据库,然后输入其他语句
CREATE DATABASE `phpzr` ; //创建数据库名称
CREATE TABLE admin (
id int(10) unsigned NOT NULL auto_increment,
username char(10) NOT NULL default '',
password char(10) NOT NULL default '',
useremail char(20) NOT NULL default '',
groupid int(11) NOT NULL default '0',
PRIMARY KEY (id)
) TYPE=MyISAM;
INSERT INTO admin VALUES (1, 'admin', 'www.cnblogs.com/94yy','94yy@qq.com', 1);
INSERT INTO admin VALUES (2, 'admin1', 'www.cnblogs.com/94yy','94yy@qq.com', 2);
INSERT INTO admin VALUES (3, 'admin2', 'www.cnblogs.com/94yy','94yy@qq.com', 3);
INSERT INTO admin VALUES (4, 'admin3', 'www.cnblogs.com/94yy','94yy@qq.com', 4);
INSERT INTO admin VALUES (5, 'admin4', 'www.cnblogs.com/94yy','94yy@qq.com', 5);
CREATE TABLE admin1 (
id int(10) unsigned NOT NULL auto_increment,
username char(10) NOT NULL default '',
password char(10) NOT NULL default '',
useremail char(20) NOT NULL default '',
groupid int(11) NOT NULL default '0',
PRIMARY KEY (id)
) TYPE=MyISAM;
INSERT INTO admin1 VALUES (1, 'admin', 'www.cnblogs.com/94yy','94yy@qq.com', 1);
INSERT INTO admin1 VALUES (2, 'admin1', 'www.cnblogs.com/94yy','94yy@qq.com', 2);
INSERT INTO admin1 VALUES (3, 'admin2', 'www.cnblogs.com/94yy','94yy@qq.com', 3);
INSERT INTO admin1 VALUES (4, 'admin3', 'www.cnblogs.com/94yy','94yy@qq.com', 4);
INSERT INTO admin1 VALUES (5, 'admin4', 'www.cnblogs.com/94yy','94yy@qq.com', 5);
然后打开http://localhost/test.php?id=1一个注入页面就构成了。