Описание
CoreDNS: DNS Cache Pinning via etcd Lease ID Confusion
Summary
The CoreDNS etcd plugin contains a TTL confusion vulnerability where lease IDs are incorrectly used as TTL values, enabling cache pinning for very long periods. This can effectively cause a denial of service for DNS updates/changes to affected services.
Details
In plugin/etcd/etcd.go
, the TTL()
function casts the 64-bit etcd lease ID to a uint32 and uses it as the TTL:
Lease IDs are identifiers, not durations. Large lease IDs can produce very large TTLs after truncation, causing downstream resolvers and clients to cache answers for years.
This enables cache pinning attacks, such as:
- Attacker has etcd write access (compromised service account, misconfigured RBAC/TLS, exposed etcd, insider).
- Attacker writes/updates a key and attaches any lease (the actual lease duration is irrelevant; the ID is misused).
- CoreDNS serves the record with an extreme TTL; downstream resolvers/clients cache it for a very long time.
- Even after fixing/deleting the key (or restarting CoreDNS), clients continue to use the cached answer until their caches expire or enforce their own TTL caps.
Some resolvers implement TTL caps, but values and defaults vary widely and are not guaranteed.
PoC
- Launch etcd:
- Prepare CoreDNS configuration:
- Launch CoreDNS:
- Create an etcd record called
large-lease-service
with a lease grant of 1 hour:
- Verify the lease details:
- Query the DNS record and observe the record TTL at 28 years:
Impact
Affects any CoreDNS deployment using the etcd plugin for service discovery.
- Availability: High as service changes (IP rotations, failovers, rollbacks) may be ignored for extended periods by caches.
- Integrity: Low as stale/incorrect answers persist abnormally long. (Note: attacker with etcd write could already point to malicious endpoints; the bug magnifies persistence.)
- Confidentiality: None.
The bug was introduced in #1702 as part of the CoreDNS v1.2.0 release.
Mitigation
The TTL function should utilise etcd's Lease API to determine the proper TTL for leased records. Add configurable limits for minimum and maximum TTL when passing lease records, to clamp potentially extreme TTL values set as lease grant.
Credit
Thanks to @thevilledev for disclovering this vulnerability and contributing a fix.
For more information
Please consult our security guide for more information regarding our security process.
Пакеты
github.com/coredns/coredns
>= 1.2.0, < 1.12.4
1.12.4
Связанные уязвимости
CoreDNS is a DNS server that chains plugins. Starting in version 1.2.0 and prior to version 1.12.4, the CoreDNS etcd plugin contains a TTL confusion vulnerability where lease IDs are incorrectly used as TTL values, enabling DNS cache pinning attacks. This effectively creates a DoS condition for DNS resolution of affected services. The `TTL()` function in `plugin/etcd/etcd.go` incorrectly casts etcd lease IDs (64-bit integers) to uint32 and uses them as TTL values. Large lease IDs become very large TTLs when cast to uint32. This enables cache pinning attacks. Version 1.12.4 contains a fix for the issue.
CoreDNS is a DNS server that chains plugins. Starting in version 1.2.0 ...