从Apache / PHP查找出站连接

一个客户网站最近遭到了破坏,我们正在分析攻击造成的损失和曝光。 我们已经find了一个脚本,可以在日志中很容易地find一个URL“回家”,但是这个日志logging在哪里?

/usr/local/apache/logs/access_log 

是否在此文件中logging了出站连接(来自file_get_contents和URL包装器,如HTTP)的连接?

你可以修改suhosin来模拟实际模拟的模式,然后将用来打开外部连接的命令列入黑名单。 我发布的代码修复了一天,但是,该线程被删除。

suhosin-0.9.27 / execute.c行1588行,注释掉execute_internal_bailout;

 if(SUHOSIN_G(func_blacklist) != NULL) { if(zend_hash_exists(SUHOSIN_G(func_blacklist), lcname, function _name_strlen+1)) { suhosin_log(S_EXECUTOR, "function within blacklist called: %s()", lcname); // goto execute_internal_bailout; } } 

(wiki维护着这些代码,不会花时间去尝试和弄清楚)

模拟模式是默认的:

 suhosin.simulation = on suhosin.executor.func.blacklist = include,include_once,require_once,open,file_get_contents 

添加任何你想logging的附加命令。 你会得到一个日志条目,如:

机器XX suhosin [1086]:ALERT-SIMULATION – 黑名单中的函数称为:exec()(攻击者'11 .22.71.67',文件'/var/www/domain.com/tp/top_thumb.php' ,第283行)

从那里,至less你有一套目标文件来看看。 我不推荐以这种方式使用suhosin,但是当你在大海捞针时,有时候你需要使工具按照他们的方式工作。

除非你的应用程序/ PHP网站有一个日志logging系统,否则你不能看到谁做了什么。

Apache或PHP不保留出站连接日志。

yeap php和apache不会logging任何出站连接..无论如何要运行php脚本,你需要有一个来自用户的请求。 你总是可以看到谁启动了脚本。 要监视出站连接,您可以设置防火墙并logging所有正在出现的事件,然后configuration日志系统以从每个需要的软件包中获取连接。