CVE-2026-25518: Unchecked Dns Message Slice Cast

Direct index access and unchecked type assertion on a DNS message slice (e.g., `Answer`, `Ns`, `Extra`) can result in out-of-bounds access or type assertion panics if the DNS response is modified, empty, or contains unexpected record types. Iterate over the slice and use a comma-ok type assertion instead.

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0Goβ
greprules fetch cve-2026-25518-unchecked-dns-message-slice-cast --engine opengrep

Description

Direct index access and unchecked type assertion on a DNS message slice (e.g., `Answer`, `Ns`, `Extra`) can result in out-of-bounds access or type assertion panics if the DNS response is modified, empty, or contains unexpected record types. Iterate over the slice and use a comma-ok type assertion instead.