# SSL certificate not validated when registering with a provider

Nextcloud desktop client's embedded registration webview failed to validate TLS certs for nextcloud.com, letting a network MITM serve fake HTML/JS in a trusted app window.

- Payout: $300
- Severity: medium
- Program: Nextcloud
- Found by: netranger
- Disclosed: 2021-06-02
- CVE: CVE-2021-22895
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/903424
- Library page: https://bugbountylibrary.com/r/h1%3A903424
- Tags: area:os domain:desktop impact:ato impact:data-leak kind:bounty platform:hackerone sev:medium tech:linux tech:windows technique:recon vuln:crypto vuln:misconfiguration

**Target:** Nextcloud desktop client embedded webview (Register with a provider flow)
**Root cause:** The embedded browser/webview used for the registration page did not enforce TLS certificate validation, so self-signed or attacker-supplied certs were accepted.
**Steps:**
1. Set client to proxy through Burp; click `Register with a provider`; observe no cert warning on Burp's self-signed cert.
2. Run `sudo python3 nc_desktop_mitm.py -k nc_key.pem -c nc_cert.pem` binding port 443 with attacker cert.
3. Add hosts entry mapping `nextcloud.com` to attacker machine IP.
4. Open Nextcloud desktop client and click `Register with a provider`.
5. Observe attacker-controlled PoC page rendered inside the client window.
**How found:** Researcher proxied the client through Burp and noticed the registration webview did not alert on Burp's self-signed cert, indicating missing TLS validation; confirmed with a custom MITM server plus hosts-file override.
**Exploitation:** Attacker positioned on-path (ARP poisoning, DNS spoofing, rogue router) serves a forged cert for nextcloud.com; the client accepts it and renders attacker HTML/JS in the trusted app window, enabling a fake login/registration page to phish credentials or harvest the user's email POSTed during registration.
**Insight:** Embedded webviews in desktop apps often skip cert validation even when the OS/browser would not; test registration/login webviews by proxying through Burp and watching for missing cert warnings, then confirm with a hosts-file override to a local TLS server.

