A decentralised application can have audited smart contracts and still drain its users' wallets, because the web page that builds the transaction runs on ordinary, centralised infrastructure. Whoever controls the domain, the DNS records, the hosting bucket, the CDN or a single JavaScript dependency can change what the user is asked to sign. Users see a familiar address and a valid certificate, and approve a transaction that sends funds to the attacker. This guide covers the controls that protect dApp front ends: registrar and registry locks, DNSSEC, phishing-resistant MFA on DNS and registrar accounts, hosting and CDN access, Subresource Integrity (SRI), Content Security Policy (CSP), dependency pinning, decentralised hosting options such as IPFS with ENS, and monitoring for DNS and script changes. It is for Web3 engineering and security teams. It is vendor-neutral and does not compare registrars or hosting providers.
Key takeaways
- The front end is part of the signing path. Treat the domain, DNS, hosting and scripts with the same change control as contract deployment keys.
- Lock the domain at the registry, not only the registrar. Registry Lock sets server-level statuses that take precedence over registrar-level ones and need an out-of-band process to lift.
- Accounts that can change DNS are privileged identities. Registrar, DNS provider, cloud storage and CI accounts need phishing-resistant MFA, few holders and short-lived credentials.
- Pin and verify every script. Lockfiles with hashes, SRI on anything loaded from another origin, and a strict CSP limit what a compromised dependency or CDN can inject.
- Detect changes in minutes. Monitor DNS records, nameservers, certificate issuance and the hashes of deployed bundles, with a rehearsed takedown and user warning plan.
Why front ends are a target
Attackers go after the front end because it is often easier to compromise than the contracts, and because one change reaches every visitor at once. The paths fall into four groups:
| Attack path | What changes | ATT&CK reference | Primary controls |
|---|---|---|---|
| Registrar account takeover or social engineering of registrar support | Nameservers or domain ownership | T1584.002 DNS Server (resource development) | Registry Lock, registrar MFA, support verification settings |
| DNS provider account compromise | A, AAAA, CNAME or NS records point to attacker hosting | T1584.002 | Provider MFA, scoped API tokens, DNSSEC, change alerts |
| Hosting, bucket or CDN credential compromise | Served JavaScript replaced on the real domain | T1189 Drive-by Compromise | Least-privilege deploy identities, immutable deploys, bundle hash monitoring |
| Dependency or library compromise | Malicious code arrives through a trusted package | T1195.001 Compromise Software Dependencies and Development Tools | Pinning, lockfile hashes, SRI, provenance checks |
Two incidents show the hosting and dependency paths. In the Bybit hack, attackers who had hijacked a developer's authenticated AWS session altered JavaScript served from the Safe{Wallet} storage bucket so that it activated only for specific addresses, and removed it shortly after the theft. In the Ledger Connect Kit compromise, Ledger reported that a former employee's npm account was phished and malicious versions 1.1.5 to 1.1.7 were published; the malicious file was live for about five hours. CISA's Emergency Directive 19-01 describes the DNS path: an attacker with credentials for an account that can change DNS records redirects traffic and can then obtain valid certificates for the domain, so users see no warning.
Registrar and DNS controls
Domain locks
ICANN's EPP status codes distinguish client statuses, set by the registrar, from server statuses, set by the registry, and server statuses take precedence. Some registry operators offer a Registry Lock service which, requested through the registrar, sets serverDeleteProhibited, serverTransferProhibited and serverUpdateProhibited. Removing them takes longer than removing client locks because the registrar must ask the registry. That delay is the point: a stolen registrar password alone cannot move nameservers.
| Control | Protects against | Trade-off |
|---|---|---|
| clientTransferProhibited, clientUpdateProhibited, clientDeleteProhibited | Casual transfers and edits | An attacker in the registrar account can remove them |
| Registry Lock (server* statuses) | Nameserver change, transfer or deletion via a compromised registrar account | Legitimate changes need the out-of-band unlock process; not offered by every registry or registrar |
| DNSSEC signing with DS record at the parent | Forged answers from resolvers or on-path attackers | Does not stop an attacker who controls the registrar or DNS account; key rollover must be managed |
| CAA records | Certificate issuance by authorities you did not authorise | Bypassed if the attacker controls DNS |
DNSSEC is specified in the core RFCs 4033, 4034 and 4035, identified by RFC 9364 (BCP 237). It proves answers came from the zone's signer; it does not help when the attacker changes records with valid credentials. See the DNSSEC Deployment Guide.
Accounts that can change DNS
- MFA: require phishing-resistant MFA (FIDO2 security keys or passkeys) on registrar, DNS provider and cloud accounts. ED 19-01 recommends phishing-resistant factors and discourages SMS.
- Few holders: two or three named people, no shared logins, and a documented break-glass procedure.
- API tokens: scope DNS API tokens to one zone and the record types needed, store them in a secrets manager, and rotate them.
- Support verification: set the registrar's account recovery and support PIN options so that a phone call alone cannot change the account.
- Separate registrant contact: use a role mailbox on a domain you do not serve the dApp from, so a hijacked domain cannot receive its own recovery emails.
More detail is in the Domain and DNS Management Policy Template and the Corporate Domain Registrar buyer's guide.
CDN and hosting controls
- Deploy identities: only the CI pipeline writes to the production bucket or hosting project, using short-lived federated credentials (for example OpenID Connect from the CI system) instead of stored access keys. Humans get read access by default.
- Immutable, versioned deploys: publish each build to a new, content-hashed path and switch traffic by changing one pointer. Turn on object versioning so a tampered file can be compared and rolled back.
- Developer endpoints: the Bybit case shows that a hijacked, already MFA-authenticated session on a developer laptop bypasses MFA. Shorten session lifetimes for production cloud roles and require re-authentication for write actions.
- CDN configuration: protect the CDN account like the DNS account, restrict who can add edge functions or rewrite rules, and alert on configuration changes.
- Security headers: serve HTTPS only with HTTP Strict Transport Security, frame-ancestors restrictions to prevent clickjacking of signing pages, and the CSP described below.
For decentralised hosting, IPFS addresses content by a content identifier (CID) derived from a cryptographic hash, so any change to the content produces a different CID. ENSIP-7 (status final) defines the ENS contenthash field that points a name to IPFS or Swarm content, resolved by wallets and apps that support it. This moves the trust question: content at a CID cannot be altered, but whoever controls the ENS name can point it at a new CID, and users who reach the site through an HTTP gateway trust that gateway. Protect the ENS name owner key with a multisig or hardware wallet and treat contenthash updates as a release. Many teams run both: a conventional domain for most users and an IPFS build with a published CID for users who want to verify.
Script integrity and supply chain
The W3C Subresource Integrity specification (SRI 2 is a Working Draft dated 20 March 2026; SRI Level 1 is the published Recommendation) lets a page declare the hash of a script or stylesheet in the integrity attribute. Browsers must support SHA-256, SHA-384 and SHA-512, the specification names SHA-384 as a good baseline, cross-origin resources must be fetched with CORS (crossorigin="anonymous"), and on mismatch the browser refuses to execute the resource. The draft also defines Integrity-Policy and Integrity-Policy-Report-Only headers that can block scripts loaded without integrity metadata; check browser support before relying on them.
| Control | Where it applies | What it stops | Limit |
|---|---|---|---|
| Lockfile with integrity hashes, installs that fail on mismatch (for example npm ci) | Build | Silently pulling a new, malicious version | Does not help if the pinned version was already malicious |
| Exact version pinning and a cooling-off period for updates | Build | Short-lived malicious releases like the Ledger case | Needs a process to take security fixes quickly |
| Package provenance and trusted publishing checks | Build | Packages published outside the maintainer's pipeline | Only where the package publishes provenance |
| SRI on third-party scripts | Browser | Tampered files on a CDN or third-party host | Cannot be used on scripts that change without notice |
| Self-hosting third-party libraries | Build and hosting | Upstream CDN tampering | Moves update responsibility to you |
| CSP script-src with nonces or hashes, connect-src allow-list | Browser | Injected inline script and calls to unknown RPC or exfiltration endpoints | Does not stop malicious code inside an allowed file |
For a dApp, connect-src is especially useful: listing the RPC endpoints, indexers and wallet relay servers the app really uses means injected code cannot quietly send data elsewhere. See the Content Security Policy Guide, Dependency Pinning vs Version Ranges, npm Trusted Publishing and Provenance Guide and Client-Side Security Guide. Publishing credentials are non-human identities too: Ledger rotated the secrets used to publish and set the project read-only after its incident. See the npm Tokens Security Guide.
Implementation order
- Inventory: list every domain, registrar, DNS provider, hosting account, CDN, CI system, package and third-party script in the signing path, with owners.
- Lock accounts: phishing-resistant MFA on registrar, DNS, cloud and package registry accounts; remove leavers and shared logins.
- Lock the domain: apply client locks now and request Registry Lock where the registry offers it; add CAA records; sign the zone with DNSSEC after a test in a non-production zone.
- Harden deploys: move CI to federated short-lived credentials, make deploys immutable, turn on versioning.
- Integrity: pin dependencies, add SRI to cross-origin scripts, deploy CSP in report-only mode first, review violations for two weeks, then enforce. Roll back by switching to report-only if a legitimate flow breaks.
- Monitor and rehearse: turn on the alerts below and run a takeover exercise with the DNS Hijack Playbook.
Decision guidance: a small team can get most of the benefit from Registry Lock, security keys on three accounts, pinning and SRI. A protocol with large total value at risk should add an IPFS build with published CIDs, independent bundle monitoring from outside its own cloud, and a two-person rule for DNS and hosting changes.
Monitoring and incident response
- DNS and registrar: poll authoritative records and the parent zone's NS and DS records from several networks every few minutes and alert on any change; alert on registrar logins, contact changes and lock status changes. ED 19-01's first action is exactly this audit of records against intended values.
- Certificates: monitor Certificate Transparency logs for certificates you did not request. See the Certificate Transparency Monitoring Guide for Web Teams.
- Bundle integrity: fetch the production page and its scripts from outside your infrastructure and compare hashes with the build output; alert on any difference.
- Cloud audit logs: alert on writes to the production bucket or CDN configuration from any identity other than the deploy pipeline.
- Response: pre-draft a user warning for social channels and the app itself, keep contacts for registrar abuse teams and wallet providers that maintain phishing block lists, and know how to point users at the IPFS build. The Domain Registrar Compromise Playbook covers recovery.
| Metric | Target |
|---|---|
| Domains in the signing path under Registry Lock where offered | 100% |
| Accounts able to change DNS, hosting or packages with phishing-resistant MFA | 100% |
| Cross-origin scripts with SRI | 100% |
| Time from unauthorised DNS or bundle change to alert | Under 5 minutes |
| Time from alert to public user warning | Under 30 minutes (rehearsed) |
Common failure patterns
- Locks at the registrar only: client statuses removed by whoever logs in.
- Leaver access left on package registries: the Ledger case started with a former employee's npm account.
- Long-lived cloud sessions on developer laptops with write access to production hosting.
- Loading "latest" from a public CDN without a pinned version or SRI.
- CSP left in report-only indefinitely, or with a wildcard connect-src.
- No external monitoring: tampering found by users on social media instead of by alerts.
Framework mapping
| Control area | NIST CSF 2.0 | NIST SP 800-53 Rev. 5 |
|---|---|---|
| Inventory of domains, hosting and scripts | ID.AM-02 | CM-8 |
| Authenticating registrar, DNS and deploy identities | PR.AA-03 | IA-2 |
| DNSSEC on authoritative zones | PR.PS-01 | SC-20 |
| Script and dependency integrity | PR.PS-01 | SI-7, CM-14 |
| Third-party library and provider risk | GV.SC-07 | SR-3 |
| Monitoring DNS, certificates and bundles | DE.CM-09 | SI-4 |
Practitioner checklist
- Map every domain, DNS provider, hosting account, CDN, CI system and script in the transaction signing path, with an owner each.
- Enforce phishing-resistant MFA on registrar, DNS, cloud and package registry accounts and remove shared or leaver access.
- Apply Registry Lock where the registry offers it, plus client locks, CAA records and DNSSEC.
- Deploy only from CI with short-lived federated credentials to immutable, versioned storage.
- Pin dependencies with lockfile hashes, add SRI to cross-origin scripts and enforce a CSP with a tight connect-src.
- Protect the ENS name and publish IPFS CIDs if you offer a decentralised build.
- Monitor DNS, NS and DS records, Certificate Transparency and deployed bundle hashes from outside your infrastructure.
- Rehearse a front-end takeover with pre-written user warnings and registrar contacts.
Standards and references
- W3C: Subresource Integrity
- IETF: RFC 9364 DNS Security Extensions (DNSSEC)
- ICANN: EPP Status Codes
- CISA: Emergency Directive 19-01 Mitigate DNS Infrastructure Tampering
- ENS: ENSIP-7 Contenthash field
- IPFS: Content addressing and CIDs
- Ledger: Letter regarding the Ledger Connect Kit exploit
Related NHI Mgmt Group resources: Crypto Scam and Drainer Guide · Smart Contract Security Guide · Domain Portfolio and Lookalike Domain Management Guide · Blockchain Node and RPC Infrastructure Security Guide