- 2020/05/31
- 2,980
- 1,693
There is no 100% perfect way to block malicious code, but you can follow these steps to greatly reduce the risk of installing compromised extensions.
- Inspect source code before installationPrioritize fully open, unencrypted PHP files. If files are encoded with ionCube, source code cannot be reviewed. Avoid ionCube encrypted packages whenever possible, as hidden callbacks or backdoors cannot be audited.Unzip the package locally and scan all PHP files. Look for suspicious functions such as file_get_contents, curl, base64_decode, eval, preg_replace with /e modifier, and code that sends data to unknown external domains.
- Test on isolated staging environment firstNever directly deploy new extensions to live stores. Install the module on a test site with no real customer data. Monitor server access logs and outbound requests. Watch for unexpected remote connections to unknown IP addresses or domains.
- Check for license heartbeat / remote callback codeSearch source code for remote API calls. Modules with heartbeat checks will send your site domain, server info or admin credentials to external servers periodically. If you find hardcoded remote callback URLs, avoid using this extension.
- Keep away from modified repackaged filesAvoid extensions repacked by unknown third parties. Malicious actors often add backdoor code inside popular modules. Use resources shared within our community and read the notes in the corresponding thread before download.
- Keep regular backups and review logs frequentlyBackup database and site files before installing every new extension. Check OpenCart logs in system/storage/logs/ regularly. Monitor web server access logs to spot abnormal file access or external network requests.
- Apply file permission restrictionsSet strict file permissions. Prevent extension folders from writing executable PHP files inside image or upload directories. Block PHP execution inside upload folders via Apache or Nginx rules.
- Encrypted PHP files that cannot be read
- Unexpected outbound network requests
- The module asks for unnecessary high file access permissions
- Obscured base64 encoded strings and eval functions
- Automatic admin user creation or file modification without your operation