Cybercriminals Exploit Onerror Event in Image Tags to Deploy Payment Skimmers

Cybercriminals Exploit Onerror Event in Image Tags to Deploy Payment Skimmers

Feb 18, 2025Ravie LakshmananMalware / Web site Hacking

Cybersecurity researchers have flagged a bank card stealing malware marketing campaign that has been noticed concentrating on e-commerce websites operating Magento by disguising the malicious content material inside picture tags in HTML code with a purpose to keep beneath the radar.

MageCart is the title given to a malware that is able to stealing delicate cost info from on-line procuring websites. The assaults are identified to make use of a variety of methods – each on client- and server-side – to compromise web sites and deploy bank card skimmers to facilitate theft.

Sometimes, such malware is barely triggered or loaded when customers go to the checkout pages to enter bank card particulars by both serving a faux kind or capturing the data entered by the victims in actual time.

The time period MageCart is a reference to the unique goal of those cybercrime teams, the Magento platform that provides checkout and procuring cart options for on-line retailers. Over time, such campaigns adapted their tactics by concealing malicious code via encoding and obfuscation inside seemingly innocent sources, reminiscent of faux photographs, audio recordsdata, favicons, and even 404 error pages.

Cybersecurity

“On this case, the malware affecting the shopper follows the identical purpose — staying hidden,” Sucuri researcher Kayleigh Martin said. “It does this by disguising malicious content material inside an <img> tag, making it straightforward to miss.”

“It is common for <img> tags to include lengthy strings, particularly when referencing picture file paths or Base64-encoded photographs, together with further attributes like peak and width.”

The one distinction is that the <img> tag, on this case, acts as a decoy, containing Base64-encoded content material that factors to JavaScript code that is activated when an onerror event is detected. This makes the assault much more sneaky, because the browser inherently trusts the onerror operate.

“If a picture fails to load, the onerror operate will set off the browser to point out a damaged picture icon as an alternative,” Martin mentioned. “Nevertheless, on this context, the onerror occasion is hijacked to execute JavaScript as an alternative of simply dealing with the error.”

Moreover, the assault affords an added benefit to menace actors in that the <img> HTML component is mostly thought-about innocuous. The malware, for its half, checks whether or not the consumer is on the checkout web page and waits for unsuspecting customers to click on on the submit button to siphon delicate cost info entered by them to an exterior server.

Deploy Payment Skimmers

The script is designed to dynamically insert a malicious kind with three fields, Card Quantity, Expiration Date, and CVV, with the purpose of exfiltrating it to wellfacing[.]com.

“The attacker accomplishes two spectacular targets with this malicious script: avoiding straightforward detection by safety scanners by encoding the malicious script inside an <img> tag, and making certain finish customers do not discover uncommon adjustments when the malicious kind is inserted, staying undetected so long as potential,” Martin mentioned.

“The purpose of attackers who’re concentrating on platforms like Magento, WooCommerce, PrestaShop and others is to stay undetected so long as potential, and the malware they inject into websites is usually extra complicated than the extra generally discovered items of malware impacting different websites.”

Cybersecurity

The event comes as the web site safety firm detailed an incident involving a WordPress website that leveraged the mu-plugins (or must-use plugins) listing to implant backdoors and execute malicious PHP code in a stealthy method.

“In contrast to common plugins, must-use plugins are robotically loaded on each web page load, without having activation or showing in the usual plugin record,” Puja Srivastava said.

“Attackers exploit this listing to keep up persistence and evade detection, as recordsdata positioned right here execute robotically and aren’t simply disabled from the WordPress admin panel.”

Discovered this text fascinating? Observe us on Twitter and LinkedIn to learn extra unique content material we submit.

Leave a Reply