---
title: "Front-End Attack — definition | Nuri Glossary"
description: "Compromising a protocol's website so users sign transactions that pay the attacker."
lang: "en"
type: "glossary-term"
canonical: "https://nuri.com/glossary/front-end-attack"
---

# Front-End Attack

Compromising a protocol's website so users sign transactions that pay the attacker.

## Basically

A front-end attack takes over a crypto website or app screen. It changes what you sign so your money goes to the attacker.

## Key Takeaways

- A front-end attack compromises a crypto protocol's website or user interface rather than its smart contracts. Attackers manipulate what you see and sign, redirecting funds to attacker-controlled addresses while the underlying contracts remain untouched.
- Common attack vectors include DNS hijacking, CDN compromise and supply chain attacks on JavaScript dependencies. They exploit the centralised Web2 infrastructure behind most DeFi frontends.
- Defences include transaction simulation, hardware wallet confirmation screens, IPFS-hosted frontends and verifying contract addresses before approving transactions.

## What Is a Front-End Attack?

A front-end attack is a class of exploit where an attacker compromises the user-facing interface of a decentralised application (dApp) rather than its on-chain smart contracts. The attacker modifies the website code so that when users interact with the protocol, their transactions are silently altered: approvals are redirected to the attacker's address, transaction parameters are changed, or wallet-draining scripts are injected into the page.
Decentralised finance contains a fundamental tension: the smart contract layer may be fully audited, immutable and trustless, but the web interface through which most users interact with those contracts runs on traditional, centralised infrastructure. DNS registrars, CDN providers, npm package repositories and web hosting services all represent single points of failure that attackers can target. The blockchain acts as the settlement layer, but the frontend is where users make decisions about what to sign.
Front-end attacks are particularly dangerous because they are invisible to the average user, and the compromised site looks identical to the legitimate one. The URL may even be correct if the DNS itself was hijacked. Users who rely solely on visual cues have no way to detect the manipulation without inspecting the raw transaction data before signing.

## How It Works

Front-end attacks target the Web2 infrastructure that serves a dApp's user interface. Several distinct attack vectors exist, and each exploits a different layer of the web stack.

## DNS Hijacking

A DNS hijacking attack begins when the attacker gains control of the domain's DNS records, typically by compromising the domain registrar account. The attacker changes the DNS records to point the domain to a server hosting a malicious clone of the legitimate site. Users who type the correct URL are silently redirected to the attacker's server, where a fake frontend prompts them to approve malicious transactions.
DNS hijacking is especially effective because the URL in the browser appears correct. Users cannot distinguish the attack from a legitimate visit unless they verify SSL certificates or inspect the raw transaction data. The vector overlaps with BGP hijacking, which can intercept traffic at the network routing level rather than the DNS layer.

## CDN and Hosting Compromise

Many dApps use content delivery networks (CDNs) and cloud hosting services like Cloudflare Workers, Vercel or AWS to serve their frontend code. An attacker who compromises API keys or credentials for these services can inject malicious JavaScript directly into the served pages without touching the domain's DNS at all.
CDN and hosting compromise is harder to detect than DNS hijacking because the domain, SSL certificate and hosting infrastructure all remain legitimate. The malicious code runs within the trusted origin, bypassing browser security policies like Content Security Policy (CSP) unless the CSP is configured with strict hash-based or nonce-based directives.

## Dependency Poisoning

Modern web applications depend on hundreds of npm packages. An attacker who compromises a popular package or one of its transitive dependencies can inject malicious code that runs in every application that imports it. Dependency poisoning is a form of supply chain attack targeting the software build pipeline rather than the hosting infrastructure.
The @solana/web3.js library was compromised in a supply chain attack in December 2024, affecting versions 1.95.6 and 1.95.7. The malicious versions contained code that exfiltrated private keys, enabling attackers to drain wallets of any application using those versions. The incident demonstrated how a single compromised dependency can cascade across an entire ecosystem.

## The Attack Lifecycle

Most front-end attacks follow a similar pattern regardless of the specific vector. The attack vector changes, but the broad pattern remains similar.

## BadgerDAO: $120 Million (December 2021)

