Page MenuHome GnuPG

dirmngr, when configured to use an .onion address, should not permit HTTP redirects to a non-onion address
Closed, ResolvedPublic

Description

consider the following connection to a misconfigured .onion hkp backend:

dirmngr: permanently loaded certificates: 0
dirmngr:     runtime cached certificates: 0
dirmngr: URL 'http://jirk5u4osbsr34t5.onion:11371/pks/lookup?op=get&options=mr&search=0xXXXXXXXXXXXXXXXX' redirected to 'https://geekchimp.com/pks/lookup?op=get&options=mr&search=0xXXXXXXXXXXXXXXXX' (301)
dirmngr: can't connect to 'geekchimp.com': no IP address for host
dirmngr: error connecting to 'http://jirk5u4osbsr34t5.onion:11371': Unknown host
dirmngr: marking host 'jirk5u4osbsr34t5.onion' as dead
dirmngr: host 'jirk5u4osbsr34t5.onion' marked as dead
dirmngr: command 'KS_GET' failed: No keyserver available

While the server side is clearly misconfigured here, i think if the user has chosen only a .onion address, dirmngr itself should not accept redirections to a public (non-onion) service, to protect the user from such a misconfiguration.

Event Timeline

dkg created this object in space S1 Public.
justus triaged this task as Wishlist priority.Jun 8 2017, 2:53 PM
justus added projects: gnupg (gpg22), dirmngr.

Fixed in e7fc6e3bf0eb6ffe53e1f099d28ce45cef4a8a87.

Note that the redirect did not work, but a bit by accident. See how it says:

dirmngr: can't connect to 'geekchimp.com': no IP address for host

That is because the original host used neither IPv4 nor IPv6, and any further lookups also used neither IPv4 nor IPv6, hence it failed to connect to the redirection target. I'm not sure if it sent a DNS request.

In any case, it now explicitly denies these kind of redirects, and does not even leak DNS requests.