Skip to content

net: Lookup functions may return invalid host names #46241

@rolandshoemaker

Description

@rolandshoemaker

The net.Lookup{Addr,CNAME,Host} functions don't do any filtering of returned host name string types when using the pure Go resolver, allowing for invalid names to be returned to the caller. If the caller expects these names to be valid they may use them in an unsanitized context, allowing for injection of unexpected content. Depending on the implementation, the cgo resolver may do some level of filtering, for instance the glibc implementation of getaddrinfo does impose its own filtering.

The simple approach to this is to check returned names with the existing isDomainName function, which applies RFC 1035 LDH rules (as well as allowing underscores for SRV style names), and failing out if the returned names are not considered proper. This should mostly match glibc behavior. In order to avoid diverging behavior across implementations, the check should probably be done at the Resolver level, rather than just in the pure Go Lookup... implementations.

This is CVE-2021-33195.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.Securityokay-after-beta1Used by release team to mark a release-blocker issue as okay to resolve either before or after beta1release-blocker

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions