RC RANDOM CHAOS

$3 and a rented IP took over treasury.gov

Researchers claimed five treasury.gov subdomains by cycling AWS Elastic IPs against dangling DNS records at about $3 per takeover. AWS declined to change it.

· 4 min read
$3 and a rented IP took over treasury.gov

Intruder’s researchers took control of five US Treasury subdomains by renting AWS Elastic IP addresses and checking each one against a list of known DNS records. Each valid takeover cost them about $3.

The five were ftp.treasury.gov, irssearch.treasury.gov, pcp.treasury.gov, rdgw.treasury.gov and ww5.treasury.gov. Each still had an A record pointing at an Elastic IP whose owner had released it back to AWS. An Elastic IP is an internet-routable address AWS allocates to any EC2 account on request. Allocation is random, so you can’t pick a specific address, but you can allocate and release in a loop and keep whichever ones land on a record you care about.

The loop

The target list came from public bug bounty scopes. They pulled wildcard entries with the bbscope API, enumerated subdomains with subfinder, resolved the A records, and stored every address outside private and reserved ranges in a DynamoDB table.

A new AWS account holds five Elastic IPs per region by default. Service Quotas auto-approves a bump to 25 per region with no support case, so they raised the limit everywhere. The script then ran a simple cycle: allocate 25 Elastic IPs in a region, deduplicate, look each one up in the table, keep and log any match, release the rest, move to the next region.

Region rotation mattered. Releasing and immediately reallocating in the same region often returned the same addresses, because AWS recycles recently freed IPs first. Moving through other regions gave each pool time to turn over, so a return trip handed out a fresh set.

In 48 hours the account cycled through 450,000 unique addresses before AWS banned it. That run produced 28 live takeovers across the bug bounty scope, almost half of them government bodies, plus a university, a financial services company and a large networking vendor. It covered 0.56% of AWS’s published EIP space.

The ban that wasn’t

AWS’s abuse response blocked the account’s ability to allocate and associate Elastic IPs in all regions. It also locked them out of the matched IPs they already held, which they needed to host proof-of-concept pages for disclosure.

AWS lets you transfer Elastic IPs between accounts. The researchers spun up a second account inside the same organization and moved the matched addresses over. It worked. New accounts under an organization skip the verification step, and the ban applied to the account rather than the organization, so an attacker who gets restricted can open another account and keep going. They proposed two fixes to AWS: a monthly cap on EIP allocations, and abuse restrictions at the organization level. AWS declined both.

Why a dangling .gov record is worth $3

Whoever holds the IP behind the record controls what the subdomain serves. US government guidance tells people a site is trustworthy if the domain ends in .gov and uses HTTPS, and a taken-over subdomain passes both checks. The attacker can complete a certificate authority’s domain validation and get a trusted TLS certificate, so the padlock is real.

That buys convincing phishing on a genuine government domain, a collection point for any old automation still pointing at the address, and whatever credentials those automations send. Credentials harvested this way often open other systems unrelated to the original subdomain.

Cookies make it worse. If treasury.gov sets cookies scoped with Domain=treasury.gov, the browser sends them to every subdomain, including one an attacker now controls. That opens session theft against other treasury.gov applications.

How fast could someone sweep the whole space

AWS publishes about 80 million IPv4 addresses for EC2. At roughly 9,400 allocations an hour, one account would take a year to cycle through all of it. Ten accounts, if bans stay per-account, bring that to about five weeks. The real figure is lower, because much of the space is auto-assigned public IPs or addresses held long-term by other customers and never comes free.

Targeting one organization shrinks the search. AWS publishes the region of each address range, so an attacker enumerates a target’s subdomains, finds records pointing at EC2 addresses, and searches only the relevant region. A target in eu-west-2 narrows the pool from 80 million to about 2.2 million. Same-region allocation returns duplicates more often, so the smaller haystack is also slower to search.

What to do about it

The dangling record is the defender’s to fix, and AWS has said it considers the problem to sit there rather than in its services. When you release an Elastic IP or tear down an EC2 host, delete the DNS record that pointed at it in the same change. Audit existing A records for addresses you no longer own, and flag any subdomain that resolves to infrastructure outside your accounts. Review parent-domain cookie scoping, since a broadly scoped Domain= attribute turns any orphaned subdomain into a session-theft vector. Intruder covered under 1% of the space in two days and found 28; the rest are still out there.

Share

Keep Reading

Latest on the Wire

Full wire →

New signal daily · RSS

Stay in the loop

New writing delivered when it's ready. No schedule, no spam.