sql和shell注入测试
来源:互联网 发布:淘宝店铺没有流量怎么办 编辑:程序博客网 时间:2024/05/01 07:18
1.整数型参数,必须intval转义,用addslashes转义不行
<?php
$test = $_REQUEST["test"];
$test = addslashes($test);
$sql =" select * from tbl1 where id=$test";
print $sql;
//输入test=1 or 1=1 得到 select * from tbl1 where id=1 or 1=1被注入
?>
<?php
$test = $_REQUEST["test"];
$test = intval($test);
$sql =" select * from tbl1 where id=$test";
print $sql;
//输入 test=1 or 1=1 得到 select * from tbl1 where id=1
?>
2.字符串型参数,必须addslashes转义
<?php
$test = $_REQUEST["test"];
$sql =" select * from tbl1 where xxx='$test'";
print $sql;
//输入 test=1 or 1=1 得到 select * from tbl1 where xxx='1' or 1=1' 被注入
?>
<?php
$test = $_REQUEST["test"];
$test = addslashes($test);
$sql =" select * from tbl1 where xxx='$test'";
print $sql;
//输入 test=1 or 1=1 得到 select * from tbl1 where xxx='1\' or 1=1'
?>
3.执行系统命令的,必须 escapeshellarg 转义
<?php
$test = $_REQUEST["test"];
$cmd ="host ".$test;
print $cmd;
//输入test=www.baidu.com%26%26uname 得到 host www.baidu.com&&uname ,越界命令被执行了
?>
<?php
$test = $_REQUEST["test"];
$test = addslashes($test);
$cmd ="host ".$test;
print $cmd;
//输入test=www.baidu.com%26%26uname 得到 host www.baidu.com&&uname ,越界命令被执行了,addslashes不能防护shell注入
?>
<?php
$test = $_REQUEST["test"];
$test = escapeshellarg($test);
$cmd ="host ".$test;
print $cmd;
//输入test=www.baidu.com%26%26uname 得到 host "www.baidu.com&&uname"
?>
<?php
$test = $_REQUEST["test"];
$test = addslashes($test);
$sql =" select * from tbl1 where id=$test";
print $sql;
//输入test=1 or 1=1 得到 select * from tbl1 where id=1 or 1=1被注入
?>
<?php
$test = $_REQUEST["test"];
$test = intval($test);
$sql =" select * from tbl1 where id=$test";
print $sql;
//输入 test=1 or 1=1 得到 select * from tbl1 where id=1
?>
2.字符串型参数,必须addslashes转义
<?php
$test = $_REQUEST["test"];
$sql =" select * from tbl1 where xxx='$test'";
print $sql;
//输入 test=1 or 1=1 得到 select * from tbl1 where xxx='1' or 1=1' 被注入
?>
<?php
$test = $_REQUEST["test"];
$test = addslashes($test);
$sql =" select * from tbl1 where xxx='$test'";
print $sql;
//输入 test=1 or 1=1 得到 select * from tbl1 where xxx='1\' or 1=1'
?>
3.执行系统命令的,必须 escapeshellarg 转义
<?php
$test = $_REQUEST["test"];
$cmd ="host ".$test;
print $cmd;
//输入test=www.baidu.com%26%26uname 得到 host www.baidu.com&&uname ,越界命令被执行了
?>
<?php
$test = $_REQUEST["test"];
$test = addslashes($test);
$cmd ="host ".$test;
print $cmd;
//输入test=www.baidu.com%26%26uname 得到 host www.baidu.com&&uname ,越界命令被执行了,addslashes不能防护shell注入
?>
<?php
$test = $_REQUEST["test"];
$test = escapeshellarg($test);
$cmd ="host ".$test;
print $cmd;
//输入test=www.baidu.com%26%26uname 得到 host "www.baidu.com&&uname"
?>
- sql和shell注入测试
- oracle sql注入测试
- 安全测试-SQL注入
- SQL手工注入测试
- 安全测试-SQL注入
- bugku SQL注入测试
- 如何防范SQL注入 SQL注入测试
- 注入攻击-SQL注入和代码注入
- SQL注入终级测试
- Sql注入测试-Pangolin 穿山甲
- 安全测试--SQL注入攻击
- 软件测试中的SQL注入
- SQL注入测试实例分析
- 安全测试-手工SQL注入
- sql website注入 渗透测试
- 安全测试之sql注入
- sqlmap做sql注入测试
- SQL注入测试的测试点
- 原来我不懂 he
- Google 的 Objective-C 代码规范指南
- 【学习日记】ASP.NET[基础二(aspx)]
- 当你不想学习的时候,来看看大脑是怎么想的《摘抄与所想》
- 反素数
- sql和shell注入测试
- Android 内存溢出解决方案(OOM) 整理总结
- 【树形DP】 HDU 3721 Building Roads
- c#中打开视频,word
- svchost.exe 99%cpu 143m ram 占用解决方法
- 黑马程序员 高新部分
- va_list , va_start , va_arg , va_end详解
- 页面刷新代码
- PHP 错误处理