From 3ccf5a8a5d5ede8cb37d5e5886c128c6bb35ae00 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 14 May 2019 16:03:02 +0200 Subject: [PATCH] =?utf8?q?Sessions:=20keine=20Pr=C3=BCfung=20der=20Quell-I?= =?utf8?q?P-Adresse?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Wenn ein Hostname sowohl A- (IPv4) als auch AAAA-Records (IPv6) aufweist, nutzen manche Reverse Proxies wie nginx mal IPv4, mal IPv6. Dadurch prüft kivitendo manchmal (nämlich genau dann, wenn die Verbindung über IPv4 reinkommt) die Quell-IP. Wurde die Session aber initial über IPv6 erzeugt, so schlägt die Quell-IP-Prüfung natürlich fehl. Die Quell-IP-Prüfung liefert eh einen mehr als fragwürdigen Gewinn an Sicherheit. Für IPv6, wo sich die Quell-Adresse aufgrund von Techniken wie Privacy Extensions mitten in der Session ändern kann, haben wir die Prüfung ja eh schon nicht mehr. --- SL/Auth.pm | 2 -- 1 file changed, 2 deletions(-) diff --git a/SL/Auth.pm b/SL/Auth.pm index 63412e0be..0662c6407 100644 --- a/SL/Auth.pm +++ b/SL/Auth.pm @@ -577,12 +577,10 @@ sub restore_session { # 1. session ID exists in the database # 2. hasn't expired yet # 3. if cookie for the API token is given: the cookie's value equal database column 'auth.session.api_token' for the session ID - # 4. if cookie for the API token is NOT given then: the requestee's IP address must match the stored IP address $self->{api_token} = $cookie->{api_token} if $cookie; my $api_token_cookie = $self->get_api_token_cookie; my $cookie_is_bad = !$cookie || $cookie->{is_expired}; $cookie_is_bad ||= $api_token_cookie && ($api_token_cookie ne $cookie->{api_token}) if $api_token_cookie; - $cookie_is_bad ||= $cookie->{ip_address} ne $ENV{REMOTE_ADDR} if !$api_token_cookie && $ENV{REMOTE_ADDR} !~ /^$IPv6_re$/; if ($cookie_is_bad) { $self->destroy_session(); return $self->session_restore_result($cookie ? SESSION_EXPIRED() : SESSION_NONE()); -- 2.20.1