summaryrefslogtreecommitdiffstats
path: root/projectroot
diff options
context:
space:
mode:
authorJörn Heissler <nosuchaddress@joern.heissler.de>2017-11-12 23:26:33 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2017-11-13 10:50:40 +0100
commit016824fbbe5d0ec79780c17b75cba4ae80f3af89 (patch)
tree7315ba297a31692c9f7011694302e486cfa5e213 /projectroot
parent4cb1fc6227d935ea65943e35c972f090e03c76fe (diff)
downloadptxdist-016824fbbe5d0ec79780c17b75cba4ae80f3af89.tar.gz
ptxdist-016824fbbe5d0ec79780c17b75cba4ae80f3af89.tar.xz
Fix security issue in logrotate script
A non-root user able to create logfile names with whitespace or leading dashes could trick the logrotate script into moving files to arbitrary places on the filesystem and thus gain root access to the system. Signed-off-by: Jörn Heissler <nosuchaddress@joern.heissler.de> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'projectroot')
-rw-r--r--projectroot/etc/init.d/logrotate4
1 files changed, 2 insertions, 2 deletions
diff --git a/projectroot/etc/init.d/logrotate b/projectroot/etc/init.d/logrotate
index c10c12d33..a26ed614b 100644
--- a/projectroot/etc/init.d/logrotate
+++ b/projectroot/etc/init.d/logrotate
@@ -24,10 +24,10 @@ logrotate(){
if [ -e "${filename}.${i}" ]
then
j=$(( i + 1 ))
- mv -f ${filename}.${i} ${filename}.${j}
+ mv -f -- "${filename}.${i}" "${filename}.${j}"
fi
done &&
- mv -f ${filename} ${filename}.1
+ mv -f -- "${filename}" "${filename}.1"
done
}