Home GnuPG
Diffusion GnuPG 4a4bb874f637

dirmngr: Avoid possible CSRF attacks via http redirects.

Description

dirmngr: Avoid possible CSRF attacks via http redirects.

* dirmngr/http.h (parsed_uri_s): Add fields off_host and off_path.
(http_redir_info_t): New.
* dirmngr/http.c (do_parse_uri): Set new fields.
(same_host_p): New.
(http_prepare_redirect): New.
* dirmngr/t-http-basic.c: New test.
* dirmngr/ks-engine-hkp.c (send_request): Use http_prepare_redirect
instead of the open code.
* dirmngr/ks-engine-http.c (ks_http_fetch): Ditto.

With this change a http query will not follow a redirect unless the
Location header gives the same host. If the host is different only
the host and port is taken from the Location header and the original
path and query parts are kept.

(cherry picked from commit fa1b1eaa4241ff3f0634c8bdf8591cbc7c464144)

  • Signed-off-by: Werner Koch <wk@gnupg.org>

Details

Provenance
wernerAuthored on Nov 22 2018, 10:27 PM
Parents
rG6acca0e4d9f9: doc: Clarify use of clear and nodefault in the AKL.
Branches
Unknown
Tags
Unknown