php-malware-finder

Detect potentially malicious PHP files

  • 所有者: jvoisin/php-malware-finder
  • 平台:
  • 許可證: GNU Lesser General Public License v3.0
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Build Status

PHP Malware Finder

 _______  __   __  _______, ___, _, ___, ___, ___   Webshell finder,, ___, ___, kiddies hunter,, _, website cleaner., ___, _, _, ___, Detect potentially malicious PHP files.

What does it detect?

PHP-malware-finder does its very best to detect obfuscated/dodgy code as well as
files using PHP functions often used in malwares/webshells.

The following list of encoders/obfuscators/webshells are also detected:

Of course it's trivial to bypass PMF,
but its goal is to catch kiddies and idiots,
not people with a working brain.
If you report a stupid tailored bypass for PMF, you likely belong to one (or
both) category, and should re-read the previous statement.

How does it work?

Detection is performed by crawling the filesystem and testing files against a
set
of YARA rules. Yes, it's that simple!

Instead of using an hash-based approach,
PMF tries as much as possible to use semantic patterns, to detect things like
"a $_GET variable is decoded two times, unzipped,
and then passed to some dangerous function like system".

Installation

  • Install Yara.
    This is also possible via some Linux package managers:
    • Debian: sudo apt-get install yara
    • Red Hat: yum install yara (requires the EPEL repository)

You can also compile it from source:

git clone git@github.com:VirusTotal/yara.git
cd yara/
YACC=bison ./configure
make
  • Download php-malware-finder git clone https://github.com/jvoisin/php-malware-finder.git

How to use it?

$ ./phpmalwarefinder -h
Usage phpmalwarefinder [-cfhtvl] <file, folder> ...
    -c  Optional path to a rule file
    -f  Fast mode
    -h  Show this help message
    -t  Specify the number of threads to use (8 by default)
    -v  Verbose mode

Or if you prefer to use yara:

$ yara -r ./php.yar /var/www

Please keep in mind that you should use at least YARA 3.4 because we're using
hashes for the
whitelist system, and greedy regexps. Please note that if you plan to build
yara from sources, libssl-dev must be installed on your system in order to
have support for hashes.

Oh, and by the way, you can run the comprehensive testsuite with make tests.

Whitelisting

Check the whitelist.yar file.
If you're lazy, you can generate whitelists for entire folders with the
generate_whitelist.py script.

Why should I use it instead of something else?

Because:

  • It doesn't use a single rule per sample, since it only cares about finding malicious patterns, not specific webshells
  • It has a complete testsuite, to avoid regressions
  • Its whitelist system doesn't rely on filenames
  • It doesn't rely on (slow) entropy computation
  • It uses a ghetto-style static analysis, instead of relying on file hashes
  • Thanks to the aforementioned pseudo-static analysis, it works (especially) well on obfuscated files

Licensing

PHP-malware-finder is
licensed
under the GNU Lesser General Public License v3.

The amazing YARA project is licensed under the Apache v2.0 license.

Patches, whitelists or samples are of course more than welcome.

主要指標

概覽
名稱與所有者jvoisin/php-malware-finder
主編程語言PHP
編程語言Makefile (語言數: 7)
平台
許可證GNU Lesser General Public License v3.0
所有者活动
創建於2015-07-02 09:29:21
推送於2023-10-20 16:02:54
最后一次提交2023-05-06 15:33:56
發布數7
最新版本名稱0.3.5 (發布於 2018-01-19 17:17:44)
第一版名稱0.2.2 (發布於 )
用户参与
星數1.5k
關注者數73
派生數283
提交數364
已啟用問題?
問題數88
打開的問題數9
拉請求數27
打開的拉請求數2
關閉的拉請求數11
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?