The BadgerDAO attack remains one of the largest front-end exploits in DeFi history. Attackers compromised a Cloudflare Workers API key that had been created without the knowledge of Badger engineers. Using this key, they periodically injected a malicious script into the BadgerDAO website that prompted users to approve unlimited token spending to the attacker's address.
The attacker operated silently for weeks, accumulating approvals from nearly 200 accounts before draining the approved wallets in under 10 hours on December 2, 2021 and stealing approximately $120 million. A single institutional victim lost over $50 million in wrapped Bitcoin. The smart contracts were never exploited: the attack was entirely at the interface layer.

## Curve Finance: DNS Hijack (August 2022)

Attackers compromised the nameserver at Curve Finance's DNS registrar (iwantmyname) on August 9, 2022, redirecting traffic from curve.fi to a malicious clone. The clone prompted users to approve a contract that would drain their wallets. Approximately $575,000 was stolen before the team identified the issue and directed users to curve.exchange, an alternate UI that was unaffected.
The underlying smart contracts and liquidity pools remained completely secure throughout the incident. Front-end attacks bypass on-chain security entirely.

## Curve Finance: Second DNS Attack (May 2025)

Curve Finance suffered a second DNS hijack on May 12, 2025, when attackers gained access to the registrar for the.fi domain. Users were redirected to a static decoy page that mimicked Curve's interface and attempted to prompt wallet signatures. The Curve team responded by redirecting the domain to neutral nameservers and launching curve.finance as a secure alternative. No user funds were lost in this instance, but the CRV token price dropped over 8% as traders reacted to the incident.

## Squarespace Domain Hijack Wave (2024)

A coordinated wave of DNS hijacking attacks targeted multiple DeFi protocols in 2024 whose domains were registered through Squarespace. These domains had originally been registered at Google Domains and were force-transferred to Squarespace as part of an asset purchase agreement. The migration created a window of vulnerability that attackers exploited to redirect visitors to phishing sites hosting wallet drainers.

## Front-End Attacks vs. Smart Contract Exploits

Front-end attacks and smart contract exploits differ fundamentally. The difference lies in where the vulnerability sits and how it is mitigated.
A smart contract audit does nothing to prevent front-end attacks. The contract code can be flawless, but if the interface tricks users into signing approvals to the wrong address, funds are lost all the same. Front-end attacks are therefore a distinct and complementary threat that requires its own set of defences.

## Transaction Simulation and Review

Transaction simulation tools show users the expected outcome of a transaction before they sign it. Wallet extensions and built-in wallet features can display which tokens will be transferred, which approvals will be granted and to which addresses. Users can reject a transaction before signing if it requests an unexpected approval or sends funds to an unfamiliar address.

## Hardware Wallet Confirmation

Hardware wallets display transaction details on a separate, trusted screen that the compromised website cannot control. Users can verify the recipient address, token amounts and approval targets on the device before signing. The device creates an air gap between the compromised frontend and the signing step.

## Decentralised Frontend Hosting

Hosting frontend code on IPFS (InterPlanetary File System) with ENS (Ethereum Name Service) resolution eliminates the DNS registrar as a single point of failure. Content on IPFS is addressed by its cryptographic hash, so any modification to the frontend code would change its address, making tampering detectable. Multiple independent gateways can serve the same content, removing reliance on any single hosting provider.

## Dependency Security

Development teams can guard against dependency poisoning by pinning exact package versions, using lockfiles with integrity hashes, running automated vulnerability scanning and limiting the number of third-party dependencies. Subresource Integrity (SRI) tags on script elements ensure that browsers only execute scripts whose content matches a known hash.

## Why It Matters

Front-end attacks highlight a core challenge in the transition from Web2 to Web3: decentralising the backend (smart contracts on a blockchain) does not automatically decentralise the frontend. Most users interact with DeFi through conventional websites served by conventional infrastructure, which means the security of user funds depends on the security of DNS registrars, CDN providers and npm packages just as much as it depends on smart contract audits.
The maturing DeFi ecosystem is leading protocols to invest more in frontend security: decentralised hosting, multiple independent frontends, transaction simulation as a default wallet feature and operational security around deployment credentials. Safe self-custody requires you to understand front-end attacks: verifying what you sign matters as much as controlling your own keys. Further research on address poisoning attack defence and wallet security attack surfaces offers a deeper look at how attackers exploit web infrastructure to target crypto users.

## Risks and Considerations

This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.
Part of the [Nuri glossary](https://nuri.com/glossary), which defines 1876 Bitcoin, Lightning, wallet, stablecoin and payment terms.
