Closed
Bug 1317965
Opened 9 years ago
Closed 9 years ago
Flag permission checks broken by bug 1257662 allowing unauthorized flag modification
Categories
(bugzilla.mozilla.org :: Bug Creation/Editing, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jm.acuna73, Assigned: dylan)
Details
(Keywords: reporter-external, sec-low)
Attachments
(2 files, 4 obsolete files)
|
153.45 KB,
image/png
|
Details | |
|
3.50 KB,
patch
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36
Steps to reproduce:
I can change the sec-bounty flag of any bug with a fake mail account, for example: sec.bounty.mozilla@gmail.com
1 - Right click on the web page
2 - To inspect
3 - Change the value of the select
4 - Click "Save Changes" button
Test: https://bugzilla.mozilla.org/show_bug.cgi?id=855373
Actual results:
I can change the sec-bounty flag of any bug
Expected results:
I think certain flags should not be public
Comment 1•9 years ago
|
||
Not sure if this is bugzilla or bmo-specific. Dylan/dkl, can you take a look and/or move this to the right place if this isn't it?
Group: firefox-core-security → bugzilla-security
Component: Untriaged → Bug Creation/Editing
Flags: needinfo?(dylan)
Flags: needinfo?(dkl)
Product: Firefox → bugzilla.mozilla.org
Version: unspecified → Production
Comment 2•9 years ago
|
||
(In reply to Jose María Acuña from comment #0)
> I think certain flags should not be public
Oh yes. I think this flag ought to be restricted to the bounty team.
Comment 3•9 years ago
|
||
Also, Jose, can you please continue your security testing on our test version of Bugzilla and not on production? https://bugzilla.allizom.org
Flags: needinfo?(jm.acuna73)
| Reporter | ||
Comment 4•9 years ago
|
||
(In reply to Frederik Braun [:freddyb] from comment #3)
> Además, José, ¿podría continuar con las pruebas de seguridad en nuestra
> versión de prueba de Bugzilla y no en la producción?
> https://bugzilla.allizom.org
Sorry, the request:
Forbidden: You don't have permission to access /error/noindex.html on this server.
| Reporter | ||
Comment 5•9 years ago
|
||
More information:
You can modify any flag, even those that are disabled
| Reporter | ||
Updated•9 years ago
|
Flags: needinfo?(jm.acuna73)
| Assignee | ||
Updated•9 years ago
|
Assignee: nobody → dylan
Flags: needinfo?(dylan)
Comment 6•9 years ago
|
||
Just verified that a sec-bounty+ can be cleared or set back to ? by non-permitted user. But not set to - which generated an error after submit.
Flags: needinfo?(dkl)
Comment 7•9 years ago
|
||
(In reply to Jose María Acuña from comment #4)
> (In reply to Frederik Braun [:freddyb] from comment #3)
> > Además, José, ¿podría continuar con las pruebas de seguridad en nuestra
> > versión de prueba de Bugzilla y no en la producción?
> > https://bugzilla.allizom.org
>
> Sorry, the request:
>
> Forbidden: You don't have permission to access /error/noindex.html on this
> server.
I think Freddy meant https://landfill.bugzilla.org/ , which has several different bugzilla installs you can test with.
| Reporter | ||
Comment 8•9 years ago
|
||
(In reply to :Gijs Kruitbosch (PTO Nov. 17-20 inclusive) from comment #7)
> (In reply to Jose María Acuña from comment #4)
> > (In reply to Frederik Braun [:freddyb] from comment #3)
> > > Además, José, ¿podría continuar con las pruebas de seguridad en nuestra
> > > versión de prueba de Bugzilla y no en la producción?
> > > https://bugzilla.allizom.org
> >
> > Sorry, the request:
> >
> > Forbidden: You don't have permission to access /error/noindex.html on this
> > server.
>
> I think Freddy meant https://landfill.bugzilla.org/ , which has several
> different bugzilla installs you can test with.
Thanks Gijs!
| Assignee | ||
Comment 9•9 years ago
|
||
(In reply to Jose María Acuña from comment #8)
> (In reply to :Gijs Kruitbosch (PTO Nov. 17-20 inclusive) from comment #7)
> > (In reply to Jose María Acuña from comment #4)
> > > (In reply to Frederik Braun [:freddyb] from comment #3)
> > > > Además, José, ¿podría continuar con las pruebas de seguridad en nuestra
> > > > versión de prueba de Bugzilla y no en la producción?
> > > > https://bugzilla.allizom.org
> > >
> > > Sorry, the request:
> > >
> > > Forbidden: You don't have permission to access /error/noindex.html on this
> > > server.
> >
> > I think Freddy meant https://landfill.bugzilla.org/ , which has several
> > different bugzilla installs you can test with.
>
> Thanks Gijs!
That is also not correct. BMO is quite diverged from upstream at the moment.
the correct site is bugzilla-dev.allizom.org
| Assignee | ||
Comment 10•9 years ago
|
||
The problem is that https://github.com/mozilla-bteam/bmo/blob/master/Bugzilla/Flag.pm#L776-L781 is wrong.
If it isn't immediately clear: $setter->can_unset_flag( $self->type, $self->{_old_status} ) is at the same level
as any of the conditions, so that means being able to unset a flag is equivalent to being able to set it.
However some other part of the code prevents us from setting -, which is no consolation.
This was introduced by bug 1257662
Debugging/proof:
use Alive 'alive';
alive(
{ or => [ ( $status eq $self->{_old_status} )
, ( $status eq 'X' && $setter->id == Bugzilla->user->id )
, ( ( $status eq 'X' || $status eq '?' )
&& $setter->can_request_flag( $self->type ) )
, $setter->can_unset_flag( $self->type, $self->{_old_status} )
, $setter->can_set_flag( $self->type ) ], } );
Result:
or [
[0] "",
[1] "",
[2] "",
[3] 1,
[4] 0
]
| Assignee | ||
Updated•9 years ago
|
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
| Reporter | ||
Comment 11•9 years ago
|
||
(In reply to Dylan Hardison [:dylan] from comment #9)
> (In reply to Jose María Acuña from comment #8)
> > (In reply to :Gijs Kruitbosch (PTO Nov. 17-20 inclusive) from comment #7)
> > > (In reply to Jose María Acuña from comment #4)
> > > > (In reply to Frederik Braun [:freddyb] from comment #3)
> > > > > Además, José, ¿podría continuar con las pruebas de seguridad en nuestra
> > > > > versión de prueba de Bugzilla y no en la producción?
> > > > > https://bugzilla.allizom.org
> > > >
> > > > Sorry, the request:
> > > >
> > > > Forbidden: You don't have permission to access /error/noindex.html on this
> > > > server.
> > >
> > > I think Freddy meant https://landfill.bugzilla.org/ , which has several
> > > different bugzilla installs you can test with.
> >
> > Thanks Gijs!
>
> That is also not correct. BMO is quite diverged from upstream at the moment.
> the correct site is bugzilla-dev.allizom.org
I take note of that, Dylan
| Assignee | ||
Comment 12•9 years ago
|
||
Attachment #8811326 -
Flags: review?(dkl)
Comment 13•9 years ago
|
||
Comment on attachment 8811326 [details] [diff] [review]
1317965_1.patch
Review of attachment 8811326 [details] [diff] [review]:
-----------------------------------------------------------------
::: Bugzilla/Flag.pm
@@ +777,5 @@
> || ($status eq 'X' && $setter->id == Bugzilla->user->id)
> || (($status eq 'X' || $status eq '?')
> && $setter->can_request_flag($self->type))
> + || ($status eq 'X'
> + && $setter->can_unset_flag($self->type, $self->{_old_status}))
Looking at this closely, it now seems the line before this would also be a problem.
|| (($status eq 'X' || $status eq '?') && $setter->can_request_flag($self->type))
Someone with request rights but not grant rights could clear the 'set' flag which we also do not want to happen.
So the can_unset_flag should probably come before the can_request_flag check.
# Make sure the user is authorized to modify flags, see bug 180879:
# - The flag exists and is unchanged.
# - The flag setter can unset flag.
# - users in the grant_group can clear set flags (flags set to "+" or "-")
# - Users in the request_group can set/clear pending requests
# - Users in the grant_group can set/clear set flags (flags set to "+" and "-")
my $old_status = $self->{_old_status};
unless (($new_status eq $old_status)
|| ($status eq 'X' && $setter->id == Bugzilla->user->id)
|| (($old_status eq '+' || $old_status eq '-') && $setter->can set_flag($self->type))
|| (($status eq 'X' || $status eq '?') && $setter->can_request_flag($self->type))
|| $setter->can_set_flag($self->type))
{
ThrowUserError('flag_update_denied',
{ name => $self->type->name,
status => $status,
old_status => $self->{_old_status} });
}
Attachment #8811326 -
Flags: review?(dkl) → review-
| Assignee | ||
Comment 14•9 years ago
|
||
Attachment #8811326 -
Attachment is obsolete: true
Attachment #8811345 -
Flags: review?(dkl)
| Assignee | ||
Comment 15•9 years ago
|
||
Comment on attachment 8811345 [details] [diff] [review]
1317965_2.patch
nevermind, one second
Attachment #8811345 -
Attachment is obsolete: true
Attachment #8811345 -
Flags: review?(dkl)
| Assignee | ||
Comment 16•9 years ago
|
||
I think this is much easier to verify.
build a table of old_status:new_status -> permission,
where permission is a list of:
- any (anyone can do this)
- grant_group ($setter->can_set_flag($type)
- request_group ($setter->can_request_flag($type)
- is_setter ($setter->id == Bugzilla->user->id)
Attachment #8811426 -
Flags: review?(dkl)
| Assignee | ||
Comment 17•9 years ago
|
||
minor refactoring of v3 patch (+ fix first transition)
Attachment #8811426 -
Attachment is obsolete: true
Attachment #8811426 -
Flags: review?(dkl)
Attachment #8811454 -
Flags: review?(dkl)
| Assignee | ||
Comment 18•9 years ago
|
||
allow anyone that can request ? to clear ?
Attachment #8811454 -
Attachment is obsolete: true
Attachment #8811454 -
Flags: review?(dkl)
Attachment #8811458 -
Flags: review?(dkl)
| Assignee | ||
Comment 19•9 years ago
|
||
Found two cases of this for the bounty flag, https://bugzilla.mozilla.org/show_bug.cgi?id=1313916 and https://bugzilla.mozilla.org/show_bug.cgi?id=855373
Condition existed since bug 1257662 and has (probably) avoided abuse. There are a few dozen
possible-hits that dkl is currently investigating.
No evidence of this for approval or review flags (and we'd have plenty; we have a total history of all flag changes
which I will be checking next)
Comment 20•9 years ago
|
||
Comment on attachment 8811454 [details] [diff] [review]
1317965_4.patch
Review of attachment 8811454 [details] [diff] [review]:
-----------------------------------------------------------------
Very nice. Fixes on commit. r=dkl
::: Bugzilla/Flag.pm
@@ +50,4 @@
> use Bugzilla::Mailer;
> use Bugzilla::Constants;
> use Bugzilla::Field;
> +use List::MoreUtils qw(any);
remove
@@ +757,5 @@
> return $requestee;
> }
>
> +
> +
remove excess whitespace
::: Bugzilla/User.pm
@@ +1586,5 @@
> +sub can_change_flag {
> + my ($self, $flag_type, $old_status, $new_status) = @_;
> +
> + # "old_status:new_status" => [OR conditions
> + state $flag_transitions = {
need "use feature 'state';" for versions older than 5.16.x.
@@ +1591,5 @@
> + 'X:-' => ['grant_group'],
> + 'X:+' => ['grant_group'],
> + 'X:?' => ['request_group'],
> +
> + '?:X' => ['grant_group', 'is_setter'],
['request_group', 'is_setter']
Attachment #8811454 -
Flags: review+
| Assignee | ||
Comment 21•9 years ago
|
||
(In reply to David Lawrence [:dkl] from comment #20)
> Comment on attachment 8811454 [details] [diff] [review]
> 1317965_4.patch
>
> Review of attachment 8811454 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> Very nice. Fixes on commit. r=dkl
>
> ::: Bugzilla/Flag.pm
> @@ +50,4 @@
> > use Bugzilla::Mailer;
> > use Bugzilla::Constants;
> > use Bugzilla::Field;
> > +use List::MoreUtils qw(any);
>
> remove
>
> @@ +757,5 @@
> > return $requestee;
> > }
> >
> > +
> > +
>
> remove excess whitespace
>
> ::: Bugzilla/User.pm
> @@ +1586,5 @@
> > +sub can_change_flag {
> > + my ($self, $flag_type, $old_status, $new_status) = @_;
> > +
> > + # "old_status:new_status" => [OR conditions
> > + state $flag_transitions = {
>
> need "use feature 'state';" for versions older than 5.16.x.
Not needed, this is implied by the use 5.10.1 at the top
> @@ +1591,5 @@
> > + 'X:-' => ['grant_group'],
> > + 'X:+' => ['grant_group'],
> > + 'X:?' => ['request_group'],
> > +
> > + '?:X' => ['grant_group', 'is_setter'],
>
> ['request_group', 'is_setter']
I guess that was from the earlier patch.
| Assignee | ||
Updated•9 years ago
|
Summary: I can change the sec-bounty flag of any bug with a fake mail account → Flags permission checks broken by bug 1257662 allowing flag modification
| Assignee | ||
Updated•9 years ago
|
Summary: Flags permission checks broken by bug 1257662 allowing flag modification → Flags permission checks broken by bug 1257662 allowing unauthorized flag modification
| Assignee | ||
Updated•9 years ago
|
Summary: Flags permission checks broken by bug 1257662 allowing unauthorized flag modification → Flag permission checks broken by bug 1257662 allowing unauthorized flag modification
| Assignee | ||
Comment 22•9 years ago
|
||
To git@github.com:mozilla-bteam/bmo.git
648ddd3..10bf6d4 master -> master
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
| Assignee | ||
Updated•9 years ago
|
Attachment #8811458 -
Flags: review?(dkl)
Updated•9 years ago
|
Flags: sec-bounty?
| Assignee | ||
Comment 25•9 years ago
|
||
We've audited all flags changed since February and aside from the reporter testing this there
are no indications it was abused.
Someone in the bounty group should fix the invalid bounty flags on:
https://bugzilla.mozilla.org/show_bug.cgi?id=1313916 and https://bugzilla.mozilla.org/show_bug.cgi?id=855373
dveditz?
| Assignee | ||
Updated•9 years ago
|
Flags: needinfo?(dveditz)
Comment 29•9 years ago
|
||
(In reply to Dylan Hardison [:dylan] from comment #25)
> Someone in the bounty group should fix the invalid bounty flags on:
>
> https://bugzilla.mozilla.org/show_bug.cgi?id=1313916 and
> https://bugzilla.mozilla.org/show_bug.cgi?id=855373
Ah, caught the first one when this was fixed based on the reporter's activity log, missed the fake test account. Looks like Al got that one.
Flags: needinfo?(dveditz)
Comment 30•9 years ago
|
||
Minor damage, does not qualify for a bug bounty
Flags: sec-bounty? → sec-bounty-
| Reporter | ||
Comment 31•9 years ago
|
||
(In reply to Daniel Veditz [:dveditz] from comment #30)
> Minor damage, does not qualify for a bug bounty
I'm not sure about that.
If I had changed the flags of the resolved and fixed bugs, I would have manipulated the reports and statistics of the data and that is not minor damage.
Comment 32•9 years ago
|
||
(In reply to Jose María Acuña from comment #31)
> If I had changed the flags of the resolved and fixed bugs, I would have
> manipulated the reports and statistics of the data and that is not minor
> damage.
Yes, it is, because I'm the one that makes those reports and I use data generated by our accounting department, not Bugzilla, when I do so. I also hand process bounty payments when we decide to award them and we add the attachments for bounties with details. Manipulating the flags is annoying but wouldn't destroy our processes.
This is not a "moderate" or higher rated security issue and, as a result, does not qualify for a bounty per our published guidelines.
Keywords: sec-low
| Reporter | ||
Comment 33•9 years ago
|
||
No problem ;)
Regards.
Updated•1 year ago
|
Keywords: reporter-external
You need to log in
before you can comment on or make changes to this bug.
Description
•