Ever wondered why a trusted website could suddenly send your crypto to an unknown wallet? This article explains how address‑swapping attacks work, why they succeed, and what steps you can take to keep your funds safe when interacting online.
The plain explanation
An address‑swapping attack is a type of malicious code injection that changes the cryptocurrency address displayed on a webpage to one controlled by the attacker. When a user copies the address or clicks a “Send” button, the transaction is directed to the attacker’s wallet instead of the intended recipient.
These attacks typically rely on three components:
- Vulnerable web page or service: The site must allow some form of user‑generated content or third‑party script without proper sanitisation.
- Malicious script: JavaScript or similar code that runs in the visitor’s browser, detects crypto address fields, and replaces the legitimate address with the attacker’s.
- User interaction: The victim must copy the altered address or approve a transaction, often believing they are dealing with a reputable service.
Because the code runs client‑side, the website’s server may appear clean while the user’s browser is compromised. This makes detection difficult for both the site operator and the victim.
A real example
In March 2026, security researchers uncovered a widespread campaign that exploited a signup flaw in the Optimizely platform. The flaw allowed attackers to embed malicious JavaScript on any site using Optimizely’s services. The code silently swapped cryptocurrency addresses on 178 high‑profile websites, including HSBC, the BBC, and Ledger. While the total amount stolen has not been disclosed, the incident highlighted how a single third‑party integration can become a vector for large‑scale crypto theft.
What it means for you
If you regularly use web wallets, crypto‑exchange deposit pages, or any online service that displays a crypto address, you could be exposed to address‑swapping attacks. Even sites you trust can inadvertently serve compromised code if they rely on third‑party services that are not fully secured.
The risk is not limited to large institutions; any website that embeds external scripts—analytics, A/B testing tools, or advertising networks—could become a conduit for malicious code. As a result, the safety of your crypto transactions depends as much on the security practices of the websites you visit as on the security of your own wallets.
What to check / how to judge
- Verify the address manually: Before sending funds, compare the displayed address with the one you saved offline or in a trusted source. Use copy‑and‑paste carefully and double‑check the first and last characters.
- Use hardware wallets: Devices like Ledger or Trezor require physical confirmation of the destination address, making it harder for a malicious script to alter the transaction.
- Check the website’s URL: Ensure you are on the correct domain (look for HTTPS and the exact spelling). Phishing sites often mimic legitimate ones.
- Inspect the page source: Advanced users can view the page’s HTML/JavaScript to spot unexpected scripts, especially from unknown third‑party domains.
- Prefer bookmark or official app links: Access services via saved bookmarks or official mobile apps rather than clicking links in emails or social media.
- Stay updated on security notices: Follow announcements from the services you use; many will publish advisories if a vulnerability is discovered.
FAQ
Can I rely on browser extensions to block these attacks?
Some security extensions can block known malicious scripts, but they are not foolproof. Attackers often use obfuscated code that can bypass filters, so extensions should be part of a broader safety routine, not the sole defense.
Do hardware wallets eliminate the risk completely?
Hardware wallets add a strong layer of protection because they require you to confirm the address on the device itself. However, if you copy a wrong address from a compromised website into the wallet, the hardware device will still confirm the incorrect address. Always verify the address independently.
What should I do if I suspect an address‑swapping attack?
Stop the transaction immediately. Compare the address with a known good source, such as a previously saved address or the official website’s QR code. If funds have already been sent, report the incident to the platform and consider contacting law enforcement, though recovery is often difficult.
Are mobile apps immune to these attacks?
Mobile apps can also be vulnerable if they load remote JavaScript or rely on insecure APIs. Use official apps from trusted app stores, keep them updated, and avoid opening links to crypto addresses from unknown sources.
This article references reporting from coindesk.com.