The vulnerability relates to DYLD_PRINT_TO_FILE, an environment variable that enables error logging to arbitrary files. The feature first came out with the dynamic linker “dyld” in the release of OS X 10.10.
“When this variable was added the usual safeguards that are required when adding support for new environment variables to the dynamic linker have not been used,” German researcher Stefan Esser, founder of security audit company SektionEins, who found the issue, said in a blog post. “Therefore it is possible to use this new feature even with SUID root binaries. This is dangerous, because it allows to open or create arbitrary files owned by the root user anywhere in the file system.”
“Furthermore the opened log file is never closed and therefore its file descriptor is leaked into processes spawned by SUID binaries,” he said. “This means child processes of SUID root processes can write to arbitrary files owned by the root user anywhere in the filesystem. This allows for easy privilege escalation in OS X 10.10.x,” Esser said.
Esser published technical details on the vulnerability and released a proof-of-concept (PoC) exploit that provides a local root shell.
It does look as though this vulnerability ended up reported to Apple months ago by the South Korean researcher known as “beist.”
However, Apple only fixed the flaw in the beta versions of OS X El Capitan 10.11, and not in the current OS X 10.10.4 or the beta version of OS X 10.10.5. OS X 10.11 is should release in late September or early October.
“Apple has fixed this vulnerability in the OS X 10.11 beta by moving the code for the DYLD_PRINT_TO_FILE (and another new environment variable) to the processDyldEnvironmentVariable() function, which automatically protects them,” Esser said. “This might however be the result of a code cleanup and not based on realizing the security implications.”