多重判断php d代码,phpd代码审计
*获取源码
*网站结构
*入口文件
*配置文件
*过滤功能
审计方法-通读全文法
disable_functions
disable_classes
safe_mode=off
safe_mode_exec_dir=/var/www/html
file_uploads=on
upload_max_filesize=8M
文件上传目录
upload_tmp_dir=
用户访问目录限制
open_basedir=
display_error=on
error_reporting=E_ALL
error_log=
log_errors=on
log_errors_max_length=1024
magic_quotes_gpc=On
magic_quotes_runtime=Off
allow_url_fopen = on
allow_url_include = Off
常见危险函数及特殊函数
eval()
assert()
preg_replace()
preg_replace("/test/e",$_GET['h'],"just test");
?h=phpinfo(),phpinfo()将会执行
create_function()
call_user_func()
call_func_array()
require
include
require_once
include_once
命令执行函数
exec()
passthru()
proc_open()
shell_exec()
system()
popen()
文件操作函数
copy
file_get_contents
file_put_contents
file
fopen
move_uploaded_file
readfile
rename
rmdir
unlink & delete
特殊函数
phpinfo()
symlink()
getenv()
putenv()
dl()
配置相关
ini_get()
ini_set
ini_alter
ini_restore
数字判断
is_numeric
数组相关
in_array
变量覆盖
parse_str()
mb_parse_str
extract()
import_request_variables()
列目录
glob
无参数获取信息
get_defined_vars
get_defined_constants
get_defined_functions
get_includes_files
error_reporting(E_ALL);
print_r($_GET);
print_r($_POST);
echo "The var \$test is ".(isset($test)?"defined :\$test=$test":"undefined");
$tag_var = 'short tags';
?>
= $tag_var?>
print_r(scandir(dirname(__FILE__)));
echo "\r\n";
print_r(scandir(dirname(__FILE__)."/../"));
@eval('echo "test"');
echo "\r\n";
echo 'test';
assert('system("whoami");');
preg_replace("/test/e", "phpinfo();", "just test");
$cfunc = create_function('$v', 'return system($v);');
$cfunc('whoami');
$sfunc = 'sys'.'tem';
$sfunc('whoami');
function test($var){
echo 'callable test '.$var;
}
call_user_func('test','amu');
call_user_func('system','whoami');
?>
/*
echo "\r\n
allow_url_include=".(ini_get('allow_url_include')?'On':'Off');
echo "\r\n
allow_url_fopen=".(ini_get('allow_url_fopen')?'On':'Off');
echo "\r\n";
include($_GET['v']);
*/
/*
echo shell_exec('ping 127.0.0.1');
echo shell_exec('ping '.$_GET["v"]);//?v=127.0.0.1 | whoami
*/
/*
file_put_contents('fpc.test', 'test');
file_put_contents('fpc.test', file_get_contents("http://www.baidu.com"));
unlink('fpc.test');
*/
/*
var_dump(getenv('test'));
putenv('test=123');
echo "\r\ntest=".getenv('test');
*/
/*
echo "\r\n
display_errors=".(ini_get('display_errors')?'On':'Off');
ini_set("display_errors", 0);
echo "\r\n
display_errors=".(ini_get('display_errors')?'On':'Off');
*/
/*
echo "is_numeric :";
var_dump(is_numeric($_GET["v"]));//?v=127' ?v=0e1 ?v=0x123
echo "\r\n";
echo "output :".$_GET["v"];
echo "\r\n";
echo "intval :".intval($_GET["v"]);
*/
/*
$v = 1;
var_dump(in_array($v, array("1",2,3)));
echo "\r\n";;
$a = '1abc'; // '1abc' == 1
in_array($a, array(1,2,3));//in_array($a, array(1,2,3),true);
in_array($a, array("2",2,3));
*/
/*
$str = "first=value&arr[]=foobar&arr[]=baz";
echo "
";
parse_str($str,$array);
print_r($array);
var_dump(isset($first));
parse_str($str);
var_dump(isset($first));
echo "\$arr[0]=$arr[0]";
echo "\$arr[1]=$arr[1]";
*/
/*
echo "
";
print_r(glob("t*.php"));
*/
echo "
";
$test = 'test';
print_r(get_defined_vars());
define("TEST", 'test');
echo "
";
print_r(get_defined_constants(true));
function abc(){}
print_r(get_defined_functions());
?>
$password = 'sfdsfsdfsdfdffdfdf';
if (isset($_POST['passwd'])) {
$pass = $_POST['passwd'];
if ($pass === $_POST['passwd']) {
webshell();
} else {
echo "password is error";
}
} else {
echo '
';
exit;
}
function webshell(){
echo "this is a test";
}
Xdebug的配置PHP.ini
xdebug.auto_trace = 1
xdebug.trace_format = 0
xdebug.trace_output_dir="D:\phpStudy\tmp\xdebug"
xdebug.trace_options = 0
xdebug.collect_params = 4
xdebug.collect_return = 1
xdebug.collect_vars = 1
xdebug.collect_assignments = 1
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir="D:\phpStudy\tmp\xdebug"
xdebug.profiler_output_name = "cache.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
zend_extension="D:\phpStudy\php\php-5.4.45\ext\php_xdebug.dll"
多重判断php d代码,phpd代码审计相关推荐
- layuiAdmin多重判断代码。
layuiAdmin多重判断代码. {{# if(true){ }}条件1 {{# } else if(true){ }} 条件2 {{# } else if(true){ }} 条件3 {{# } ...
- python基础学习06_if条件判断(多重判断、嵌套、三目运算)
一.条件语句: 条件成立执行某些代码,条件不成立执行哪些代码. 二.IF 条件判断 IF简单条件判断 多重判断 IF嵌套 三目运算符 1.if 简单条件判断 if """ ...
- If……else if的多重判断
If--else if的多重判断 开发工具与关键技术:Visual Studio + HTML 撰写时间:2019年6月5日 1. 在很多时候往往都会用到判断语句.要在多组语句中选择一组来执行,这就可 ...
- case....when ...多重判断
CASE...WHEN 进行多重判断 CASE WHEN A IS NOT NULL THEN B WHEN C IS NULL THEN CASE WHEN D IS NOT NULL THEN ...
- php常用判断蜘蛛的代码
//php常用判断蜘蛛的代码 if(stripos($agent,'Baiduspider') == false&&stripos($agent,'360Spider') == fal ...
- C#开发笔记之09-如何用C#判断社会信用代码是否合法?
本文由 比特飞 原创发布,欢迎大家踊跃转载. 转载请注明本文地址:C#开发笔记之09-如何用C#判断社会信用代码是否合法? | .Net中文网. C#开发笔记概述 概述 法人和其他组织统一社会信用代码 ...
- Java代码制作ie浏览器_[Java教程]判断IE浏览器代码实例
[Java教程]判断IE浏览器代码实例 0 2015-08-12 01:00:19 判断IE浏览器代码实例: 由于当下浏览器类型众多,并且对同一段代码的解读有时候各有不同,所以要根据浏览器的类型来执行 ...
- MyBatis的mapper.xml中对于一个传参的多重判断
MyBatis中的mapper.xml中对于一个传递参数的多重判断 <where><if test="stockOrderNum!=null"><if ...
- js获取传统节假日_js判断节假日的代码分享
js判断节假日实例代码 效果展示: /************************************************************* * 判断某天是不是工作日 * * @ ...
- php根据日期判断星座if函数,js根据日期判断星座的代码
例子,js根据日期判断星座. 代码: 复制代码 代码示例: function xingzuo() { var start = 1901, date=document.getElementById(&q ...
最新文章
- 【Qt】QMainWindow最大化按钮是灰色(不能最大化)的解决方法
- python编程爱心-520用Python画一颗特别的爱心送给她
- 进程内COM与进程外COM
- After Effects 2019 CC for mac下载安装激活步骤演示
- android studio撤销按钮,Android Studio无法撤消(Android Studio Can't Undo)
- LeetCode 1732. 找到最高海拔
- java 马克思_单链表-Java
- 客座编辑:吴东亚(1972-),女,中国电子技术标准化研究院信息技术研究中心高级工程师、副主任,国家OID注册中心副主任。...
- sqlmap简单中文说明
- Maven学习总结(4)——Maven核心概念
- 献给自己技术成长的第二年
- 腾讯云服务器安全加固主机安全基础版和DDoS基础防护内容
- 如何利用MATLAB调用手机摄像头(手把手教程)
- Arduino循迹小车教程一----材料篇
- 数据库如何备份与恢复
- Unity:锚点详解
- linux内核丢弃udp报文,内核udp报文截取、修改和发送
- 【Vue项目实战】vue.js2.5 饿了么APP(1)概述+项目准备
- [转]数据分析与处理之二:Leveldb 实现原理
- php网站动态设计代码,玩转PHP动态网页设计