From 0e390970ba51b14a5dc780be7c6f0d6d7baa67e3 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Thu, 17 Apr 2014 18:11:12 +0200 Subject: Bug 713926: (CVE-2014-1517) [SECURITY] Login form lacks CSRF protection r=dkl a=justdave --- relogin.cgi | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'relogin.cgi') diff --git a/relogin.cgi b/relogin.cgi index 52944a811..0c1cb9ad6 100755 --- a/relogin.cgi +++ b/relogin.cgi @@ -52,6 +52,19 @@ elsif ($action eq 'prepare-sudo') { # Keep a temporary record of the user visiting this page $vars->{'token'} = issue_session_token('sudo_prepared'); + if ($user->authorizer->can_login) { + my $value = generate_random_password(); + my %args; + $args{'-secure'} = 1 if Bugzilla->params->{ssl_redirect}; + + $cgi->send_cookie(-name => 'Bugzilla_login_request_cookie', + -value => $value, + -httponly => 1, + %args); + + $vars->{'login_request_token'} = issue_hash_token(['login_request', $value]); + } + # Show the sudo page $vars->{'target_login_default'} = $cgi->param('target_login'); $vars->{'reason_default'} = $cgi->param('reason'); -- cgit v1.2.3-24-g4f1b