slitaz-forge rev 719

Fix critical vulnerability floppy web tool
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Aug 23 14:59:41 2025 +0000 (3 weeks ago)
parents 78c2fc348b05
children 49e661dd45d9
files mirror/floppies/download.php ns/web/index.cgi pangolin/makegraphs
line diff
     1.1 --- a/mirror/floppies/download.php	Mon Oct 25 17:27:46 2021 +0000
     1.2 +++ b/mirror/floppies/download.php	Sat Aug 23 14:59:41 2025 +0000
     1.3 @@ -11,6 +11,19 @@
     1.4  	exit;
     1.5  }
     1.6  
     1.7 +function sanitize($name)
     1.8 +{
     1.9 +	$name = preg_replace("([^\w\s\d\-_~,;/\[\]\(\).])", '', $name);
    1.10 +	return preg_replace("([\.]{2,})", '', $name);
    1.11 +}
    1.12 +
    1.13 +foreach (array('iso','file') as $arg) {
    1.14 +	if (isset($_GET[$arg]))
    1.15 +		$_GET[$arg] = sanitize($_GET[$arg]);
    1.16 +}
    1.17 +
    1.18 +if (isset($_GET['iso']) && substr($_GET['iso'],-4) != ".iso") $_GET['iso'] = "";
    1.19 +
    1.20  function my_filesize($path)	// 2G+ file support
    1.21  {
    1.22  	return rtrim(shell_exec("stat -c %s '".$path."'"));
    1.23 @@ -34,7 +47,7 @@
    1.24  		$len += strlen(basename($_GET['iso'])) + 35;
    1.25  		download("md5sum", $len, $cmd);
    1.26  	}
    1.27 -	else {
    1.28 +	else if (substr($_GET['file'],-4) == ".img") {
    1.29  		$cmd .= "| dd bs=4k count=".($fdsz/4096)." conv=sync skip=".
    1.30  			(($_GET['file'] - 1)*($fdsz/4096))." "; 
    1.31  		download(sprintf("fdiso%02d.img",$_GET['file']), $fdsz, $cmd);
     2.1 --- a/ns/web/index.cgi	Mon Oct 25 17:27:46 2021 +0000
     2.2 +++ b/ns/web/index.cgi	Sat Aug 23 14:59:41 2025 +0000
     2.3 @@ -124,7 +124,7 @@
     2.4  		cat <<EOT
     2.5  </pre>
     2.6  
     2.7 -Your current IP address is $REMOTE_ADDR
     2.8 +Your current IP address is $ip
     2.9  EOT
    2.10  	fi
    2.11  	cat <<EOT
     3.1 --- a/pangolin/makegraphs	Mon Oct 25 17:27:46 2021 +0000
     3.2 +++ b/pangolin/makegraphs	Sat Aug 23 14:59:41 2025 +0000
     3.3 @@ -172,14 +172,20 @@
     3.4  		DEF:write=$rrdlog/disk.rrd:writesect:AVERAGE \
     3.5  		DEF:blk=$rrdlog/usagedisk.rrd:bhome:AVERAGE \
     3.6  		DEF:ino=$rrdlog/usagedisk.rrd:ihome:AVERAGE \
     3.7 +		DEF:blkr=$rrdlog/usagedisk.rrd:broot:AVERAGE \
     3.8 +		DEF:inor=$rrdlog/usagedisk.rrd:iroot:AVERAGE \
     3.9  		"CDEF:readpct=100,read,$maxdisk,/,*" \
    3.10  		"CDEF:writepct=100,write,$maxdisk,/,*" \
    3.11 -		'AREA:readpct#0000FF:sectors read from disk' \
    3.12 -		'STACK:writepct#00FF00:sectors written to disk' \
    3.13 -		'LINE1:ino#FF00FF:inodes used in /home\g' \
    3.14 +		'AREA:readpct#0000FF:sectors read' \
    3.15 +		'STACK:writepct#00FF00:sectors written' \
    3.16 +		'LINE1:ino#FF00FF:/home inos\g' \
    3.17  		'GPRINT:ino:MAX:%1.0lf%%' \
    3.18 -		'LINE1:blk#FF0000:blocks used in /home\g' \
    3.19 -		'GPRINT:blk:MAX:%1.0lf%%\j'
    3.20 +		'LINE1:blk#FF0000:/home blks\g' \
    3.21 +		'GPRINT:blk:MAX:%1.0lf%%' \
    3.22 +		'LINE1:inor#C0C0FF:/root inos\g' \
    3.23 +		'GPRINT:inor:MAX:%1.0lf%%' \
    3.24 +		'LINE1:blkr#000000:/root blks\g' \
    3.25 +		'GPRINT:blkr:MAX:%1.0lf%%\j'
    3.26  }
    3.27  
    3.28  updatediskdata() {