Skip to content

Protect server DOI lookups from unsafe redirects #800

Backlog

Description

@Siedlerchr

Problem

When the HTTP server receives a plain-text citation containing a DOI, it automatically fetches DOI metadata. A DOI resolver can redirect the metadata request to another URL. If a DOI redirects to an internal destination, this may allow an HTTP client to cause the server to request an internal service (server-side request forgery).

URLDownload currently enables automatic redirects, so the application cannot validate each destination before it is contacted. This concern was raised during review of JabRef#17900. The exploitability depends on server exposure and whether an attacker can control a resolver redirect.

Desired behavior

Keep automatic DOI metadata lookup while preventing DOI requests initiated by untrusted HTTP input from reaching internal services. Restrict schemes and destinations, validate every redirect hop, and reject unsafe destinations before connecting. Preserve normal DOI resolution and citation-parser fallback when a lookup is rejected or fails.

A DNS check followed by a separate connection is insufficient: bind the connection to an address that passed validation, while retaining hostname verification and TLS SNI. Account for IPv4 and IPv6, retries, proxies, and redirect limits. Add tests for unsafe redirects and DNS rebinding as well as permitted public destinations.

Implementation idea

Add an opt-in destination policy to the HTTP client used for DOI lookups initiated by the server. Disable automatic redirects for requests using this policy, validate each target, and connect only to a validated address while retaining the original hostname for TLS. The current HttpURLConnection path does not provide that address binding through a separate DNS check, so this likely requires a different connection mechanism. Apply the policy to agency detection, DOI metadata retrieval, and the separate mEDRA fetcher path, including retries and redirects.

A hostname check or a DNS lookup before opening an ordinary connection is only a partial mitigation and can be bypassed by DNS rebinding.

References

Activity

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

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