Subject: Re: Privilege escalation to group "ssh" in ssh-agent via openssl library
From: "Theo de Raadt" <deraadt -at- ...
To: halfdog <me -at- ...
Date: Mon, 18 Dec 2017 22:01:10 -0700

Thought I would show you these commit messages over a year or so.

date: 2014/06/20 21:00:46;  author: deraadt;  state: Exp;  lines: +1 -6;  commitid: cPW6Vx
reIaECmYIA;
Remove the OPENSSL_*cap getenv's.  A program should not be able to
change the behaviour of the library in such a complicated fashion.
ok miod

date: 2014/07/12 17:35:23;  author: deraadt;  state: Exp;  lines: +3 -1;  commitid: 1AG6gn
utKEqeuP9z;
jsing and I are investigating removal of all? most? 'getenv from library'
instances.  This one for OPENSSL_ALLOW_PROXY_CERTS gets turned off first,
especially since it had this special comment:
/* A hack to keep people who don't want to modify their software happy */
ok beck jsing

revision 1.29
date: 2014/06/20 20:59:49;  author: deraadt;  state: Exp;  lines: +2 -2;  commitid: sNbZj1qTcgrykfGE;
wrap getenv OPENSSL_ALLOW_PROXY_CERTS in an issetugid check, to protect
setuid applications from being fooled.
ok miod

date: 2015/04/11 16:03:21;  author: deraadt;  state: Exp;  lines: +3 -15;  commitid: WnYuC
1gPCzN02uAn;
Remove all getenv() calls, especially those wrapped by issetugid().
getenv()'s wrapped by issetugid() are safe, but issetugid() is correct
difficult to impliment on many operating systems.  By accident, a grand
experiment was run over the last year, where issetugid() returned 1 (the
safe value) on a few operating systems.  Noone noticed & complained that
certain environment variables were not working.......
ok doug beck jsing, discussion with others
----------------------------

revision 1.34
date: 2015/04/11 16:16:15;  author: deraadt;  state: Exp;  lines: +1 -3;  commitid: lnb130
mvt8k6weCi;
Send OPENSSL_issetugid() straight to hell, no final cigarette.

The issetugid() API is supposed to make a strong promise where "0
means it is safe to look at the environment".  Way back in the past
someone on the OpenSSL team responded to the environment access danger
by creating a wrapper called OPENSSL_issetugid, and went to use it a
number of places.  However, by default on systems lacking true
issetugid(), OPENSSL_issetugid returns 0.  0 indicating safely.  False
safety.  Which means OPENSSL_issetugid() fails to make any sort of
promise about safety, in fact it is just the opposite.

Can you believe the OpenSSL team?

This nastiness was noticed over the years, however noone could gain traction
and get it fixed in OpenSSL.  Also see a paragraph about this in
http://www.tedunangst.com/flak/post/worst-common-denominator-programming

ok jsing