How to Stop Domain Hijacking in Automated Cloud Environments
Domain hijacking is no longer just a matter of an attacker guessing a weak GoDaddy password. As infrastructure has shifted into automated, code-driven cloud environments, the attack vectors for seizing control of a domain have evolved into sophisticated exploits targeting orphaned cloud resources, API key leaks, and registrar migrations.
The stakes for a hijacked domain are absolute. If an attacker gains control of your domain's DNS routing, they control your web traffic. They can alter MX records to intercept email—allowing them to trigger password resets for your organization's other critical services. They can also provision valid SSL/TLS certificates to make their phishing sites look perfectly legitimate to end-users.
Recent threat research has highlighted the severity of this shift. In mid-2024, security researchers from Infoblox and Eclypsium uncovered the "Sitting Ducks" vulnerability, revealing that over 1 million domains were susceptible to hijacking without the attacker ever needing to compromise the domain registrar. Around the same time, the massive migration of domains from Google Domains to Squarespace led to a wave of hijackings as attackers exploited the transition period and disabled Multi-Factor Authentication (MFA) requirements.
To secure your domains against modern threats, you must implement a defense-in-depth strategy that spans three critical layers: the registrar, the DNS infrastructure, and your SSL/TLS certificate controls.
Locking Down the Registrar Level
The registrar is the absolute root of trust for your domain. If an attacker compromises your registrar account, they can change the authoritative nameservers, effectively bypassing any downstream security controls you have in place.
Implement Registry Lock (EPP Status Codes)
The gold standard for registrar security is Registry Lock. Unlike a standard "registrar lock" (which is just a software toggle in your account dashboard), a true Registry Lock is enforced at the Top-Level Domain (TLD) registry level (such as Verisign for .com domains).
When Registry Lock is enabled, the registry applies specific Extensible Provisioning Protocol (EPP) status codes to the domain:
* serverTransferProhibited: The domain cannot be transferred to another registrar.
* serverUpdateProhibited: The domain's details, including authoritative nameservers, cannot be modified.
* serverDeleteProhibited: The domain cannot be deleted.
To make any changes to a domain with a Registry Lock, an authorized individual at your organization must complete a manual, out-of-band verification process (often a phone call with a passphrase) with the registrar, who then requests the registry to temporarily lift the lock. This completely neutralizes automated attacks and unauthorized dashboard changes.
Mandate Phishing-Resistant MFA
Threat actors are increasingly utilizing AI-generated documentation and deepfakes to impersonate domain owners, convincing registrar support teams to bypass MFA or change account email addresses. SMS-based MFA and Time-based One-Time Passwords (TOTP) are highly susceptible to phishing and adversary-in-the-middle (AiTM) attacks.
Move all registrar access to phishing-resistant MFA using FIDO2/WebAuthn hardware keys, such as YubiKeys. Additionally, utilize enterprise-grade registrars like MarkMonitor or Cloudflare's Custom Domain Protection, which support strict Role-Based Access Control (RBAC) and integrate directly with your corporate Identity Provider (IdP) via SAML/SSO.
Securing DNS and Preventing Subdomain Takeovers
In modern DevOps environments, DNS records are frequently created and destroyed dynamically via Infrastructure as Code (IaC) tools like Terraform or Pulumi. This automation introduces the risk of "dangling DNS"—the root cause of the "Sitting Ducks" vulnerability.
Eliminating Dangling DNS
A dangling DNS record occurs when a DNS entry (usually a CNAME or NS record) points to a cloud resource that has been deprovisioned, but the DNS record itself was never deleted.
For example, your CI/CD pipeline might deploy a temporary environment at staging.example.com pointing to an AWS S3 bucket named company-staging-bucket.s3.amazonaws.com. If a developer deletes the S3 bucket but forgets to remove the Route53 CNAME record, the DNS record is now "dangling." An attacker can simply create a new S3 bucket in their own AWS account with the name company-staging-bucket, and your trusted subdomain will immediately start serving the attacker's content.
To prevent this, you must enforce strict IaC lifecycle rules. A cloud resource must never be deleted before the corresponding DNS record is removed. When using Terraform, utilize explicit dependencies to ensure resources are destroyed in the correct order:
resource "aws_s3_bucket" "frontend_app" {
bucket = "company-frontend-app-prod"
}
resource "aws_route53_record" "app_cname" {
zone_id = aws_route53_zone.main.zone_id
name = "app.example.com"
type = "CNAME"
ttl = 300
records = [aws_s3_bucket.frontend_app.bucket_regional_domain_name]
# Ensure the DNS record is removed BEFORE the bucket is destroyed
depends_on = [aws_s3_bucket.frontend_app]
}
You should also proactively scan your infrastructure for dangling records. Open-source tools like ProjectDiscovery's Nuclei and subfinder can be integrated into your security pipelines to continuously monitor for vulnerable subdomains. For IaC scanning, tools like Checkov can analyze your Terraform code for potential dangling DNS configurations before they are merged.
Restricting DNS Provider API Keys
Because DNS management is highly automated, API keys for providers like AWS Route53, Cloudflare, or DNSimple are often stored as secrets in CI/CD pipelines (like GitHub Actions). If these keys are leaked or over-permissioned, attackers can hijack your DNS routing silently.
Enforce the principle of least privilege for all DNS API keys. An API key used by a pipeline to update a specific TXT record for ACME DNS-01 challenges should only have permission to update that specific record type, in that specific hosted zone.
Here is an example of a least-privilege AWS IAM policy that only allows modifying a specific Route53 zone, rather than granting route53:* across the account:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"route53:ChangeResourceRecordSets",
"route53:ListResourceRecordSets"
],
"Resource": "arn:aws:route53:::hostedzone/Z1EXAMPLEZONEID"
},
{
"Effect": "Allow",
"Action": "route53:GetChange",
"Resource": "arn:aws:route53:::change/*"
}
]
}
Additionally, bind API keys to specific IP addresses. If your CI/CD runners have static egress IPs, configure your DNS provider to reject API calls originating from outside that IP space.
SSL/TLS Controls as a Failsafe
If an attacker successfully bypasses your registrar and DNS security, their next step is almost always to provision a new SSL/TLS certificate for your domain. Browsers enforce strict HTTPS requirements; without a valid certificate, the attacker's phishing site will trigger massive security warnings for your users.
By implementing strict certificate controls, you can create a powerful failsafe that mitigates the impact of a hijacked domain.
Certificate Authority Authorization (CAA) Records
A CAA record is a DNS record that specifies exactly which Certificate Authorities (CAs) are permitted to issue certificates for your domain. If an attacker hijacks your DNS routing but fails to alter the CAA record (or if the CA has cached the legitimate CAA record), the CA will refuse to issue the rogue certificate.
Implementing a CAA record is straightforward. If your organization only uses Let's Encrypt for automated certificates, your zone file should include:
example.com. IN CAA 0 issue "letsencrypt.org"
example.com. IN CAA 0 issuewild ";"
example.com. IN CAA 0 iodef "mailto:security@example.com"
0 issue "letsencrypt.org": Only Let's Encrypt can issue standard certificates.0 issuewild ";": The semicolon explicitly forbids any CA from issuing wildcard certificates for this domain.0 iodef "mailto:security@example.com": Instructs the CA to email your security team if a certificate request is blocked due to CAA policy.
Continuous Certificate Transparency (CT) Monitoring
Every publicly trusted CA is required to log all issued certificates to public, append-only databases known as Certificate Transparency (CT) logs. If an attacker manages to provision a rogue certificate for your hijacked domain, it will appear in these logs immediately.
Continuous monitoring of CT logs is your early warning system for domain hijacking. If your security team receives an alert that a certificate was issued by a CA you don't use, or for a subdomain you didn't provision, you can initiate incident response protocols before the attacker can launch their campaign.
This is where dedicated lifecycle management platforms become essential. Using Expiring.at not only centralizes your expiration tracking to prevent self-inflicted outages, but it also provides crucial visibility into your certificate landscape. By maintaining a strict inventory of expected certificates, any anomalous issuance detected in the wild immediately stands out, allowing you to rapidly identify unauthorized infrastructure or