diff options
author | mkanat%bugzilla.org <> | 2009-09-11 16:17:34 +0000 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2009-09-11 16:17:34 +0000 |
commit | 3ea6848fd98842d88631f4d5eaf19ff80238dc3c (patch) | |
tree | c783c5c44bddb69792ff13e006cb456298d45c0f | |
parent | Bug 515814: Release Notes for Bugzilla 3.0.9 (diff) | |
download | bugzilla-3ea6848fd98842d88631f4d5eaf19ff80238dc3c.tar.gz bugzilla-3ea6848fd98842d88631f4d5eaf19ff80238dc3c.tar.bz2 bugzilla-3ea6848fd98842d88631f4d5eaf19ff80238dc3c.zip |
Bug 515191: [SECURITY] SQL Injection via Bug.create (CVE-2009-3165)
-rw-r--r--[-rwxr-xr-x] | Bugzilla/WebService/Bug.pm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm index 0313d76d5..480e5fb96 100755..100644 --- a/Bugzilla/WebService/Bug.pm +++ b/Bugzilla/WebService/Bug.pm @@ -113,6 +113,8 @@ sub create { my %field_values; foreach my $field (keys %$params) { my $field_name = FIELD_MAP->{$field} || $field; + # Prevent SQL Injection via key names. + _check_valid_field($field); $field_values{$field_name} = $params->{$field}; } @@ -172,6 +174,17 @@ sub legal_values { return { values => \@result }; } +sub _check_valid_field { + my $field = shift; + # We add qa_contact in manually because it should always be available in + # the API even if useqacontact is off. + my @valid_fields = (Bugzilla::Bug->fields, values %{ FIELD_MAP() }, + 'qa_contact'); + if (!grep($_ eq $field, @valid_fields)) { + ThrowCodeError('invalid_field_name', { field => $field }); + } +} + 1; __END__ @@ -450,6 +463,10 @@ you don't have permission to enter bugs in this product. You didn't specify a summary for the bug. +=item 108 (Invalid Field Name) + +You specified a field that doesn't exist as an argument to this function. + =item 504 (Invalid User) Either the QA Contact, Assignee, or CC lists have some invalid user @@ -461,6 +478,9 @@ in them. The error message will have more details. =over +=item Error 108 is only thrown by this function in the 3.0 branch, starting +with B<3.0.9>. + =item Before B<3.0.4>, parameters marked as B<Defaulted> were actually B<Required>, due to a bug in Bugzilla. |