Hackers Inject Malicious JavaScript into 953 Magento Stores via CMS Block Abuse
What Happened — An unidentified threat actor has been running a campaign since July 2025 that targets online retailers using the Magento e‑commerce platform. Sansec, a Dutch e‑commerce security firm, reports that the attackers have compromised 953 web stores, the majority of which run Magento. The intrusion works by inserting a tiny snippet of code into a Magento CMS block. When a shopper loads a compromised page, the block delivers a malicious JavaScript loader that fetches additional payloads from remote servers. The injected code is deliberately crafted to evade common web‑application scanners, allowing the malicious script to persist undetected for weeks.
Sansec’s analysis shows the attackers first gain administrative access to the Magento backend—often through weak or reused credentials, or by exploiting unpatched extensions. Once inside, they create or modify a CMS static block, embedding a short <script> tag that points to a loader hosted on a command‑and‑control (C2) domain. The loader then executes a second stage payload, typically a cryptominer or a credential‑stealing script, depending on the victim’s traffic profile.
The campaign was discovered after a security researcher noticed anomalous outbound traffic from a Magento store that was not accounted for in the site’s firewall logs. The researcher reported the finding to Sansec, which then began scanning its client base. The scan revealed the same CMS‑block pattern across 953 distinct domains, confirming a coordinated, large‑scale operation.
Magento’s own security advisory notes that the platform’s CMS block feature can be abused if proper role‑based access controls (RBAC) and change‑management processes are not enforced. The attackers exploit this by leveraging default admin accounts that have not been hardened, or by reusing credentials harvested from other breaches. Because the malicious snippet is only a few lines of JavaScript, it often slips past signature‑based web‑application firewalls (WAFs) and automated vulnerability scanners that focus on known CVEs.
In response, the affected merchants have been instructed to:
- Immediately rotate all admin passwords and enforce multi‑factor authentication (MFA).
- Review and restrict Magento user roles, ensuring only necessary accounts have block‑editing privileges.
- Apply the latest Magento security patches and update all third‑party extensions.
- Deploy a runtime application self‑protection (RASP) or a behavior‑based WAF that can detect anomalous script loading.
Sansec is working with Magento’s security team and several incident‑response firms to provide forensic guidance. No public statement has been issued by Magento itself, and no regulatory notifications have been reported yet. The full scope of data exfiltration, if any, remains unknown; however, the primary impact is the insertion of malicious code that can be leveraged for cryptomining, ad fraud, or credential harvesting.
Why It Matters for Trust & Control Assurance — This incident highlights the need for continuous control mapping and evidence collection around application configuration and third‑party component management.
Who Is Affected — Online retailers, especially those running Magento; e‑commerce service providers; digital agencies managing Magento sites.
Recommended Actions
- Conduct an inventory of all Magento installations and verify version compliance.
- Implement strict RBAC for CMS block editing and enforce MFA for all admin accounts.
- Integrate runtime monitoring that flags unexpected script injections in page content.
- Capture and retain evidence of CMS block changes to satisfy audit trails across frameworks.
- Use a trusted third‑party risk platform to continuously monitor the security posture of your e‑commerce stack.
Source: The Hacker News
Technical Notes
- Attack vector: malicious JavaScript injected via Magento CMS static blocks.
- Likely initial access: compromised admin credentials or vulnerable extensions.
- Payloads: JavaScript loader that can fetch cryptominers, ad‑fraud scripts, or credential‑stealers.
- Evasion technique: minimal, obfuscated script designed to bypass signature‑based scanners.
- No specific CVE cited; the weakness is procedural (poor access control) rather than a software bug.