Windows builds with insecure path defaults (CVE-2019-1552)
OpenSSL's mingw build defaults placed its configuration directory under a world-writable path on Windows, allowing a low-privileged user to plant a configuration file and engine library. When a privileged application loaded OpenSSL, that library would run with the application's authority, potentially SYSTEM.
- Triaged in 39 hours
- Fixed in 28 days
- Paid in 28 days
- Disclosed after 28 days
Advisory: https://www.openssl.org/news/secadv/20190730.txt
Severity: Low
OpenSSL has internal defaults for a directory tree where it can find a
configuration file as well as certificates used for verification in
TLS. This directory is most commonly referred to as OPENSSLDIR, and
is configurable with the --prefix / --openssldir configuration options.
For OpenSSL versions 1.1.0 and 1.1.1, the mingw configuration targets
assume that resulting programs and libraries are installed in a
Unix-like environment and the default prefix for program installation
as well as for OPENSSLDIR should be '/usr/local'.
However, mingw programs are Windows programs, and as such, find
themselves looking at sub-directories of 'C:/usr/local', which may be
world writable, which enables untrusted users to modify OpenSSL's
default configuration, insert CA certificates, modify (or even
replace) existing engine modules, etc.
For OpenSSL 1.0.2, '/usr/local/ssl' is used as default for OPENSSLDIR
on all Unix and Windows targets, including Visual C builds. However,
some build instructions for the diverse Windows targets on 1.0.2
encourage you to specify your own --prefix.
OpenSSL versions 1.1.1, 1.1.0 and 1.0.2 are affected by this issue.
Due to the limited scope of affected deployments this has been
assessed as low severity and therefore we are not creating new
releases at this time.
The mitigations are found in these commits:
- For 1.1.1, commit 54aa9d51b09d67e90db443f682cface795f5af9e
- For 1.1.0, commit e32bc855a81a2d48d215c506bdeb4f598045f7e9 and
b15a19c148384e73338aa7c5b12652138e35ed28
- For 1.0.2, commit d333ebaf9c77332754a9d5e111e2f53e1de54fdd
The 1.1.1 and 1.1.0 mitigation set more appropriate defaults for
mingw, while the 1.0.2 mitigation documents the issue and provides
enhanced examples.
This issue was reported by Rich Mirch. The fix was developed by
Richard Levitte from the OpenSSL development team. It was reported to
OpenSSL on 9th Jun 2019.
Summary:
I have confirmed this vulnerability in over a dozen Windows applications. A few public links have been included below. While the OpenSSL project rated this a low, most projects/vendors that I have worked with have rated it a high due to the ability to inject arbitrary code into the calling process from a low privileged user.
Supporting Material/References:
- curl/libcurl - Windows OpenSSL engine code injection https://curl.haxx.se/docs/CVE-2019-5443.html
- CVE-2019-12572 PIA Windows Privilege Escalation: Malicious OpenSSL Engine https://blog.mirch.io/2019/06/10/cve-2019-12572-pia-windows-privilege-escalation-malicious-openssl-engine/
- Stunnel Windows local privilege escalation vulnerability https://www.stunnel.org/pipermail/stunnel-users/2019-June/006417.html
- CVE-2019-10211: EnterpriseDB Windows installer bundled OpenSSL executes code from unprotected directory https://www.postgresql.org/about/news/1960/
Impact
This can result in the elevation of privileges for the vulnerable application. Low privileged accounts on Windows allow authenticated low privileged users the ability to create directories under the top level root directory c:\. A malicious user could create this path and add a custom openssl.cnf file to load a OpenSSL engine library. When this library is loaded, arbitrary code would be executed with the full authority of the calling process. In some cases this is a service running with SYSTEM privileges - the highest authority on Windows systems.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the mingw build configuration assumed a Unix-like install prefix, so OpenSSL looked for its configuration and engines under a Windows path that low-privileged users could create and write to.
Impact
A low-privileged local user could execute arbitrary code with the full authority of any process that loaded the affected OpenSSL build, which in some cases was a service running as SYSTEM.
What the attacker needed
Local low-privileged Windows account; affected OpenSSL build used by a privileged process; attacker can create the default path
The fix
The issue was fixed by changing the default install and configuration paths for mingw builds and by documenting safer build examples for older versions.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
OpenSSL is a library many programs use for secure connections. On Windows, some builds looked for their settings in a folder that ordinary users can write to. A normal user could put a fake settings file and a malicious library there, and when an administrator's program started, it would load that library and run the attacker's code with high privileges.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.