# Arbitrary code execution in desktop client via OpenSSL config

Nextcloud Windows client's bundled libeay32.dll loads c:\usr\local\ssl\openssl.cnf, which low-priv users can create to load a malicious DLL and execute code as any launching user.

- Payout: $100
- Severity: medium
- Program: Nextcloud
- Found by: l00ph0le
- Disclosed: 2020-08-05
- CVE: CVE-2020-8224
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/622170
- Library page: https://bugbountylibrary.com/r/h1%3A622170
- Tags: area:os domain:desktop impact:privesc impact:rce kind:bounty platform:hackerone sev:medium tech:windows technique:chained technique:recon vuln:privilege-escalation

**Target:** Nextcloud Desktop Client 2.5.2 on Windows (libeay32.dll OpenSSL config loading)
**Root cause:** OpenSSL was compiled without --openssldir, defaulting to /usr/local/ssl which maps to c:\usr\local\ssl on Windows; that path is user-writable and the client loads openssl.cnf from it, enabling DLL hijack.
**Steps:**
1. Install Nextcloud Desktop 2.5.2 on Windows.
2. As low-priv user: `mkdir c:\usr\local\ssl`.
3. Place malicious DLL and openssl.cnf (referencing the DLL) into that dir, rename config to `openssl.cnf`.
4. Log out; admin logs in and launches Nextcloud.
5. Malicious DLL executes in admin context (calc.exe or UAC-bypass backdoor adding local admin).
**How found:** Hunter searched for programs bundling Windows OpenSSL (libeay32.dll), then used Sysinternals Process Monitor to observe nextcloud.exe attempting to read c:\usr\local\ssl\openssl.cnf and getting PATH NOT FOUND.
**Exploitation:** Low-priv user pre-plants c:\usr\local\ssl\openssl.cnf pointing to a malicious DLL; when any user (including admin) launches Nextcloud, libeay32.dll reads the config and loads the attacker DLL, yielding code execution and privilege escalation via UAC bypass.
**Escalation:** Chained with UAC bypass to create a local administrator account (backdoor/backdoor) from a standard user.
**Insight:** Procmon for PATH NOT FOUND on config/DLL loads in user-writable roots (c:\usr\local\ssl) reveals OpenSSL default-openssldir hijacks; grep binaries for libeay32/ssleay32 and check compile flags.

## Proof of concept (copied exactly from the original report)

**Commands to plant malicious openssl.cnf and DLL**

```
2.	Open a cmd.exe and issue command: mkdir c:\usr\local\ssl
3.	Copy calc.dll and openssl-calc.cnf to c:\usr\local\ssl directory
4.	Rename c:\usr\local\ssl\openssl-calc.cnf to c:\usr\local\ssl\openssl.cnf
```

