Sansec logo

How eComscan works behind the scenes

Sansec

by Sansec

Published in Guides

A malware and vulnerability scanner

You run eComscan as an application on your (Linux) production server, either as single scan (scrutinize mode) or continuously as a monitor. It should really run on your server, because most malware (60%) is hidden there, either in the form of code, databases or processes. Many other security products (Detectify, Sucuri Sitecheck) will scan your server from the outside, and cannot inspect everything.

Signature update

Upon every run, eComscan retrieves the latest signatures. These signatures are updated multiple times per week (sometimes per day) so you benefit from the latest threat intel.

Database scan

In addition to a file scan, eComscan recognizes configurations of common shop systems (Magento, WooCommerce etc). When it finds one, it will use that configuration to connect to your database server. It then scans specific tables for malicious code. Because there are only a number of tables where criminals can inject executable code, the total number of scanned data is limited and the scan has no impact on the performance of your store.

Process scan

eComscan also scans running processes. Hackers use malicious processes to intercept customer data, or as a backdoor to ensure future access. Malicious processes are also popular because they can run on servers that use read-only storage.

Scheduled task scan

eComscan also scans scheduled tasks (cron). Malicious cron tasks are often used to implement persistence.

Self-update

eComscan incorporates a secure self-updater. If new checks or improvements are available, they are automatically installed. NB: make sure that the ecomscan program is writable, or otherwise auto-update will be skipped. Self-update may fail if the user running ecomscan differs from the user owning the ecomscan program. You can check by running:

ls -la `which ecomscan`
id

This should produce, for example:

$ ls -la `which ecomscan`
-rwxr-xr-x 1 app app /data/web/bin/ecomscan
$ id
uid=1000(app) gid=1000(app) groups=1000(app)

Command line options

Run ecomscan --help for all options. For the current version:

Usage:
  ecomscan <path> [flags]
  ecomscan [command]

Available Commands:
  help           Help about any command
  interactive    Interactive eComscan run
  remote-support Grant Sansec investigators temporary SSH access to this server
  submit         Submit malware or a benign file for manual review
  update         Update to the latest version of eComscan

Flags:
  -d, --deep                   Scan all files, not just code (not recommended for cron)
      --force-dsn string       Force this database connection string for all found platforms
  -f, --format string          Output format for automated parsing (csv, jsonline, json)
  -h, --help                   help for ecomscan
  -k, --key string             eComscan license key (default "trial")
      --maxsize int            Maximum file size to consider (default 20000000)
  -m, --min-confidence int32   Set confidence threshold (0-100) (default 50)
      --monitor string         Monitor (use with cron) and send changes to <email>
      --no-auto-update         Disable self-updater
      --one-file-system        Do not cross file system boundaries (default: do cross)
      --reply-to string        Use <email> as reply-to address in reports (default "nobody@sansec.io")
      --report string          Send full report to <email>
      --skip-dashboard         Do not submit scan results to the report dashboard
      --skip-database          Do not scan discovered databases
      --skip-symlinks          Do not follow symlinks (default: do follow)
      --state-file string      Override state file path for detecting deltas
      --tag string             Add this tag to reporting (when scanning multiple servers)
  -v, --verbose count          Show what is going on
      --version                version for ecomscan

Getting started covers common invocations such as monitoring with cron.

Output

By default, eComscan prints a human readable report to the console, listing the checks it ran and any detections. With --format, it prints json, jsonline or csv for automated parsing. The JSON structure is documented in Integration.

With --report or --monitor, eComscan also emails the report to you. --monitor only sends changes since the previous run. With --slack, you receive alerts in Slack (Advanced plan and up), see Slack integration.

Network connections and data

eComscan only connects to https://api.sansec.io, for the following purposes:

PurposeWhenDisable with
Self-update, signature synchronisation and license checkEvery run--no-auto-update (self-update only)
Email alertsWith --report or --monitorOmit these options
Dashboard reportsBy default--skip-dashboard

Do not disable self-update. When a new 0day hits ecommerce platforms, we often ship emergency detection or mitigation within hours. Those fixes reach you through self-update. With --no-auto-update, your server keeps running old checks and can miss an active attack. If you must disable it, run ecomscan update on a fixed schedule.

Email alerts and dashboard reports contain scan results. eComscan does not upload your files or database contents, except when you explicitly run ecomscan submit <file> to have a file reviewed by our analysts.

License check

eComscan will match the license URL with configured URLs of the store. If any of the store URL frontends matches, it will continue. This enables you to run eComscan on dev & staging environments. This is actually recommended, because you will be able to catch vulnerabilities in an early stage.

Need expert advice? We are here to help!

Stay up to date with the latest eCommerce attacks

Sansec logo

experts in eCommerce security

Terms & Conditions
•
Privacy & Cookie Policy