Mageia Bugzilla – Attachment 744 Details for
Bug 1948
Cross-site scripting (XSS) vulnerabilities in nagios
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
upstream patch
nagios-3.2.3-CERTA-2011-AVI-414.patch (text/plain), 2.53 KB, created by
Guillaume Rousse
on 2011-08-30 10:42:43 CEST
(
hide
)
Description:
upstream patch
Filename:
MIME Type:
Creator:
Guillaume Rousse
Created:
2011-08-30 10:42:43 CEST
Size:
2.53 KB
patch
obsolete
>diff -Naur -x '*.orig' -x '*.rej' nagios-3.2.3/cgi/config.c nagios-3.2.3-CERTA-2011-AVI-414/cgi/config.c >--- nagios-3.2.3/cgi/config.c 2010-09-01 16:19:59.000000000 +0200 >+++ nagios-3.2.3-CERTA-2011-AVI-414/cgi/config.c 2011-07-28 10:23:58.671295000 +0200 >@@ -2275,7 +2275,7 @@ > if ((*to_expand)!='\0'){ > arg_count[0]=0; > >- printf("<TR CLASS='dataEven'><TD CLASS='dataEven'>To expand:</TD><TD CLASS='dataEven'>%s",command_args[0]); >+ printf("<TR CLASS='dataEven'><TD CLASS='dataEven'>To expand:</TD><TD CLASS='dataEven'>%s",escape_string(command_args[0])); > for (i=1;(i<MAX_COMMAND_ARGUMENTS)&&command_args[i];i++) > printf("!<FONT\n COLOR='%s'>%s</FONT>",hash_color(i),command_args[i]); > printf("\n</TD></TR>\n"); >diff -Naur -x '*.orig' -x '*.rej' nagios-3.2.3/cgi/statusmap.c nagios-3.2.3-CERTA-2011-AVI-414/cgi/statusmap.c >--- nagios-3.2.3/cgi/statusmap.c 2009-07-08 00:19:45.000000000 +0200 >+++ nagios-3.2.3-CERTA-2011-AVI-414/cgi/statusmap.c 2011-07-28 10:23:58.692295000 +0200 >@@ -2404,7 +2404,7 @@ > > for(temp_layer=layer_list;temp_layer!=NULL;temp_layer=temp_layer->next){ > if(get_method==TRUE) >- printf("&layer=%s",temp_layer->layer_name); >+ printf("&layer=%s",escape_string(temp_layer->layer_name)); > else > printf("<input type='hidden' name='layer' value='%s'>\n",escape_string(temp_layer->layer_name)); > } >diff -Naur -x '*.orig' -x '*.rej' nagios-3.2.3/t/618cgisecurity.t nagios-3.2.3-CERTA-2011-AVI-414/t/618cgisecurity.t >--- nagios-3.2.3/t/618cgisecurity.t 1970-01-01 01:00:00.000000000 +0100 >+++ nagios-3.2.3-CERTA-2011-AVI-414/t/618cgisecurity.t 2011-07-28 10:23:58.700293000 +0200 >@@ -0,0 +1,23 @@ >+#!/usr/bin/perl >+# >+# Check that you CGI security errors are fixed >+ >+use warnings; >+use strict; >+use Test::More; >+use FindBin qw($Bin); >+ >+chdir $Bin or die "Cannot chdir"; >+ >+my $topdir = "$Bin/.."; >+my $cgi_dir = "$topdir/cgi"; >+ >+plan 'no_plan'; >+ >+my $output = `NAGIOS_CGI_CONFIG=etc/cgi.cfg REQUEST_METHOD=GET QUERY_STRING="layer=' style=xss:expression(alert('XSS')) '" $cgi_dir/statusmap.cgi`; >+unlike( $output, qr/' style=xss:expression\(alert\('XSS'\)\) '/, "XSS injection not passed straight through" ); >+like( $output, qr/' style=xss:expression(alert('XSS')) '/, "Expected escaping of quotes" ) || diag $output; >+ >+ >+$output = `REMOTE_USER=nagiosadmin NAGIOS_CGI_CONFIG=etc/cgi.cfg REQUEST_METHOD=GET QUERY_STRING="type=command&expand=<body onload=alert(666)>" $cgi_dir/config.cgi`; >+unlike( $output, qr/<body onload=alert\(666\)>/, "XSS injection not passed through" ) || diag ($output);
diff -Naur -x '*.orig' -x '*.rej' nagios-3.2.3/cgi/config.c nagios-3.2.3-CERTA-2011-AVI-414/cgi/config.c --- nagios-3.2.3/cgi/config.c 2010-09-01 16:19:59.000000000 +0200 +++ nagios-3.2.3-CERTA-2011-AVI-414/cgi/config.c 2011-07-28 10:23:58.671295000 +0200 @@ -2275,7 +2275,7 @@ if ((*to_expand)!='\0'){ arg_count[0]=0; - printf("<TR CLASS='dataEven'><TD CLASS='dataEven'>To expand:</TD><TD CLASS='dataEven'>%s",command_args[0]); + printf("<TR CLASS='dataEven'><TD CLASS='dataEven'>To expand:</TD><TD CLASS='dataEven'>%s",escape_string(command_args[0])); for (i=1;(i<MAX_COMMAND_ARGUMENTS)&&command_args[i];i++) printf("!<FONT\n COLOR='%s'>%s</FONT>",hash_color(i),command_args[i]); printf("\n</TD></TR>\n"); diff -Naur -x '*.orig' -x '*.rej' nagios-3.2.3/cgi/statusmap.c nagios-3.2.3-CERTA-2011-AVI-414/cgi/statusmap.c --- nagios-3.2.3/cgi/statusmap.c 2009-07-08 00:19:45.000000000 +0200 +++ nagios-3.2.3-CERTA-2011-AVI-414/cgi/statusmap.c 2011-07-28 10:23:58.692295000 +0200 @@ -2404,7 +2404,7 @@ for(temp_layer=layer_list;temp_layer!=NULL;temp_layer=temp_layer->next){ if(get_method==TRUE) - printf("&layer=%s",temp_layer->layer_name); + printf("&layer=%s",escape_string(temp_layer->layer_name)); else printf("<input type='hidden' name='layer' value='%s'>\n",escape_string(temp_layer->layer_name)); } diff -Naur -x '*.orig' -x '*.rej' nagios-3.2.3/t/618cgisecurity.t nagios-3.2.3-CERTA-2011-AVI-414/t/618cgisecurity.t --- nagios-3.2.3/t/618cgisecurity.t 1970-01-01 01:00:00.000000000 +0100 +++ nagios-3.2.3-CERTA-2011-AVI-414/t/618cgisecurity.t 2011-07-28 10:23:58.700293000 +0200 @@ -0,0 +1,23 @@ +#!/usr/bin/perl +# +# Check that you CGI security errors are fixed + +use warnings; +use strict; +use Test::More; +use FindBin qw($Bin); + +chdir $Bin or die "Cannot chdir"; + +my $topdir = "$Bin/.."; +my $cgi_dir = "$topdir/cgi"; + +plan 'no_plan'; + +my $output = `NAGIOS_CGI_CONFIG=etc/cgi.cfg REQUEST_METHOD=GET QUERY_STRING="layer=' style=xss:expression(alert('XSS')) '" $cgi_dir/statusmap.cgi`; +unlike( $output, qr/' style=xss:expression\(alert\('XSS'\)\) '/, "XSS injection not passed straight through" ); +like( $output, qr/' style=xss:expression(alert('XSS')) '/, "Expected escaping of quotes" ) || diag $output; + + +$output = `REMOTE_USER=nagiosadmin NAGIOS_CGI_CONFIG=etc/cgi.cfg REQUEST_METHOD=GET QUERY_STRING="type=command&expand=<body onload=alert(666)>" $cgi_dir/config.cgi`; +unlike( $output, qr/<body onload=alert\(666\)>/, "XSS injection not passed through" ) || diag ($output);
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1948
: 744 |
1040