Note: There are a few cases of duplicates in user autocompletion which are being worked on.
Bug 450013 (CVE-2010-2757)

[SECURITY] Can sudo a user without sending email

RESOLVED FIXED in Bugzilla 3.2

Status

()

Bugzilla
User Accounts
RESOLVED FIXED
9 years ago
7 years ago

People

(Reporter: bbaetz, Assigned: Frédéric Buclin)

Tracking

(Blocks: 1 bug)

Details

(Whiteboard: [infrasec:access])

Attachments

(3 attachments, 1 obsolete attachment)

(Reporter)

Description

9 years ago
The cookie for sudo is the userid.

1. Find out user's id (some queries with debug=1 will expose this)
2. Add cookie 'sudo=<id>'
3. Visit bugzilla site

Actual:

Have sudoed user

Expected:

Fails.

This needs to use a cookie from the token table (that verifies the (originaluser, targetuser) tuple, or something similar. You need to have privileges to sudo, so its not a permissions exploit, but its still not good.....

Updated

9 years ago
Severity: blocker → critical
Flags: blocking3.2?
OS: Linux → All
Hardware: PC → All
(Assignee)

Comment 1

9 years ago
I wouldn't qualify this bug as critical as you cannot do more than what the normal workflow lets you do. The only difference is that no email is sent to the one being sudo'ed, which is by far much less critical than being able to sudo someone in the bz_sudo_protect group (which you cannot do) or being able to sudo someone despite you don't belong to the bz_sudoers group (which you cannot do).
Severity: critical → major

Comment 2

9 years ago
Heck, I didn't even want the email to be sent, when we implemented sudo. :-) So I'm not super-concerned about this, but I do agree it's a security bug in a minor sense.
Severity: major → normal

Comment 3

9 years ago
We're too close to 3.2 and this is too minor to be a blocker.
Flags: blocking3.2? → blocking3.2-
Duplicate of this bug: 556649
(Assignee)

Comment 5

7 years ago
I will give it a look once 3.6 is released.
Target Milestone: --- → Bugzilla 3.2
Blocks: 555735
(Assignee)

Comment 6

7 years ago
Created attachment 445238 [details] [diff] [review]
patch, v1

The cookie now contains a token, which is only created when using the correct way to impersonate users. If something goes wrong, we now throw an error rather than silently falling back to the sudoer (impersonation is critical enough to notify the sudoer).
Assignee: user-accounts → LpSolit
Status: NEW → ASSIGNED
Attachment #445238 - Flags: review?(mkanat)

Updated

7 years ago
Attachment #445238 - Flags: review?(mkanat) → review-

Comment 7

7 years ago
Comment on attachment 445238 [details] [diff] [review]
patch, v1

  Man, we really need to make tokens into objects. That's for a later time, though.


>+        if (!$user_id
>+            || $user_id != $authenticated_user->id
>+            || !detaint_natural($sudo_target_id)
>+            || time() - str2time($date) > MAX_SUDO_TOKEN_AGE)

  I'd like to see parens around that last time()- condition, to make the precedence clearer.

>Index: relogin.cgi
>+    my $time_string = time2str('%a, %d-%b-%Y %T %Z', time+(MAX_SUDO_TOKEN_AGE), 

  Those parens probably aren't necessary now.

>Index: template/en/default/global/user-error.html.tmpl
>+  [% ELSIF error == "sudo_invalid_cookie" %]
>+    [% title = "Invalid Sudo Cookie" %]
>+    Your sudo cookie is invalid. Either it expired or you didn't start
>+    a sudo session correctly.

  For the case where it expired, we should tell the user that they can just refresh the page or load another page to continue what they are doing as themselves.

>+  [% ELSIF error == "sudo_illegal_action" %]
>+    [% ELSE %]
>+      The user you try to impersonate doesn't exist.

  s/try/tried/
Whiteboard: [infrasec:access]
(Assignee)

Updated

7 years ago
Flags: blocking3.6.2+
(Assignee)

Comment 8

7 years ago
Created attachment 456033 [details] [diff] [review]
patch for 3.6 - 4.2, v2
Attachment #445238 - Attachment is obsolete: true
Attachment #456033 - Flags: review?(mkanat)
(Assignee)

Updated

7 years ago
Attachment #456033 - Flags: review?(mkanat) → review?(bugzilla)
Comment on attachment 456033 [details] [diff] [review]
patch for 3.6 - 4.2, v2

r=glob
Attachment #456033 - Flags: review?(bugzilla) → review+
(Assignee)

Comment 10

7 years ago
It needs a backport for 3.4 and 3.2.
Flags: blocking4.0+
Flags: blocking3.4.8+
Flags: blocking3.2.8+
Flags: approval?
Flags: approval4.0?
Flags: approval3.6?
(Assignee)

Updated

7 years ago
Attachment #456033 - Attachment description: patch, v2 → patch for 3.6 - 4.2, v2
(Assignee)

Comment 11

7 years ago
Created attachment 458238 [details] [diff] [review]
patch for 3.4, v1

Same patch as for 3.6-4.2, except that it fixes a small bitrot due to context lines which changed in Constants.pm.
Attachment #458238 - Flags: review?(bugzilla)
(Assignee)

Comment 12

7 years ago
Created attachment 458240 [details] [diff] [review]
patch for 3.2, v1

Minor bitrot in Bugzilla.pm for 3.2 due to |use DateTime::TimeZone| which doesn't exist there. No other changes.
Attachment #458240 - Flags: review?(bugzilla)
Comment on attachment 458238 [details] [diff] [review]
patch for 3.4, v1

r=glob
Attachment #458238 - Flags: review?(bugzilla) → review+
Comment on attachment 458240 [details] [diff] [review]
patch for 3.2, v1

r=glob
Attachment #458240 - Flags: review?(bugzilla) → review+
(Assignee)

Comment 15

7 years ago
ok, this bug is ready for checkin. Thanks glob for the reviews.
Flags: approval3.4?
Flags: approval3.2?
(Assignee)

Updated

7 years ago
Summary: Can sudo a user without sending email → [SECURITY] Can sudo a user without sending email
(Assignee)

Updated

7 years ago
Blocks: 580214
(Assignee)

Updated

7 years ago
Version: unspecified → 2.22
Alias: CVE-2010-2757
(Assignee)

Updated

7 years ago
Flags: approval?
Flags: approval4.0?
Flags: approval4.0+
Flags: approval3.6?
Flags: approval3.6+
Flags: approval3.4?
Flags: approval3.4+
Flags: approval3.2?
Flags: approval3.2+
Flags: approval+
(Assignee)

Comment 16

7 years ago
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla.pm
modified relogin.cgi
modified Bugzilla/Constants.pm
modified template/en/default/global/user-error.html.tmpl
Committed revision 7429.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.0/
modified Bugzilla.pm
modified relogin.cgi
modified Bugzilla/Constants.pm
modified template/en/default/global/user-error.html.tmpl
Committed revision 7370.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/3.6/
modified Bugzilla.pm
modified relogin.cgi
modified Bugzilla/Constants.pm
modified template/en/default/global/user-error.html.tmpl
Committed revision 7158.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/3.4/
modified Bugzilla.pm
modified relogin.cgi
modified Bugzilla/Constants.pm
modified template/en/default/global/user-error.html.tmpl
Committed revision 6772.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/3.2/
modified Bugzilla.pm
modified relogin.cgi
modified Bugzilla/Constants.pm
modified template/en/default/global/user-error.html.tmpl
Committed revision 6393.
Status: ASSIGNED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED

Comment 17

7 years ago
Security advisory sent, unlocking bug.
Group: bugzilla-security
Duplicate of this bug: 321015
You need to log in before you can comment on or make changes to this bug.