diff options
author | Jörn Heissler <nosuchaddress@joern.heissler.de> | 2017-11-12 23:26:33 +0100 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2017-11-13 10:50:40 +0100 |
commit | 016824fbbe5d0ec79780c17b75cba4ae80f3af89 (patch) | |
tree | 7315ba297a31692c9f7011694302e486cfa5e213 /projectroot | |
parent | 4cb1fc6227d935ea65943e35c972f090e03c76fe (diff) | |
download | ptxdist-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/logrotate | 4 |
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 } |