View | Details | Raw Unified | Return to bug 104784
Collapse All | Expand All

(-)/usr/home/samm/src/ports/awstats/Makefile (-6 / +2 lines)
Lines 7-24 Link Here
7
7
8
PORTNAME=	awstats
8
PORTNAME=	awstats
9
PORTVERSION=	6.5
9
PORTVERSION=	6.5
10
PORTREVISION=	1
10
PORTREVISION=	2
11
PORTEPOCH=	1
11
PORTEPOCH=	1
12
CATEGORIES=	www
12
CATEGORIES=	www
13
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
13
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
14
MASTER_SITE_SUBDIR=	${PORTNAME}
14
MASTER_SITE_SUBDIR=	${PORTNAME}
15
15
16
MAINTAINER=	ports@FreeBSD.org
16
MAINTAINER=	samm@os2.kiev.ua
17
COMMENT=	Free real-time logfile analyzer to get advanced web statistics
17
COMMENT=	Free real-time logfile analyzer to get advanced web statistics
18
19
FORBIDDEN=	Command Injection Vulnerability
20
DEPRECATED=	${FORBIDDEN}
21
EXPIRATION_DATE=2006-12-01
22
18
23
RUN_DEPENDS=	${SITE_PERL}/Net/XWhois.pm:${PORTSDIR}/net/p5-Net-XWhois
19
RUN_DEPENDS=	${SITE_PERL}/Net/XWhois.pm:${PORTSDIR}/net/p5-Net-XWhois
24
20
(-)/usr/home/samm/src/ports/awstats/files/patch-awstats.pl-security (+91 lines)
Line 0 Link Here
1
--- wwwroot/cgi-bin/awstats.pl	Wed Oct 25 09:05:29 2006
2
+++ wwwroot/cgi-bin/awstats.pl	Wed Oct 25 09:02:30 2006
3
@@ -1131,7 +1131,18 @@
4
 	my $configdir=shift;
5
 	my @PossibleConfigDir=();
6
 
7
-	if ($configdir) { @PossibleConfigDir=("$configdir"); }
8
+	if ($configdir)
9
+	{
10
+		# If from CGI, overwriting of configdir is only possible if AWSTATS_ENABLE_CONFIG_DIR defined
11
+		#if ($ENV{'GATEWAY_INTERFACE'} && ! $ENV{"AWSTATS_ENABLE_CONFIG_DIR"})
12
+		#{
13
+		#	error("Sorry, to allow overwriting of configdir parameter from an AWStats CGI usage, environment variable AWSTATS_ENABLE_CONFIG_DIR must be set to 1");
14
+		#}
15
+		#else
16
+		#{
17
+			@PossibleConfigDir=("$configdir");
18
+		#}
19
+	}
20
 	else { @PossibleConfigDir=("$DIR","/etc/awstats","/usr/local/etc/awstats","/etc","/etc/opt/awstats"); }
21
 
22
 	# Open config file
23
@@ -4439,6 +4450,7 @@
24
 	my $stringtoclean=shift;
25
 	$stringtoclean =~ s/</&lt;/g;
26
 	$stringtoclean =~ s/>/&gt;/g;
27
+	$stringtoclean =~ s/|//g;
28
 	return $stringtoclean;
29
 }
30
 
31
@@ -5534,7 +5546,7 @@
32
 	    $QueryString =~ s/&/&amp;/g;
33
 	}
34
 
35
-	$QueryString = CleanFromCSSA($QueryString);
36
+	$QueryString = CleanFromCSSA(&DecodeEncodedString($QueryString));
37
 
38
     # Security test
39
 	if ($QueryString =~ /LogFile=([^&]+)/i)				{ error("Logfile parameter can't be overwritten when AWStats is used from a CGI"); }
40
@@ -5542,26 +5554,26 @@
41
 	# No update but report by default when run from a browser
42
 	$UpdateStats=($QueryString=~/update=1/i?1:0);
43
 
