]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1031035: xmlrpc can be DoS'd with billion laughs attack
authorByron Jones <glob@mozilla.com>
Mon, 13 Apr 2015 06:16:06 +0000 (14:16 +0800)
committerByron Jones <glob@mozilla.com>
Mon, 13 Apr 2015 06:16:06 +0000 (14:16 +0800)
r=LpSolit,a=glob

Bugzilla/WebService/Server/XMLRPC.pm
importxml.pl

index f3d95ef3daa40bd3ab3d5036bd43058c563b9e36..03d93b597758265cb42c49a7ebec484302742dcc 100644 (file)
@@ -134,6 +134,14 @@ use Bugzilla::WebService::Constants qw(XMLRPC_CONTENT_TYPE_WHITELIST);
 use Bugzilla::WebService::Util qw(fix_credentials);
 use Scalar::Util qw(tainted);
 
+sub new {
+    my $self = shift->SUPER::new(@_);
+    # Initialise XML::Parser to not expand references to entities, to prevent DoS
+    require XML::Parser;
+    $self->{_parser}->parser(parser => XML::Parser->new( NoExpand => 1, Handlers => { Default => sub {} } ));
+    return $self;
+}
+
 sub deserialize {
     my $self = shift;
 
index 8750c63a110883c9f5e38de8d2f235200435cf1c..12831e0b9494e5787c14871eef8031509c5ef006 100755 (executable)
@@ -1275,6 +1275,9 @@ my $twig = XML::Twig->new(
     },
     start_tag_handlers => { bugzilla => \&init }
 );
+# Prevent DoS using the billion laughs attack.
+$twig->{NoExpand} = 1;
+
 $twig->parse($xml);
 my $root       = $twig->root;
 my $maintainer = $root->{'att'}->{'maintainer'};