Skip to content

crypto/x509: Darwin verification can crash on invalid UTF-8 DNSName #79867

Description

@jvdprng

Description

On Darwin, platform certificate verification passes VerifyOptions.DNSName to CoreFoundation/Security.framework policy creation. Invalid UTF-8 hostname input can reach a platform failure path and crash the process instead of returning a Go verification error.

The input is caller-supplied, so impact depends on an application passing attacker-controlled invalid UTF-8 hostnames into verification.

Specification or documentation

This is a Go API robustness issue. Certificate.Verify and platform verification should return errors for invalid verification inputs rather than crashing the process.

Code references

  • go/src/crypto/x509/root_darwin.go:16 defines Darwin systemVerify.
  • go/src/crypto/x509/root_darwin.go:40 calls macos.SecPolicyCreateSSL(opts.DNSName).
  • go/src/crypto/x509/internal/macos/security.go:71 through go/src/crypto/x509/internal/macos/security.go:79 builds the platform SSL policy from the provided string.

Test case

This should be a Darwin-only X.509 platform test: call Certificate.Verify with VerifyOptions.DNSName containing invalid UTF-8 and assert that verification returns an error instead of crashing.

It is platform-specific and belongs in Darwin X.509 tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions