From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Mateusz Lenik <mlen@mlen.pl>
Cc: zsh-workers@zsh.org
Subject: Re: BUG: crafting SHELLOPTS and PS4 allows to run arbitrary programs in setuid binaries using system
Date: Tue, 27 Sep 2016 07:53:47 +0000 [thread overview]
Message-ID: <20160927075347.GA500@fujitsu.shahaf.local2> (raw)
In-Reply-To: <CALDAOts+rgsuZfABkgVBphvY4CLcUiMLFA4xR0bUXPNxnhcHug@mail.gmail.com>
Mateusz Lenik wrote on Tue, Sep 27, 2016 at 06:59:18 +0000:
> % gcc -xc - -otest <<< 'int main() { setuid(0); system("/bin/date"); }'
> % sudo chown root:root test
> % sudo chmod 4755 test
> % env -i SHELLOPTS=xtrace PS4='$(id)' ./test
> uid=0(root) gid=... groups=.../bin/date
> Tue Sep 27 08:49:16 CEST 2016
I can't reproduce that either either 5.0.7 or latest master, even with
«setopt promptsubst» in effect. (Does it reproduce in 'zsh -f'?)
> % zsh --version
>
> zsh 5.2 (x86_64-pc-linux-gnu)
> %
>
> The solution that bash folks implemented is to drop PS4 from env when the
> shell is ran as root.
34015 (89012cf94ca) stopped importing non-ASCII envvars. There may have
been other changes in this area but I couldn't quickly find them.
Thanks for the report,
Daniel
next prev parent reply other threads:[~2016-09-27 7:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-27 6:59 Mateusz Lenik
2016-09-27 7:53 ` Daniel Shahaf [this message]
2016-09-27 8:43 ` Mateusz Lenik
2016-09-27 9:02 ` Peter Stephenson
2016-09-27 19:26 ` Bart Schaefer
2016-09-28 10:37 ` Simon Ruderich
2016-09-28 19:04 ` Bart Schaefer
2016-09-29 13:20 ` Peter Stephenson
2016-09-27 8:56 ` Oliver Kiddle
2016-09-27 9:28 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160927075347.GA500@fujitsu.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=mlen@mlen.pl \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).