The vulnerability exists in the transfer plugin of CoreDNS, specifically within the longestMatch function located in plugin/transfer/transfer.go. The function's purpose is to select the correct Access Control List (ACL) stanza based on the most specific matching zone. The vulnerability was introduced because the implementation used a lexicographical string comparison (if z > zone) to determine the 'longest' match. This is incorrect because a shorter parent domain (e.g., example.org.) can be lexicographically greater than a longer, more specific subdomain (e.g., a.example.org.). As a result, a permissive ACL on a parent domain could override a restrictive ACL on a subdomain, allowing unauthorized zone transfers (AXFR/IXFR).
The patch for this vulnerability, found in commit 9b57778db26452e50d40e97d5f7a99f7c0211300, corrects this logic by changing the comparison to if len(z) > len(zone). This ensures that the function correctly selects the zone with the longest string length, which corresponds to the most specific DNS zone, thus correctly enforcing the intended ACLs. The vulnerable function, transfer.longestMatch, is the key runtime indicator for this vulnerability.