Skip to content

Commit 1d1bfcf

Browse files
author
Jonathan Visser
committed
Add doc on how to set up Sansec
1 parent 5646171 commit 1d1bfcf

3 files changed

Lines changed: 88 additions & 1 deletion

File tree

docs/best-practices/security/how-to-recover-a-hacked-magento-shop.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ In most cases this will be:
5050
- Install all the relevant patches, for both Magento and any plugins.
5151
- Upgrade your Magento to the latest version.
5252
- Configure brute force protection.
53+
- Run a malware scan using [Sansec eComscan](../../hypernode-platform/tools/how-to-set-up-sansec-ecomscan-on-hypernode.md), which comes preinstalled on your Hypernode.
5354
- Run a scan using the [Magento corediff scanner](../../hypernode-platform/tools/how-to-use-magento-corediff-on-hypernode.md). If any clearly suspicious files are found, move them to a non reachable directory (like `/data/web/hacked/`) for later analysis, remove them from your website, and restore a trusted copy of the affected files.
5455

5556
### Throw the Hacker Out
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
myst:
3+
html_meta:
4+
description: eComscan by Sansec is a malware and vulnerability scanner for webshops,
5+
preinstalled on every Hypernode. Learn how to run scans and set up monitoring.
6+
title: How to Set Up Sansec eComscan on Hypernode?
7+
---
8+
9+
# How to Set Up Sansec eComscan on Hypernode
10+
11+
[eComscan](https://sansec.io/) is a malware and vulnerability scanner for eCommerce applications, built by [Sansec](https://sansec.io/), specialists in eCommerce security and digital forensics since 2010. It scans your webshop's files, database, processes and cronjobs for malware, backdoors and vulnerable software, and supports Magento, Shopware, WooCommerce and many other platforms.
12+
13+
eComscan comes preinstalled on every Hypernode, so you can start scanning right away. This article explains how to run your first scan and how to set up continuous monitoring with a cronjob.
14+
15+
## Running Your First Scan
16+
17+
eComscan is already available on your Hypernode and is kept up to date by the platform, so there is nothing to install. Log in to your Hypernode over SSH and point eComscan at your webshop's installation folder:
18+
19+
```bash
20+
ecomscan /data/web/magento2
21+
```
22+
23+
If your shop lives in a different folder, change the path accordingly. For example, use `/data/web/public` for Magento 1 or Shopware.
24+
25+
A scan takes anywhere from a few minutes to half an hour, depending on the size of your shop. eComscan reads your database credentials from your store's configuration files, so it scans your database for malware as well. The output looks like this:
26+
27+
```console
28+
app@example-magweb-cmbl:~$ ecomscan /data/web/magento2
29+
[ eCommerce Security Scanner v1.8.26 (https://sansec.io), build 2026-07-03 ]
30+
31+
Downloading latest malware signatures...
32+
33+
>> Check: Searching for vulnerabilities and hidden malware in files ...
34+
Finished scanning 90049 files.
35+
36+
>> Check: Magento 2 - scanning database 'example_magento' for malware ...
37+
Finished scanning 162 rows in 9 tables.
38+
39+
>> Check: Magento 2 - scanning for vulnerable 3rd party modules ...
40+
Found 0 vulnerable modules.
41+
42+
...
43+
44+
>> Found: 1x vulnerability on example-magweb-cmbl.nodes.hypernode.io
45+
```
46+
47+
## Adding a License Key
48+
49+
Without a license key, eComscan runs in trial mode: it tells you *whether* something was found, but not the details of every detection. To unlock full reporting, purchase a license key from [Sansec](https://sansec.io/pricing) and pass it along with the `--key` flag:
50+
51+
```bash
52+
ecomscan --key=YOUR_KEY --report=security@example.com /data/web/magento2
53+
```
54+
55+
The `--report` flag sends the full scan report to the given email address, so you have a record of every scan.
56+
57+
## Setting Up Continuous Monitoring
58+
59+
A single scan only tells you about today. To catch infections early, Sansec recommends running eComscan every hour in monitoring mode. In this mode eComscan only sends an email when it finds new suspicious changes since the previous scan.
60+
61+
Run `crontab -e` and add the following line:
62+
63+
```text
64+
# Scan the shop for malware every hour and alert on new findings
65+
10 * * * * flock -n ~/.ecomscan.lock -c 'ecomscan --key=YOUR_KEY --monitor=security@example.com /data/web/magento2'
66+
```
67+
68+
After adding the cronjob, press **CTRL+X**, **Y** and then **ENTER** to save it into your crontab. The `flock` command prevents a new scan from starting while the previous one is still running. For more information about cronjobs on Hypernode, check out [our article about periodic tasks](how-to-use-periodic-tasks-cronjobs-on-hypernode.md).
69+
70+
Please note that monitoring mode requires a valid license key.
71+
72+
## Running a Deep Scan
73+
74+
If you suspect your shop has been compromised, you can run a deep scan. This scans all files instead of just code, and also shows detections with a lower confidence score:
75+
76+
```bash
77+
ecomscan --key=YOUR_KEY --min-confidence=0 --deep /data/web/magento2
78+
```
79+
80+
A deep scan is significantly slower and produces more false positives, so use it for incident response only. Do not add a deep scan to your crontab.
81+
82+
## What to Do When Malware Is Found
83+
84+
If eComscan finds malware in your shop, follow our guide on [how to recover a hacked Magento shop](../../best-practices/security/how-to-recover-a-hacked-magento-shop.md). You can also use [Magento Corediff](how-to-use-magento-corediff-on-hypernode.md), another tool by Sansec, to find unauthorized modifications in your Magento core files.
85+
86+
If you need professional help cleaning up your shop, Sansec also offers incident response services.

docs/hypernode-platform/tools/how-to-use-magento-corediff-on-hypernode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ redirect_from:
1515

1616
[Magento Corediff](https://github.com/sansecio/magento-corediff) is an open source tool to quickly find unauthorized modifications in a Magento 1 or 2 install. It compares each line of code in your webshop with a database filled with millions of lines of trusted code, showing you exactly what code your webshop contains that isn't supposed to be there.
1717

18-
Corediff was created by [Sansec](https://sansec.io), specialists in Magento security and digital forensics since 2010.
18+
Corediff was created by [Sansec](https://sansec.io), specialists in Magento security and digital forensics since 2010. Sansec also offers a full malware and vulnerability scanner: check out [our article about eComscan](how-to-set-up-sansec-ecomscan-on-hypernode.md), which comes preinstalled on your Hypernode.
1919

2020
## Scanning your Magento's code
2121

0 commit comments

Comments
 (0)