From f7555d51f5c34d0a0301474a02b273be52501b23 Mon Sep 17 00:00:00 2001 From: tennc <670357+tennc@users.noreply.github.com> Date: Sun, 30 May 2021 18:49:29 +0800 Subject: [PATCH] Update readme.md --- php/MemShellForPHP/readme.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/php/MemShellForPHP/readme.md b/php/MemShellForPHP/readme.md index 43debb4..d872afc 100644 --- a/php/MemShellForPHP/readme.md +++ b/php/MemShellForPHP/readme.md @@ -1,14 +1,14 @@ # 内存驻留webshell ## 一、攻击原理 php webshell文件执行后删除自身。此webshell在执行后会自身删除,驻留内存之中,无文件残留。其原理主要利用以下方法: - ignore_user_abort(true); // 后台运行 + `ignore_user_abort(true); // 后台运行` 这个函数的作用是指示服务器端在远程客户端关闭连接后是否继续执行下面的脚本。如设置为True,则表示如果用户停止脚本运行,仍然不影响脚本的运行 - set_time_limit(0); // 取消脚本运行时间的超时上限 + `set_time_limit(0); // 取消脚本运行时间的超时上限` 括号里边的数字是执行时间,如果为零说明永久执行直到程序结束,如果为大于零的数字,则不管程序是否执行完成,到了设定的秒数,程序结束。 脚本也有可能被内置的脚本计时器中断。默认的超时限制为30秒。 -这个值可以通过设置 php.ini 的 max_execution_time 或 Apache .conf 设置中对应的“php_value max_execution_time”参数或者 set_time_limit() 函数来更改。 +这个值可以通过设置 `php.ini 的 max_execution_time` 或 `Apache .conf` 设置中对应的`“php_value max_execution_time”`参数或者 `set_time_limit()` 函数来更改。 php删除自身时借助的函数为 - unlink($_SERVER['SCRIPT_FILENAME']); + `unlink($_SERVER['SCRIPT_FILENAME']);` unlink函数运行条件较为苛刻,该脚本要具备可执行权限、可修改文件权限时方能执行。 简单的webshell脚本: ``` php @@ -27,7 +27,7 @@ unlink函数运行条件较为苛刻,该脚本要具备可执行权限、可 ?> ``` test.txt中的代码如下: - file_put_contents('printTime.txt','jweny '.time()); + ` file_put_contents('printTime.txt','jweny '.time());` webshell执行后,删除自身,并在该目录生成 printTime.txt,每五秒一次写入一次时间戳。 ## 二、检测方案 通过获取php-fpm status: