id: detect-dangling-cname

info:
  name: CNAME Detect Dangling
  author: pdteam,nytr0gen
  severity: info
  description: A CNAME detect dangling condition was discovered. Most commonly this relates to failing to remove records from the zone once they are no longer needed.
  reference:
    - https://securitytrails.com/blog/subdomain-takeover-tips
    - https://nominetcyber.com/dangling-dns-is-no-laughing-matter/
    - https://nabeelxy.medium.com/dangling-dns-records-are-a-real-vulnerability-361f2a29d37f
    - https://docs.microsoft.com/en-us/azure/security/fundamentals/subdomain-takeover
  classification:
    cwe-id: CWE-200
  metadata:
    max-request: 1
  tags: dns,takeover,discovery

dns:
  - name: "{{FQDN}}"
    type: A

    matchers-condition: and
    matchers:
      - type: word
        words:
          - "NXDOMAIN"

      - type: regex
        part: answer
        regex:
          - "IN\tCNAME\t(.+)$"

    extractors:
      - type: dsl
        dsl:
          - cname
# digest: 490a00463044022071c2da3a7794b35e19c9acc980c48457bd7b65437dedc9d6676b4f6b14b3b10c0220243fa7dd237ffa0ca9359faaca65b1a1f7eb9500fd170deb4b757afa0fd5c547:922c64590222798bb761d5b6d8e72950