Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
7380ea9a
Commit
7380ea9a
authored
Sep 11, 2009
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 515191: [SECURITY] SQL Injection via Bug.search (CVE-2009-3125) and Bug.create (CVE-2009-3165)
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=mkanat
parent
7fda8c35
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
1 deletion
+35
-1
Object.pm
Bugzilla/Object.pm
+27
-1
Bug.pm
Bugzilla/WebService/Bug.pm
+1
-0
Constants.pm
Bugzilla/WebService/Constants.pm
+2
-0
code-error.html.tmpl
template/en/default/global/code-error.html.tmpl
+5
-0
No files found.
Bugzilla/Object.pm
View file @
7380ea9a
...
...
@@ -169,7 +169,19 @@ sub match {
next
if
$field
eq
'OFFSET'
;
if
(
$field
eq
'LIMIT'
)
{
next
unless
defined
$value
;
$postamble
=
$dbh
->
sql_limit
(
$value
,
$criteria
->
{
OFFSET
}
);
detaint_natural
(
$value
)
or
ThrowCodeError
(
'param_must_be_numeric'
,
{
param
=>
'LIMIT'
,
function
=>
"${class}::match"
});
my
$offset
;
if
(
defined
$criteria
->
{
OFFSET
})
{
$offset
=
$criteria
->
{
OFFSET
};
detaint_signed
(
$offset
)
or
ThrowCodeError
(
'param_must_be_numeric'
,
{
param
=>
'OFFSET'
,
function
=>
"${class}::match"
});
}
$postamble
=
$dbh
->
sql_limit
(
$value
,
$offset
);
next
;
}
elsif
(
$field
eq
'WHERE'
)
{
...
...
@@ -185,6 +197,8 @@ sub match {
next
;
}
$class
->
_check_field
(
$field
,
'match'
);
if
(
ref
$value
eq
'ARRAY'
)
{
# IN () is invalid SQL, and if we have an empty list
# to match against, we're just returning an empty
...
...
@@ -364,6 +378,17 @@ sub create {
return
$object
;
}
# Used to validate that a field name is in fact a valid column in the
# current table before inserting it into SQL.
sub
_check_field
{
my
(
$invocant
,
$field
,
$function
)
=
@_
;
my
$class
=
ref
(
$invocant
)
||
$invocant
;
if
(
!
Bugzilla
->
dbh
->
bz_column_info
(
$class
->
DB_TABLE
,
$field
))
{
ThrowCodeError
(
'param_invalid'
,
{
param
=>
$field
,
function
=>
"${class}::$function"
});
}
}
sub
check_required_create_fields
{
my
(
$class
,
$params
)
=
@_
;
...
...
@@ -406,6 +431,7 @@ sub insert_create_data {
my
(
@field_names
,
@values
);
while
(
my
(
$field
,
$value
)
=
each
%
$field_values
)
{
$class
->
_check_field
(
$field
,
'create'
);
push
(
@field_names
,
$field
);
push
(
@values
,
$value
);
}
...
...
Bugzilla/WebService/Bug.pm
View file @
7380ea9a
...
...
@@ -258,6 +258,7 @@ sub search {
}
$params
=
_map_fields
(
$params
);
delete
$params
->
{
WHERE
};
# Do special search types for certain fields.
if
(
my
$bug_when
=
delete
$params
->
{
delta_ts
}
)
{
...
...
Bugzilla/WebService/Constants.pm
View file @
7380ea9a
...
...
@@ -53,7 +53,9 @@ use constant WS_ERROR_CODE => {
param_required
=>
50
,
params_required
=>
50
,
object_does_not_exist
=>
51
,
param_must_be_numeric
=>
52
,
xmlrpc_invalid_value
=>
52
,
param_invalid
=>
53
,
# Bug errors usually occupy the 100-200 range.
improper_bug_id_field_value
=>
100
,
bug_id_does_not_exist
=>
101
,
...
...
template/en/default/global/code-error.html.tmpl
View file @
7380ea9a
...
...
@@ -338,6 +338,11 @@
There is no valid transition from
[%+ get_status("UNCONFIRMED") FILTER html %] to an open state.
[% ELSIF error == "param_invalid" %]
[% title = "Invalid Parameter" %]
<code>[% param FILTER html %]</code> is not a valid parameter
for the [% function FILTER html %] function.
[% ELSIF error == "param_must_be_numeric" %]
[% title = "Invalid Parameter" %]
Invalid parameter <code>[% param FILTER html %]</code> passed to
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment