Skip to content

net/http, x/net/idna: ToUnicode accepts Punycode labels encoding pure ASCII labelsΒ #78760

Closed

Description

@neild

The ToASCII and ToUnicode functions incorrectly accepted Punycode-encoded labels
that decode to an ASCII-only label. For example, ToUnicode("xn--example-.com")
incorrectly returned the name "example.com" rather than an error.

The idna package implements the processing algorithm from UTS 46.
Older versions of UTS 46 included a specification bug which permitted
multiple ASCII labels to decode to the same Unicode label.
UTS 46 revision 33 fixed the specification bug.
The idna package now implements the updated specification.

This behavior can lead to privilege escalation in programs using the idna package.
For example, a program which performs privilege checks on the ASCII hostname
may reject "example.com" but permit "xn--example-.com". If that program subsequently
converts the ASCII hostname to Unicode, it will inadvertently permits access
to the Unicode name "example.com".

Thanks to KC1zs4 (https://github.com/KC1zs4) for reporting this issue.

This is CVE-2026-39821 and Go issue https://go.dev/issue/78760.


This was a PUBLIC track issue, tracked in http://b/500342011.

Activity

  1. gopherbot commented on Apr 15, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/767220 mentions this issue: idna: update from x/text, fix ToUnicode and all-ASCII xn-- labels

  2. added
    BugReportIssues describing a possible bug in the Go implementation.
    on Apr 15, 2026
  3. neild commented on Apr 15, 2026

    @neild
    ContributorAuthor

    Thanks to @KC1zs4 for reporting this issue.

  4. added this to the Go1.27 milestone on Apr 20, 2026
  5. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Apr 20, 2026
  6. added
    NeedsFixThe path to resolution is known, but the work has not been done.
    and removed
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on May 22, 2026
  7. added a commit that references this issue on Jun 9, 2026
  8. 19 remaining items

  9. gopherbot commented on Jul 10, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/799120 mentions this issue: [release-branch.go1.26] all: update x/net

  10. gopherbot commented on Jul 10, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/799121 mentions this issue: [release-branch.go1.25] all: update x/net

  11. dmitshur commented on Aug 10, 2026

    @dmitshur
    Member

    I'm reopening this issue to track updating x/net/idna for older toolchains as well.

    @neild Just to confirm, there's nothing actually left to change in the Go 1.27 and newer toolchains, is that right? Backport issues #80298 and #80297 track the older toolchain backports. (Adding a release blocker so this isn't missed.)

  12. cipherboy commented on Aug 11, 2026

    @cipherboy
    Contributor

    @neild @dmitshur @cagedmantis This issue's description does not articulate the breakage mentioned in #80476 (error parsing trailing dots), though ostensibly probably is in scope as part of this CVE. Can you add that to the changelogs as well, please, before back porting?

    I was surprised at this behavior on 1.27rc2 without a corresponding release note. OpenBao and Vault both have test cases which rely on this behavior, which suggests a customer somewhere wanted it. I'm fine breaking it, would just like something in Go I can point to and right now #80476 as an unresponded, open issue isn't a great place to point whether this is intentional or not.

    Thanks!

  13. changed the title [-]x/net/idna: ToUnicode accepts Punycode labels encoding pure ASCII labels[/-] [+]net/http, x/net/idna: ToUnicode accepts Punycode labels encoding pure ASCII labels[/+] on Aug 13, 2026
  14. jub0bs commented on Aug 14, 2026

    @jub0bs
    Contributor

    @thatnealpatel Just to reiterate @cipherboy's comment, I believe that the fix for this is causing #80476, which hasn't received much attention so far. In that sense, I'm not sure whether this issue deserves to be closed as "completed".

    I would attempt to fix #80476 myself if only I had enough time to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugReportIssues describing a possible bug in the Go implementation.NeedsFixThe path to resolution is known, but the work has not been done.Securityrelease-blocker

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions