Skip to Content
  • +31 653-919-302
Cafayate.Net
  • 0
  • 0
  • Sign in
  • Nederlands English (US) Español (AR)
  • Contact Us
  • Home
  • Blog
  • Jobs
  • Contact us
Cafayate.Net
  • 0
  • 0
    • Home
    • Blog
    • Jobs
    • Contact us
  • +31 653-919-302
  • Nederlands English (US) Español (AR)
  • Sign in
  • Contact Us

PHP Malware Finder

  • All Blogs
  • Tech Blog
  • PHP Malware Finder
  • March 5, 2021 by
    Administrator

     

    https://github.com/nbs-system/php-malware-finder

     

    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:

    • Best PHP Obfuscator
    • Carbylamine
    • Cipher Design
    • Cyklodev
    • Joes Web Tools Obfuscator
    • Php Obfuscator Encode
    • SpinObf
    • Weevely3
    • atomiku
    • cobra obfuscator
    • phpencode
    • webtoolsvn
    • tennc
    • web-malware-collection
    • P.A.S

    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 sentence.

    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, unziped, and then passed to some dangerous function like system“.

    How to use it?

    $ ./phpmalwarefinder -h
    Usage phpmalwarefinder [-cfhtv] [-l (php|asp)] <file|folder> ...
        -c  Optional path to a configuration file
        -f  Fast mode
        -h  Show this help message
        -t  Specify the number of threads to use (8 by default)
        -v  Verbose mode
        -l  Set language ('asp', 'php')
    

    Or if you prefer to use yara:

    $ yara -r ./php.yar /var/www
    $ yara -r ./asp.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.

    Ho, and by the way, you can run the comprehensive testsuite with make test.

    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
    • Its whitelist system doesn’t rely on filenames
    • It doesn’t rely on (slow) entropy calculation
    • It uses a ghetto-style static analysis, instead of relying on file hashes
    • Thanks to the aforementioned pseudo-static analysis, it works on obfuscated files too

    Licensing

    PHP-malware-finder is licensed under the GNU 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.

    in Tech Blog
    Exposing a directory on the host machine to an LXC container

    Designed for companies

    We are a team of passionate people whose goal is to improve everyone's life through disruptive products. We build great products to solve your business problems. Our products are designed for small to medium size companies willing to optimize their performance.

    Get in touch

    Plantexel
    Pedernera
    Salta Capital 
    Argenina

    • +31 653-919-302
    • [email protected]
    Follow us
    Copyright © Plantexel
    Nederlands | English (US) | Español (AR)