EtherHiding is a technique first documented by Guardio Labs in 2023 where attackers store malicious JavaScript payloads inside a blockchain smart contract instead of on a traditional attacker-controlled server. A compromised WordPress site injects a small loader into every page via the wp_footer hook. When a victim visits the page, their browser silently fetches the current payload from the blockchain via a JSON-RPC eth_call, then executes it with eval().
The key advantage for the attacker is resilience. A traditional C2 domain can be taken down or blocklisted within hours. A smart contract deployed on the Binance Smart Chain (BSC) cannot be removed by any third party, including Binance itself. The attacker only needs to call setPayload() to rotate their C2 domain or update their lure template — all compromised WordPress sites update simultaneously without the attacker ever touching them again.
The full attack chain from the victim's perspective looks like this:
1. Victim visits a legitimate but compromised WordPress site
2. Browser loads the page — wp_footer fires the injected loader
3. Loader makes a POST request to a BSC RPC endpoint via eth_call
4. Smart contract returns the current malicious payload (ABI-encoded string)
5. Loader decodes the ABI response and calls eval(payload)
6. Browser renders a fake Cloudflare Turnstile CAPTCHA (ClickFix lure)
7. Victim clicks the checkbox — clipboard is poisoned with a malicious PowerShell command
8. Victim follows Win+R instructions — malware executes on the host
The lab relies on three pieces of tooling that play very different roles. None of them is part of the chain the victim sees: they are used to build the smart contract and to publish it on a blockchain.
Remix (remix.ethereum.org) is the editor and compiler. It is a browser IDE in which the Solidity contract is written and compiled. The compiler produces two outputs: the ABI (the description of the contract's functions, used by ethers.js to build the calls) and the bytecode (the machine code stored on-chain at the contract address). Remix is only needed at build time: once the contract is deployed, nothing talks to Remix anymore.
Alchemy (alchemy.com) is the node provider. Reading from or writing to a blockchain means talking to a node, and running one yourself requires a lot of storage and a long synchronisation. Alchemy runs the nodes and exposes them as an HTTPS JSON-RPC endpoint of the form https://eth-sepolia.g.alchemy.com/v2/<API_KEY>. deploy.js and update.js send their signed transactions (eth_sendRawTransaction) through this endpoint, and the simulated loader sends eth_call through it to read getPayload(). The API key identifies the account on Alchemy: it is not a wallet and it cannot spend anything. In the real attack the loader uses a free public BSC endpoint (bsc-dataseed.binance.org) that needs neither an account nor a key.
Sepolia is the Ethereum test network on which the contract lives. It behaves like Mainnet (same EVM, same transactions, same gas mechanics) but its ETH has no value and comes from faucets. Only the RPC URL changes between the lab and a real BSC campaign: the contract, the ABI, the function selectors and the eth_call are identical.
How the pieces fit together:
deploy.js comes from:
The smart contract is the core of the technique. It stores the malicious payload as a state variable on the blockchain. Unlike a hardcoded return value in bytecode, a state variable can be updated by calling setPayload() without redeploying the contract — the contract address never changes, only the stored value does.
The contract is written in Solidity and compiled using Remix IDE at remix.ethereum.org. For the simulation we deploy to the Sepolia testnet rather than BSC Mainnet — functionally identical but using worthless test ETH.
require(msg.sender == owner) check ensures only the deployer wallet can call setPayload(). Anyone can call getPayload() — which is exactly what the WordPress loader does from the victim's browser.
getPayload() is a view function — it reads state, costs no gas, and is called via eth_call. No signing required. Any anonymous HTTP client can call it.setPayload() is a state-changing function — it writes to the blockchain. It requires a signed transaction (eth_sendRawTransaction), costs gas, and requires the deployer's private key.deploy.js. The exact steps are described in the Remix section below.
Step 1: open remix.ethereum.org in a browser. Nothing has to be installed. During this lab Remix asked for an account before the compiler could be used (older tutorials describe it as account-free). The Remix account is separate from the wallet and from the Alchemy account.
Step 2: in the Files panel (left sidebar) create a file named UpdateableHello.sol and paste the contract from the previous section.
Step 3: open the Solidity Compiler tab (the Compile icon in the left sidebar), choose a compiler version that fits the pragma line (0.8.20 or newer for ^0.8.20) and click Compile. A green check on the Compile icon means the compilation succeeded. Warnings can be ignored for this lab.
Step 4: under CONTRACT, check that UpdateableHello is selected. This matters when a file contains several contracts.
Step 5: at the bottom of the left panel, click ABI to copy the ABI and paste it in the ABI constant of deploy.js. The copy from Remix has five entries: the constructor, getPayload, setPayload, owner and payload. owner and payload appear because Solidity generates an automatic getter for every public state variable. A shorter ABI that only lists the entries the script uses also works.
Step 6: click Bytecode (or open Compilation Details) to get the bytecode. If the copied text is a JSON block, the value needed is the object field, a long hex string starting with 6080.... Put the 0x prefix in front of it in deploy.js:
deploy.js, which signs the transaction locally and sends it through the Alchemy endpoint. Every time the .sol file changes, compile again and copy the new ABI and bytecode: new bytecode deployed means a new contract address.
Step 1: go to alchemy.com and create a free account. The free plan is enough for this lab.
Step 2: in the dashboard, create an app (or open Node RPCs) and select the network Ethereum Sepolia. Do not pick Ethereum Mainnet: Sepolia is the test network and has no real value.
Step 3: copy the API key. The dashboard shows it masked, click the eye icon to reveal it and the Copy button to copy it.
Step 4: the endpoint is built from the network and the key:
result (the latest block number) means the key and the network work. Replace eth_blockNumber by eth_chainId and the result should be 0xaa36a7, which is 11155111 in decimal, the chain id of Sepolia.
ALCHEMY_KEY of deploy.js and update.js, and in RPC_URL of the loader.ETH_MAINNET is not enabled for this app means the URL points to eth-mainnet while the app only has Sepolia enabled. Use the eth-sepolia URL.0x when queried through the Mainnet endpoint.setPayload() call. Some faucets (Alchemy and QuickNode at the time of the lab) refuse a fresh wallet with the message that a small Mainnet balance is required. The Google Cloud Sepolia faucet worked with a newly created wallet.
The contract is deployed using Node.js and the ethers.js library. Remix's built-in deployment requires a browser wallet extension (MetaMask), which may not always be available. Using a Node.js script with a raw private key bypasses this dependency entirely.
First, generate a test wallet and fund it with free Sepolia ETH from Google Cloud Faucet:
deploy.js:
deploy.js calls eth_sendRawTransaction under the hood — a real signed transaction that costs Sepolia ETH (worthless test currency). The private key signs the transaction locally; only the signed bytes are broadcast to the network. The key itself never leaves your machine.
Two different addresses are involved and they are easy to confuse:
The wallet address comes from the generated wallet. It is the identity that holds the Sepolia ETH, pays the gas and signs the transactions. Nothing is deployed at this address.
The contract address is printed by deploy.js after the deployment. It is where the bytecode is stored, and it is the value used in the to field of eth_call and in CONTRACT_ADDRESS of the loader.
Putting the wallet address in the to field is a common mistake: the call succeeds but returns an empty 0x, because a wallet has no code to execute.
Every deployment creates a new contract and therefore a new address, derived from the deployer address and its transaction count (nonce). The bytecode stays permanently at that address:
setPayload(): that call changes the stored value, not the bytecode and not the address.
Once deployed, the contract address never changes. The attacker updates the payload by calling setPayload() — this is a state-changing transaction that permanently updates the stored string on-chain. Every compromised WordPress loader automatically serves the new payload on the next page visit.
update.js reads the payload from a file to avoid one-liner limitations on complex HTML/JS content:
setPayload() transaction. The input data field of each transaction, viewed as UTF-8, shows the payload in plaintext — exactly what analysts see when investigating EtherHiding on BSCScan.
The wp_footer hook is an action hook in WordPress's core rendering lifecycle. It fires on every page, on every request, right before the closing </body> tag. Any callback registered to it renders its output into every page of the site automatically — which is why attackers target it. One injection point reaches every visitor.
In a real compromise, the attacker gains write access to functions.php via one of several paths: stolen wp-admin credentials and the Theme File Editor, a vulnerable plugin CVE granting remote code execution, FTP/SFTP credential compromise, or SQL injection directly into the wp_options database table. For this simulation we use a Docker-hosted WordPress instance and edit functions.php directly.
First, identify the active theme:
test must appear at the bottom of the page:
footer.php must call wp_footer(). Some themes do not, and the hook never fires.functions.php must belong to the active theme. Editing an inactive theme has no effect.DISALLOW_FILE_EDIT is set to true in wp-config.php, the Theme File Editor is not available. Edit the file directly in the container instead.functions.php (a missing ; or }) breaks the whole site, so keep the edits small.functions.php via Appearance → Theme File Editor → functions.php in wp-admin:
getPayload() function selector, run:
The payload stored in the smart contract is a JavaScript string that gets passed directly to eval(). It uses document.body.innerHTML to replace the entire page with a fake Cloudflare Turnstile CAPTCHA — the ClickFix lure.
Note: script tags injected via innerHTML do not execute — this is a browser security feature. The payload must be pure JavaScript executed via eval(), not HTML containing <script> tags.
Create payload.js:
The raw response from eth_call is an ABI-encoded hex string. Ethereum's ABI encoding for a string type always follows a three-chunk structure of 32 bytes (64 hex characters) each:
Chunk 1 (bytes 0-63): offset pointer — always 0x20 (32) for a single string return, indicating where the string data starts
Chunk 2 (bytes 64-127): string length in bytes, as a hex integer
Chunk 3 (bytes 128+): the actual UTF-8 bytes of the string, zero-padded to the next 32-byte boundary
When a victim visits the compromised WordPress page, three distinct log entries appear in the proxy — chained by the same source IP and Referer header:
Request 1 — GET to the WordPress page (normal page load)
Request 2 — POST to the Alchemy/RPC endpoint (eth_call fetching the payload)
Request 3 — GET to google.com (eval() executes the redirect payload)
Request 2 is the detection signal. With SSL inspection enabled on Zscaler or a similar proxy, the POST body is visible and contains the full JSON-RPC payload:
The following detection strategies are ordered from highest to lowest confidence.
Network layer — POST to blockchain RPC endpoint from browser
The most reliable signal: a browser process making a POST request to a known blockchain RPC provider domain. Legitimate users do not browse to WordPress sites that call Ethereum nodes.
T1102.001 — Web Service: Dead Drop Resolver (blockchain as resolver)
T1059.007 — Command and Scripting Interpreter: JavaScript (eval() execution)
T1505.003 — Server Software Component: Web Shell (wp_footer injection)
T1566.002 — Phishing: Spearphishing Link (ClickFix lure delivery)
T1204.001 — User Execution: Malicious Link (victim pastes clipboard command)
T1059.001 — Command and Scripting Interpreter: PowerShell (clipboard payload execution)
The Hacker News — Binance's Smart Chain Exploited in New 'EtherHiding' Malware Campaign (Guardio Labs research, Oct 2023)
Dark Reading — 'Etherhiding' Blockchain Technique Masks Malicious Code in WordPress Sites
Proofpoint — Security Brief: ClickFix Social Engineering Technique Floods Threat Landscape
Proofpoint — From Clipboard to Compromise: A PowerShell Self-Pwn
MITRE ATT&CK T1102.001 — Dead Drop Resolver
Sepolia Etherscan — testnet explorer
Remix IDE — Solidity browser compiler
Alchemy — Ethereum node provider (JSON-RPC endpoint and API key)
Google Cloud — Sepolia faucet