Skip to content

oauth2: NewClient forwards bearer token on cross-host redirects #805

Description

@evilgensec

Transport.RoundTrip unconditionally injects the Authorization header on
every call, including intermediate calls http.Client makes for each
redirect hop. Go's http.Client strips the Authorization header before
building a cross-host redirect request, but oauth2.Transport re-adds the
token immediately, forwarding it to every host in the redirect chain.

Any application that uses NewClient and follows cross-host redirects will
forward its OAuth bearer token to the redirect destination. An attacker
who controls a redirect (via an open redirect on the target API, a DNS
hijack, or a user-controlled URL) can steal the token.

Fix tracked in #804.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions