Debian Bug report logs -
#766147
php5-common: session cleanup can be misused to change modification time of arbitrary files to "now" when symlink protection not enabled
Acknowledgement sent
to Fiedler Roman <Roman.Fiedler@ait.ac.at>:
New Bug report received and forwarded. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>.
(Tue, 21 Oct 2014 07:54:16 GMT) (full text, mbox, link).
Package: php5-common
Version: 5.4.4-14+deb7u14
Tags: security
/usr/lib/php5/sessionclean from [1] enables any process allowed to create
entries in /var/lib/php5 to adjust the modification time of any file by
waiting for the /etc/cron.d/php5 session cleanup job to run. This requires
/proc/sys/fs/protected_symlinks to be set to 0 (off), which is not the
default in Debian 7 Wheezy and up according to information from Debian
security team.
Even for affected systems, the impact might be small, just annoying:
* backup/IDS might be unhappy when file modification time is changed every
30min
* some spoolers might work differently since stale file could be prevented
from reaching required age for next action
* some privileged /proc or /sys entries might not handle modification time
update correctly or react in a strange way
* Sudo credentials cache might be affected (not checked)
To my judgement, the session cleanup code does _NOT_ allow to create
arbitrary files ("touch -c" is used), hence it would not be possible to use
this to create e.g. /etc/suid-debug
POC:
su -s /bin/bash nobody
cd /var/lib/php5
ln -s /etc/passwd xxx
cat > "xxx yyy"
# wait
[1]
http://http.us.debian.org/debian/pool/main/p/php5/php5-common_5.4.4-14+deb7u
14_i386.deb
Information forwarded
to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>: Bug#766147; Package php5-common.
(Tue, 21 Oct 2014 08:51:08 GMT) (full text, mbox, link).
Acknowledgement sent
to Ondřej Surý <ondrej@sury.org>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>.
(Tue, 21 Oct 2014 08:51:08 GMT) (full text, mbox, link).
To: Fiedler Roman <Roman.Fiedler@ait.ac.at>, 766147@bugs.debian.org
Subject: Re: [php-maint] Bug#766147: php5-common: session cleanup can be misused
to change modification time of arbitrary files to "now" when symlink
protection not enabled
Date: Tue, 21 Oct 2014 10:49:44 +0200
Hi,
TL;DR: "s/touch -c/touch -c -h/", right?
Cheers,
Ondrej
On Tue, Oct 21, 2014, at 09:52, Fiedler Roman wrote:
> Package: php5-common
> Version: 5.4.4-14+deb7u14
> Tags: security
>
> /usr/lib/php5/sessionclean from [1] enables any process allowed to create
> entries in /var/lib/php5 to adjust the modification time of any file by
> waiting for the /etc/cron.d/php5 session cleanup job to run. This
> requires
> /proc/sys/fs/protected_symlinks to be set to 0 (off), which is not the
> default in Debian 7 Wheezy and up according to information from Debian
> security team.
>
> Even for affected systems, the impact might be small, just annoying:
>
> * backup/IDS might be unhappy when file modification time is changed
> every
> 30min
> * some spoolers might work differently since stale file could be
> prevented
> from reaching required age for next action
> * some privileged /proc or /sys entries might not handle modification
> time
> update correctly or react in a strange way
> * Sudo credentials cache might be affected (not checked)
>
> To my judgement, the session cleanup code does _NOT_ allow to create
> arbitrary files ("touch -c" is used), hence it would not be possible to
> use
> this to create e.g. /etc/suid-debug
>
> POC:
>
> su -s /bin/bash nobody
> cd /var/lib/php5
> ln -s /etc/passwd xxx
> cat > "xxx yyy"
> # wait
>
> [1]
> http://http.us.debian.org/debian/pool/main/p/php5/php5-common_5.4.4-14+deb7u
> 14_i386.deb
>
> _______________________________________________
> pkg-php-maint mailing list
> pkg-php-maint@lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-php-maint
> Email had 1 attachment:
> + smime.p7s
> 8k (application/pkcs7-signature)
--
Ondřej Surý <ondrej@sury.org>
Knot DNS (https://www.knot-dns.cz/) – a high-performance DNS server
Information forwarded
to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>: Bug#766147; Package php5-common.
(Tue, 21 Oct 2014 09:21:17 GMT) (full text, mbox, link).
Acknowledgement sent
to Ondřej Surý <ondrej@sury.org>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>.
(Tue, 21 Oct 2014 09:21:17 GMT) (full text, mbox, link).
To: Fiedler Roman <Roman.Fiedler@ait.ac.at>, 766147@bugs.debian.org
Subject: Re: [php-maint] Bug#766147: php5-common: session cleanup can be misused
to change modification time of arbitrary files to "now" when symlink
protection not enabled
Date: Tue, 21 Oct 2014 11:09:05 +0200
On Tue, Oct 21, 2014, at 10:55, Fiedler Roman wrote:
> > Von: Ondřej Surý [mailto:ondrej@sury.org]
> >
> > Hi,
> >
> > TL;DR: "s/touch -c/touch -c -h/", right?
>
> This will fix it for arbitrary symlinks, the only remaining issues would
> be
>
> a) keeping open a file ".. xxxx", which will update the parent directory
> modification time.
Which parent directory? The session dir or the symlink targe parent
directory?
> b) keeping open a file "[otherfilename] [random]", which will prevent
> arbitrary other sessions from timing out. Since most likely malicious
> process should be "www-data", this is not of any significance.
The httpd user (www-data) has access to all session files if the
attacker know the session name.
Cheers,
--
Ondřej Surý <ondrej@sury.org>
Knot DNS (https://www.knot-dns.cz/) – a high-performance DNS server
Information forwarded
to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>: Bug#766147; Package php5-common.
(Tue, 21 Oct 2014 09:21:21 GMT) (full text, mbox, link).
Acknowledgement sent
to Fiedler Roman <Roman.Fiedler@ait.ac.at>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>.
(Tue, 21 Oct 2014 09:21:21 GMT) (full text, mbox, link).
To: Ondřej Surý <ondrej@sury.org>,
"766147@bugs.debian.org" <766147@bugs.debian.org>
Subject: AW: [php-maint] Bug#766147: php5-common: session cleanup can be
misused to change modification time of arbitrary files to "now" when symlink
protection not enabled
> Von: Ondřej Surý [mailto:ondrej@sury.org]
>
> Hi,
>
> TL;DR: "s/touch -c/touch -c -h/", right?
This will fix it for arbitrary symlinks, the only remaining issues would be
a) keeping open a file ".. xxxx", which will update the parent directory modification time.
b) keeping open a file "[otherfilename] [random]", which will prevent arbitrary other sessions from timing out. Since most likely malicious process should be "www-data", this is not of any significance.
[Removed]
Information forwarded
to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>: Bug#766147; Package php5-common.
(Tue, 21 Oct 2014 09:21:24 GMT) (full text, mbox, link).
Acknowledgement sent
to Fiedler Roman <Roman.Fiedler@ait.ac.at>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>.
(Tue, 21 Oct 2014 09:21:25 GMT) (full text, mbox, link).
To: Ondřej Surý <ondrej@sury.org>,
"766147@bugs.debian.org" <766147@bugs.debian.org>
Subject: AW: [php-maint] Bug#766147: php5-common: session cleanup can be
misused to change modification time of arbitrary files to "now" when symlink
protection not enabled
> Von: Ondřej Surý [mailto:ondrej@sury.org]
>
> On Tue, Oct 21, 2014, at 10:55, Fiedler Roman wrote:
> > > Von: Ondřej Surý [mailto:ondrej@sury.org]
> > >
> > > Hi,
> > >
> > > TL;DR: "s/touch -c/touch -c -h/", right?
> >
> > This will fix it for arbitrary symlinks, the only remaining issues would
> > be
> >
> > a) keeping open a file ".. xxxx", which will update the parent directory
> > modification time.
>
> Which parent directory? The session dir or the symlink targe parent
> directory?
The /var/lib directory: Since the the parsing of the lsof output is broken (awk uses "$9"), an open file ".. xxxx" will cause touch -c "/var/lib/php5/.." without involving any symlinks.
> > b) keeping open a file "[otherfilename] [random]", which will prevent
> > arbitrary other sessions from timing out. Since most likely malicious
> > process should be "www-data", this is not of any significance.
>
> The httpd user (www-data) has access to all session files if the
> attacker know the session name.
Yes, so no relevance with "www-data". But e.g. user "nobody" could prevent any "www-data" session from timing out when knowing the name, just a subtle annoyance.
Information forwarded
to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>: Bug#766147; Package php5-common.
(Tue, 21 Oct 2014 09:36:10 GMT) (full text, mbox, link).
Acknowledgement sent
to Ondřej Surý <ondrej@sury.org>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>.
(Tue, 21 Oct 2014 09:36:10 GMT) (full text, mbox, link).
To: Fiedler Roman <Roman.Fiedler@ait.ac.at>, 766147@bugs.debian.org
Subject: Re: [php-maint] Bug#766147: php5-common: session cleanup can be misused
to change modification time of arbitrary files to "now" when symlink
protection not enabled
Date: Tue, 21 Oct 2014 11:33:48 +0200
On Tue, Oct 21, 2014, at 11:16, Fiedler Roman wrote:
> > Von: Ondřej Surý [mailto:ondrej@sury.org]
> >
> > On Tue, Oct 21, 2014, at 10:55, Fiedler Roman wrote:
> > > > Von: Ondřej Surý [mailto:ondrej@sury.org]
> > > >
> > > > Hi,
> > > >
> > > > TL;DR: "s/touch -c/touch -c -h/", right?
> > >
> > > This will fix it for arbitrary symlinks, the only remaining issues would
> > > be
> > >
> > > a) keeping open a file ".. xxxx", which will update the parent directory
> > > modification time.
> >
> > Which parent directory? The session dir or the symlink targe parent
> > directory?
>
> The /var/lib directory: Since the the parsing of the lsof output is
> broken (awk uses "$9"), an open file ".. xxxx" will cause touch -c
> "/var/lib/php5/.." without involving any symlinks.
I see...
[ -x /usr/bin/lsof ] && /usr/bin/lsof -w -l +d "${1}" -Fn | grep -E "^n"
| cut -b 2- | xargs -i touch -c -h {}
JFTR jessie&sid has a new script that takes a different approach and
might suffer from the same bug if you manage to open a file in
/var/lib/php5/sessions/ with active php5 process.
Cheers,
--
Ondřej Surý <ondrej@sury.org>
Knot DNS (https://www.knot-dns.cz/) – a high-performance DNS server
Information forwarded
to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>: Bug#766147; Package php5-common.
(Tue, 21 Oct 2014 10:09:14 GMT) (full text, mbox, link).
Acknowledgement sent
to Ondřej Surý <ondrej@sury.org>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>.
(Tue, 21 Oct 2014 10:09:14 GMT) (full text, mbox, link).
To: Fiedler Roman <Roman.Fiedler@ait.ac.at>, 766147@bugs.debian.org
Subject: Re: [php-maint] Bug#766147: php5-common: session cleanup can be misused
to change modification time of arbitrary files to "now" when symlink
protection not enabled
Date: Tue, 21 Oct 2014 12:06:33 +0200
Control: tags -1 +pending
On Tue, Oct 21, 2014, at 11:33, Ondřej Surý wrote:
> On Tue, Oct 21, 2014, at 11:16, Fiedler Roman wrote:
> > > Von: Ondřej Surý [mailto:ondrej@sury.org]
> > >
> > > On Tue, Oct 21, 2014, at 10:55, Fiedler Roman wrote:
> > > > > Von: Ondřej Surý [mailto:ondrej@sury.org]
> > > > >
> > > > > Hi,
> > > > >
> > > > > TL;DR: "s/touch -c/touch -c -h/", right?
> > > >
> > > > This will fix it for arbitrary symlinks, the only remaining issues would
> > > > be
> > > >
> > > > a) keeping open a file ".. xxxx", which will update the parent directory
> > > > modification time.
> > >
> > > Which parent directory? The session dir or the symlink targe parent
> > > directory?
> >
> > The /var/lib directory: Since the the parsing of the lsof output is
> > broken (awk uses "$9"), an open file ".. xxxx" will cause touch -c
> > "/var/lib/php5/.." without involving any symlinks.
>
> I see...
Thanks for the analysis, while the impact is very low, it's worth
updating.
> [ -x /usr/bin/lsof ] && /usr/bin/lsof -w -l +d "${1}" -Fn | grep -E "^n"
> | cut -b 2- | xargs -i touch -c -h {}
This change will be included in next wheezy update of PHP.
> JFTR jessie&sid has a new script that takes a different approach and
> might suffer from the same bug if you manage to open a file in
> /var/lib/php5/sessions/ with active php5 process.
If you find a similar vulnerability in the new session script, please
open a new bug.
Cheers,
--
Ondřej Surý <ondrej@sury.org>
Knot DNS (https://www.knot-dns.cz/) – a high-performance DNS server
Added tag(s) pending.
Request was from Ondřej Surý <ondrej@sury.org>
to 766147-submit@bugs.debian.org.
(Tue, 21 Oct 2014 10:09:14 GMT) (full text, mbox, link).
Information forwarded
to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>: Bug#766147; Package php5-common.
(Wed, 22 Oct 2014 13:18:10 GMT) (full text, mbox, link).
Acknowledgement sent
to Fiedler Roman <Roman.Fiedler@ait.ac.at>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>.
(Wed, 22 Oct 2014 13:18:10 GMT) (full text, mbox, link).
To: Ondřej Surý <ondrej@sury.org>,
"766147@bugs.debian.org" <766147@bugs.debian.org>
Subject: Re: [php-maint] Bug#766147: php5-common: session cleanup can be
misused to change modification time of arbitrary files to "now" when symlink
protection not enabled
> Von: Ondřej Surý [mailto:ondrej@sury.org]
>
> Control: tags -1 +pending
>
> On Tue, Oct 21, 2014, at 11:33, Ondřej Surý wrote:
> > On Tue, Oct 21, 2014, at 11:16, Fiedler Roman wrote:
> > > > Von: Ondřej Surý [mailto:ondrej@sury.org]
> > > >
> > > > On Tue, Oct 21, 2014, at 10:55, Fiedler Roman wrote:
> > > > > > Von: Ondřej Surý [mailto:ondrej@sury.org]
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > TL;DR: "s/touch -c/touch -c -h/", right?
> > > > >
> > > > > This will fix it for arbitrary symlinks, the only remaining issues would
> > > > > be
> > > > >
> > > > > a) keeping open a file ".. xxxx", which will update the parent directory
> > > > > modification time.
> > > >
> > > > Which parent directory? The session dir or the symlink targe parent
> > > > directory?
> > >
> > > The /var/lib directory: Since the the parsing of the lsof output is
> > > broken (awk uses "$9"), an open file ".. xxxx" will cause touch -c
> > > "/var/lib/php5/.." without involving any symlinks.
> >
> > I see...
>
> Thanks for the analysis, while the impact is very low, it's worth
> updating.
>
> > [ -x /usr/bin/lsof ] && /usr/bin/lsof -w -l +d "${1}" -Fn | grep -E "^n"
> > | cut -b 2- | xargs -i touch -c -h {}
>
> This change will be included in next wheezy update of PHP.
No, this seems not to solve it (I hope I haven't screwed something up while testing), consider the sequence (PID ordering is important!):
mkdir -p $'/var/lib/php5/xxx\n/var/lib'
ln -s /etc $'/var/lib/php5/xxx\n/var/lib/php5'
sleep 1000 > '/var/lib/php5/xxx\' &
sleep 1000 > /var/lib/php5/passwd &
Even touch -h does not help here, only kernel symlink protection prevents damage.
But maybe this is a problem with xargs usage? If it is an xargs-bug this would have a much broader scope, more another topic for security@d.
> > JFTR jessie&sid has a new script that takes a different approach and
> > might suffer from the same bug if you manage to open a file in
> > /var/lib/php5/sessions/ with active php5 process.
>
> If you find a similar vulnerability in the new session script, please
> open a new bug.
Looking at the new script, I guess that it should be possible for any user allowed to write to sessions to update any file he has read access to it. But of course, it is not so simple as with old script.
To proof this, I would have to prepare a machine with sid (unless you have one ready with remote SSH for testing)
Information forwarded
to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>: Bug#766147; Package php5-common.
(Wed, 22 Oct 2014 14:36:15 GMT) (full text, mbox, link).
Acknowledgement sent
to Ondřej Surý <ondrej@sury.org>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>.
(Wed, 22 Oct 2014 14:36:15 GMT) (full text, mbox, link).
To: Fiedler Roman <Roman.Fiedler@ait.ac.at>, 766147@bugs.debian.org
Subject: Re: [php-maint] Bug#766147: php5-common: session cleanup can be misused
to change modification time of arbitrary files to "now" when symlink
protection not enabled
Date: Wed, 22 Oct 2014 16:33:41 +0200
This should then fix even your case...
[ -x /usr/bin/lsof ] && /usr/bin/lsof -w -l +d "/var/lib/php5" -F0 | sed
-zne "s/^n//p" | xargs -0i echo touch -c -h "'{}'"
touch -c -h '/var/lib/php5/xxx\'
touch -c -h 'n/var/lib/php5/passwd'
Right?
Cheers,
Ondrej
On Wed, Oct 22, 2014, at 15:14, Fiedler Roman wrote:
> > Von: Ondřej Surý [mailto:ondrej@sury.org]
> >
> > Control: tags -1 +pending
> >
> > On Tue, Oct 21, 2014, at 11:33, Ondřej Surý wrote:
> > > On Tue, Oct 21, 2014, at 11:16, Fiedler Roman wrote:
> > > > > Von: Ondřej Surý [mailto:ondrej@sury.org]
> > > > >
> > > > > On Tue, Oct 21, 2014, at 10:55, Fiedler Roman wrote:
> > > > > > > Von: Ondřej Surý [mailto:ondrej@sury.org]
> > > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > TL;DR: "s/touch -c/touch -c -h/", right?
> > > > > >
> > > > > > This will fix it for arbitrary symlinks, the only remaining issues would
> > > > > > be
> > > > > >
> > > > > > a) keeping open a file ".. xxxx", which will update the parent directory
> > > > > > modification time.
> > > > >
> > > > > Which parent directory? The session dir or the symlink targe parent
> > > > > directory?
> > > >
> > > > The /var/lib directory: Since the the parsing of the lsof output is
> > > > broken (awk uses "$9"), an open file ".. xxxx" will cause touch -c
> > > > "/var/lib/php5/.." without involving any symlinks.
> > >
> > > I see...
> >
> > Thanks for the analysis, while the impact is very low, it's worth
> > updating.
> >
> > > [ -x /usr/bin/lsof ] && /usr/bin/lsof -w -l +d "${1}" -Fn | grep -E "^n"
> > > | cut -b 2- | xargs -i touch -c -h {}
> >
> > This change will be included in next wheezy update of PHP.
>
> No, this seems not to solve it (I hope I haven't screwed something up
> while testing), consider the sequence (PID ordering is important!):
>
> mkdir -p $'/var/lib/php5/xxx\n/var/lib'
> ln -s /etc $'/var/lib/php5/xxx\n/var/lib/php5'
> sleep 1000 > '/var/lib/php5/xxx\' &
> sleep 1000 > /var/lib/php5/passwd &
>
> Even touch -h does not help here, only kernel symlink protection prevents
> damage.
>
> But maybe this is a problem with xargs usage? If it is an xargs-bug this
> would have a much broader scope, more another topic for security@d.
>
> > > JFTR jessie&sid has a new script that takes a different approach and
> > > might suffer from the same bug if you manage to open a file in
> > > /var/lib/php5/sessions/ with active php5 process.
> >
> > If you find a similar vulnerability in the new session script, please
> > open a new bug.
>
> Looking at the new script, I guess that it should be possible for any
> user allowed to write to sessions to update any file he has read access
> to it. But of course, it is not so simple as with old script.
>
> To proof this, I would have to prepare a machine with sid (unless you
> have one ready with remote SSH for testing)
> Email had 1 attachment:
> + smime.p7s
> 8k (application/pkcs7-signature)
--
Ondřej Surý <ondrej@sury.org>
Knot DNS (https://www.knot-dns.cz/) – a high-performance DNS server
Information forwarded
to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>: Bug#766147; Package php5-common.
(Wed, 22 Oct 2014 14:36:23 GMT) (full text, mbox, link).
Acknowledgement sent
to Ondřej Surý <ondrej@sury.org>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>.
(Wed, 22 Oct 2014 14:36:23 GMT) (full text, mbox, link).
To: Fiedler Roman <Roman.Fiedler@ait.ac.at>, 766147@bugs.debian.org
Subject: Re: [php-maint] Bug#766147: php5-common: session cleanup can be misused
to change modification time of arbitrary files to "now" when symlink
protection not enabled
Date: Wed, 22 Oct 2014 16:35:54 +0200
On Wed, Oct 22, 2014, at 15:14, Fiedler Roman wrote:
> To proof this, I would have to prepare a machine with sid (unless you
> have one ready with remote SSH for testing)
You don't really need a sid machine, just copy the script from the
package.
Cheers,
--
Ondřej Surý <ondrej@sury.org>
Knot DNS (https://www.knot-dns.cz/) – a high-performance DNS server
Information forwarded
to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>: Bug#766147; Package php5-common.
(Wed, 22 Oct 2014 16:09:10 GMT) (full text, mbox, link).
Acknowledgement sent
to Fiedler Roman <Roman.Fiedler@ait.ac.at>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>.
(Wed, 22 Oct 2014 16:09:10 GMT) (full text, mbox, link).
To: Ondřej Surý <ondrej@sury.org>,
"766147@bugs.debian.org" <766147@bugs.debian.org>
Subject: Re: [php-maint] Bug#766147: php5-common: session cleanup can be
misused to change modification time of arbitrary files to "now" when symlink
protection not enabled
> Von: Ondřej Surý [mailto:ondrej@sury.org]
>
> This should then fix even your case...
>
> [ -x /usr/bin/lsof ] && /usr/bin/lsof -w -l +d "/var/lib/php5" -F0 | sed
> -zne "s/^n//p" | xargs -0i echo touch -c -h "'{}'"
>
> touch -c -h '/var/lib/php5/xxx\'
> touch -c -h 'n/var/lib/php5/passwd'
Looks really good, I'm at my wits end with any more comments/improvements.
Only things I could think of
* strange behaviour with multibyte encodings (never dealt with that on C level)
* lsof peculiarities I did not notice till now (e.g. races)
[Snip]
Marked as found in versions php5/5.4.35-0deb7u2.
Request was from Ondřej Surý <ondrej@debian.org>
to control@bugs.debian.org.
(Wed, 19 Nov 2014 08:45:29 GMT) (full text, mbox, link).
Marked as fixed in versions php5/5.4.35-0deb7u1.
Request was from Ondřej Surý <ondrej@debian.org>
to control@bugs.debian.org.
(Wed, 19 Nov 2014 08:45:30 GMT) (full text, mbox, link).
Information forwarded
to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>: Bug#766147; Package php5-common.
(Wed, 19 Nov 2014 09:36:13 GMT) (full text, mbox, link).
Acknowledgement sent
to Bernard Massot <bmassot@free.fr>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>.
(Wed, 19 Nov 2014 09:36:13 GMT) (full text, mbox, link).
Subject: Re: [php-maint] Bug#766147: php5-common: session cleanup can be
misused to change modification time of arbitrary files to "now" when symlink
protection not enabled
Date: Wed, 19 Nov 2014 10:33:21 +0100
Le 21/10/2014 à 12:06, Ondřej Surý a écrit :
> This change will be included in next wheezy update of PHP.
Debian Wheezy has Sed 4.2.1, whereas "-z" option was added in Sed 4.2.2.
As a consequence /usr/lib/php5/sessionclean is broken on Debian Stable!
Please fix.
--
Bernard Massot
Marked as fixed in versions 5.4.35-0deb7u2.
Request was from Yves-Alexis Perez <corsac@debian.org>
to control@bugs.debian.org.
(Wed, 19 Nov 2014 10:48:52 GMT) (full text, mbox, link).
Marked as found in versions php5/5.4.35-0+deb7u1.
Request was from Yves-Alexis Perez <corsac@debian.org>
to control@bugs.debian.org.
(Wed, 19 Nov 2014 10:48:53 GMT) (full text, mbox, link).
Disconnected #766147 from all other report(s).
Request was from Yves-Alexis Perez <corsac@debian.org>
to control@bugs.debian.org.
(Wed, 19 Nov 2014 10:54:04 GMT) (full text, mbox, link).
No longer marked as fixed in versions php5/5.4.35-0deb7u1.
Request was from Yves-Alexis Perez <corsac@debian.org>
to control@bugs.debian.org.
(Wed, 19 Nov 2014 11:03:10 GMT) (full text, mbox, link).
Information forwarded
to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>: Bug#766147; Package php5-common.
(Wed, 19 Nov 2014 11:12:05 GMT) (full text, mbox, link).
Acknowledgement sent
to Ondřej Surý <ondrej@sury.org>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>.
(Wed, 19 Nov 2014 11:12:05 GMT) (full text, mbox, link).
Subject: Fwd: Re: Fixed php5 package for CVE-2014-3710
Date: Wed, 19 Nov 2014 12:08:48 +0100
Hi,
this is suggestion from Stefan Fritsch how to improve the security of
the script even without "sed -z".
Cheers,
--
Ondřej Surý <ondrej@sury.org>
Knot DNS (https://www.knot-dns.cz/) – a high-performance DNS server
----- Original message -----
From: Stefan Fritsch <sf@sfritsch.de>
To: Ondřej Surý <ondrej@sury.org>
Cc: Debian Security Team <team@security.debian.org>
Subject: Re: Fixed php5 package for CVE-2014-3710
Date: Wed, 19 Nov 2014 12:00:55 +0100 (CET)
On Wed, 19 Nov 2014, Ondřej Surý wrote:
> -[ -x /usr/bin/lsof ] && /usr/bin/lsof -w -l +d "${1}" -F0 | sed -zne
> "s/^n//p" | xargs -0i echo touch -c -h "'{}'"
> +[ -x /usr/bin/lsof ] && /usr/bin/lsof -w -l +d "${1}" | awk -- '{ if
> (NR > 1) { print $9; } }' | xargs -i touch -c {}
What is the echo in there for? That seems wrong. Also escaping arguments
with ' ' is insecure, filenames may contain single quotes, too. Much
better to let xargs do the splitting of the args.
You can use perl to replace the sed -z, though:
[ -x /usr/bin/lsof ] && /usr/bin/lsof -w -l +d "${1}" -F0 | perl -0 -n
-e 's/^n// and print'|xargs -0 -r touch -c -h
xargs -r: If the standard input does not contain any nonblanks, do
not
run the command.
xargs -i is not neessary because the args are at the end of the command.
Cheers,
Stefan
Reply sent
to Ondřej Surý <ondrej@debian.org>:
You have taken responsibility.
(Thu, 01 Jan 2015 18:51:05 GMT) (full text, mbox, link).
Notification sent
to Fiedler Roman <Roman.Fiedler@ait.ac.at>:
Bug acknowledged by developer.
(Thu, 01 Jan 2015 18:51:05 GMT) (full text, mbox, link).
Debbugs is free software and licensed under the terms of the GNU General
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.