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
564fb684
Commit
564fb684
authored
Feb 19, 2013
by
Frédéric Buclin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 842038: (CVE-2013-0785) [SECURITY] XSS in show_bug.cgi when using an invalid page format
r=glob a=LpSolit
parent
e2c8da0d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
11 deletions
+17
-11
Template.pm
Bugzilla/Template.pm
+9
-5
show_bug.cgi
show_bug.cgi
+5
-6
user-error.html.tmpl
template/en/default/global/user-error.html.tmpl
+3
-0
No files found.
Bugzilla/Template.pm
View file @
564fb684
...
...
@@ -96,12 +96,15 @@ sub get_format {
my
$self
=
shift
;
my
(
$template
,
$format
,
$ctype
)
=
@_
;
$ctype
||
=
'html'
;
$format
||
=
''
;
$ctype
//
=
'html'
;
$format
//
=
''
;
# Security - allow letters and a hyphen only
$ctype
=~
s/[^a-zA-Z\-]//g
;
$format
=~
s/[^a-zA-Z\-]//g
;
# ctype and format can have letters and a hyphen only.
if
(
$ctype
=~
/[^a-zA-Z\-]/
||
$format
=~
/[^a-zA-Z\-]/
)
{
ThrowUserError
(
'format_not_found'
,
{
'format'
=>
$format
,
'ctype'
=>
$ctype
,
'invalid'
=>
1
});
}
trick_taint
(
$ctype
);
trick_taint
(
$format
);
...
...
@@ -127,6 +130,7 @@ sub get_format {
return
{
'template'
=>
$template
,
'format'
=>
$format
,
'extension'
=>
$ctype
,
'ctype'
=>
Bugzilla::Constants::
contenttypes
->
{
$ctype
}
};
...
...
show_bug.cgi
View file @
564fb684
...
...
@@ -22,9 +22,11 @@ my $vars = {};
my
$user
=
Bugzilla
->
login
();
my
$format
=
$template
->
get_format
(
"bug/show"
,
scalar
$cgi
->
param
(
'format'
),
scalar
$cgi
->
param
(
'ctype'
));
# Editable, 'single' HTML bugs are treated slightly specially in a few places
my
$single
=
!
$cgi
->
param
(
'format'
)
&&
(
!
$cgi
->
param
(
'ctype'
)
||
$cgi
->
param
(
'ctype'
)
eq
'html'
);
my
$single
=
!
$format
->
{
format
}
&&
$format
->
{
extension
}
eq
'html'
;
# If we don't have an ID, _AND_ we're only doing a single bug, then prompt
if
(
!
$cgi
->
param
(
'id'
)
&&
$single
)
{
...
...
@@ -34,9 +36,6 @@ if (!$cgi->param('id') && $single) {
exit
;
}
my
$format
=
$template
->
get_format
(
"bug/show"
,
scalar
$cgi
->
param
(
'format'
),
scalar
$cgi
->
param
(
'ctype'
));
my
(
@bugs
,
@illegal_bugs
);
my
%
marks
;
...
...
@@ -126,5 +125,5 @@ $vars->{'displayfields'} = \%displayfields;
print
$cgi
->
header
(
$format
->
{
'ctype'
});
$template
->
process
(
"$format->{'template'}"
,
$vars
)
$template
->
process
(
$format
->
{
'template'
}
,
$vars
)
||
ThrowTemplateError
(
$template
->
error
());
template/en/default/global/user-error.html.tmpl
View file @
564fb684
...
...
@@ -741,6 +741,9 @@
[% title = "Format Not Found" %]
The requested format <em>[% format FILTER html %]</em> does not exist with
a content type of <em>[% ctype FILTER html %]</em>.
[% IF invalid %]
Both parameters must contain letters and hyphens only.
[% END %]
[% ELSIF error == "flag_type_sortkey_invalid" %]
[% title = "Flag Type Sort Key Invalid" %]
...
...
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