44
-	if ($QueryString =~ /config=([^&]+)/i)				{ $SiteConfig=&DecodeEncodedString("$1"); }
45
-	if ($QueryString =~ /diricons=([^&]+)/i)			{ $DirIcons=&DecodeEncodedString("$1"); }
46
-	if ($QueryString =~ /pluginmode=([^&]+)/i)			{ $PluginMode=&Sanitize(&DecodeEncodedString("$1"),1); }
47
-	if ($QueryString =~ /configdir=([^&]+)/i)			{ $DirConfig=&Sanitize(&DecodeEncodedString("$1")); }
48
-	# All filters
49
-	if ($QueryString =~ /hostfilter=([^&]+)/i)			{ $FilterIn{'host'}=&DecodeEncodedString("$1"); }			# Filter on host list can also be defined with hostfilter=filter
50
-	if ($QueryString =~ /hostfilterex=([^&]+)/i)		{ $FilterEx{'host'}=&DecodeEncodedString("$1"); }			#
51
-	if ($QueryString =~ /urlfilter=([^&]+)/i)			{ $FilterIn{'url'}=&DecodeEncodedString("$1"); }			# Filter on URL list can also be defined with urlfilter=filter
52
-	if ($QueryString =~ /urlfilterex=([^&]+)/i)			{ $FilterEx{'url'}=&DecodeEncodedString("$1"); }			#
53
-	if ($QueryString =~ /refererpagesfilter=([^&]+)/i)	{ $FilterIn{'refererpages'}=&DecodeEncodedString("$1"); }	# Filter on referer list can also be defined with refererpagesfilter=filter
54
-	if ($QueryString =~ /refererpagesfilterex=([^&]+)/i) { $FilterEx{'refererpages'}=&DecodeEncodedString("$1"); }	#
55
+	if ($QueryString =~ /config=([^&]+)/i)				{ $SiteConfig=&Sanitize("$1"); }
56
+	if ($QueryString =~ /diricons=([^&]+)/i)			{ $DirIcons="$1"; }
57
+	if ($QueryString =~ /pluginmode=([^&]+)/i)			{ $PluginMode=&Sanitize("$1",1); }
58
+	if ($QueryString =~ /configdir=([^&]+)/i)			{ $DirConfig=&Sanitize("$1"); }	
59
+ 	# All filters
60
+	if ($QueryString =~ /hostfilter=([^&]+)/i)			{ $FilterIn{'host'}="$1"; }			# Filter on host list can also be defined with hostfilter=filter
61
+	if ($QueryString =~ /hostfilterex=([^&]+)/i)		{ $FilterEx{'host'}="$1"; }			#
62
+	if ($QueryString =~ /urlfilter=([^&]+)/i)			{ $FilterIn{'url'}="$1"; }			# Filter on URL list can also be defined with urlfilter=filter
63
+	if ($QueryString =~ /urlfilterex=([^&]+)/i)			{ $FilterEx{'url'}="$1"; }			#
64
+	if ($QueryString =~ /refererpagesfilter=([^&]+)/i)	{ $FilterIn{'refererpages'}="$1"; }	# Filter on referer list can also be defined with refererpagesfilter=filter
65
+	if ($QueryString =~ /refererpagesfilterex=([^&]+)/i) { $FilterEx{'refererpages'}="$1"; }	#
66
 	# All output
67
-	if ($QueryString =~ /output=allhosts:([^&]+)/i)		{ $FilterIn{'host'}=&DecodeEncodedString("$1"); }			# Filter on host list can be defined with output=allhosts:filter to reduce number of lines read and showed
68
-	if ($QueryString =~ /output=lasthosts:([^&]+)/i)	{ $FilterIn{'host'}=&DecodeEncodedString("$1"); }			# Filter on host list can be defined with output=lasthosts:filter to reduce number of lines read and showed
69
-	if ($QueryString =~ /output=urldetail:([^&]+)/i)	{ $FilterIn{'url'}=&DecodeEncodedString("$1"); }			# Filter on URL list can be defined with output=urldetail:filter to reduce number of lines read and showed
70
-	if ($QueryString =~ /output=refererpages:([^&]+)/i)	{ $FilterIn{'refererpages'}=&DecodeEncodedString("$1"); }	# Filter on referer list can be defined with output=refererpages:filter to reduce number of lines read and showed
71
+	if ($QueryString =~ /output=allhosts:([^&]+)/i)		{ $FilterIn{'host'}="$1"; }			# Filter on host list can be defined with output=allhosts:filter to reduce number of lines read and showed
72
+	if ($QueryString =~ /output=lasthosts:([^&]+)/i)	{ $FilterIn{'host'}="$1"; }			# Filter on host list can be defined with output=lasthosts:filter to reduce number of lines read and showed
73
+	if ($QueryString =~ /output=urldetail:([^&]+)/i)	{ $FilterIn{'url'}="$1"; }			# Filter on URL list can be defined with output=urldetail:filter to reduce number of lines read and showed
74
+	if ($QueryString =~ /output=refererpages:([^&]+)/i)	{ $FilterIn{'refererpages'}="$1"; }	# Filter on referer list can be defined with output=refererpages:filter to reduce number of lines read and showed
75
 
76
 	# If migrate
77
 	if ($QueryString =~ /(^|-|&|&amp;)migrate=([^&]+)/i)	{
78
-		$MigrateStats=&DecodeEncodedString("$2"); 
79
+		$MigrateStats=&Sanitize("$2"); 
80
 		$MigrateStats =~ /^(.*)$PROG(\d{0,2})(\d\d)(\d\d\d\d)(.*)\.txt$/;
81
 		$SiteConfig=$5?$5:'xxx'; $SiteConfig =~ s/^\.//;		# SiteConfig is used to find config file
82
 	}
83
@@ -5625,8 +5637,6 @@
84
 if ($QueryString =~ /(^|&|&amp;)databasebreak=(\w+)/i)	{ $DatabaseBreak=$2; }
85
 if ($QueryString =~ /(^|&|&amp;)updatefor=(\d+)/i)		{ $UpdateFor=$2; }
86
 if ($QueryString =~ /(^|&|&amp;)noloadplugin=([^&]+)/i)	{ foreach (split(/,/,$2)) { $NoLoadPlugin{&Sanitize("$_",1)}=1; } }
87
-#Removed for security reasons
88
-#if ($QueryString =~ /(^|&|&amp;)loadplugin=([^&]+)/i)		{ foreach (split(/,/,$2)) { $NoLoadPlugin{&Sanitize("$_",1)}=-1; } }
89
 if ($QueryString =~ /(^|&|&amp;)limitflush=(\d+)/i)		{ $LIMITFLUSH=$2; }
90
 # Get/Define output
91
 if ($QueryString =~ /(^|&|&amp;)output(=[^&]*|)(.*)(&|&amp;)output(=[^&]*|)(&|$)/i) { error("Only 1 output option is allowed","","",1); }

Return to bug 104784