Summary
Sunshine's mutual TLS (mTLS) client-certificate authentication incorrectly treats certain certificate verification errors as success, allowing untrusted or invalid client certificates to be accepted.
Under these conditions, an attacker presenting a locally untrusted, not-yet-valid, or expired certificate may bypass client authentication and gain access to protected HTTPS endpoints.
Affected context
This vulnerability affects Sunshine deployments configured to use client-certificate (mTLS) authentication to protect HTTPS endpoints.
The issue is present where the application relies on OpenSSL's verification callbacks but overrides the default behavior with a custom verify function.
Specifically, environments where the trust store is incomplete, out of date, or where clients may legitimately present not-yet-valid or borderline certificates are more exposed, because the callback treats key verification failures as success.
Exploit preconditions
- Attack surface: Sunshine HTTPS endpoints protected by client-certificate authentication (mTLS).
- Required access: Network-level ability to connect to the Sunshine service (e.g., same LAN, VPN, or exposed endpoint).
- Trigger point: Presentation of a TLS client certificate during the handshake that triggers errors such as:
- X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
- X509_V_ERR_CERT_NOT_YET_VALID
- X509_V_ERR_CERT_HAS_EXPIRED
- Why exploitation is possible: The custom OpenSSL verification callback in
src/crypto.cppinterprets these error codes as success and returns a positive verification result, causing the TLS layer and application to treat the client as authenticated even when the certificate is untrusted or invalid.
Why this happens
The underlying bug is a logic flaw in the authentication flow, specifically in how certificate verification results from OpenSSL are interpreted.
Instead of failing the connection when certain verification errors occur, the custom callback explicitly treats error codes such as "unable to get issuer certificate locally," "certificate not yet valid," and "certificate has expired" as success conditions.
This maps to CWE-287: Improper Authentication, because the system incorrectly concludes that a client has been authenticated, and to CWE-295: Improper Certificate Validation, because the certificate chain and validity window are not properly enforced.
At an abstract level, the pattern is: security decisions (granting authenticated access) are made while ignoring or downgrading critical verification errors in cryptographic credential validation.
Potential impact
- Unauthenticated clients can be treated as authenticated and access mTLS-protected HTTPS endpoints.
- Attackers may connect to and control game streaming sessions without possessing a properly trusted client certificate.
- Sensitive configuration, control APIs, or user-specific data exposed via HTTPS endpoints can be accessed by unauthorized parties.
- Attackers may leverage unauthorized control to pivot within the local network environment (for example, exploiting trust in the Sunshine host).
General mitigation guidance
Effective mitigation focuses on making certificate validation strict and fail-closed, and on ensuring that authentication decisions never override critical verification errors.
Common defensive patterns include:
- Using OpenSSL (or equivalent) verification functions without custom callbacks unless there is a compelling and well-reviewed need.
- When custom callbacks are necessary, treating all certificate verification errors as failures by default, only allowing narrow, explicitly justified exceptions.
- Enforcing complete and up-to-date trust stores, including all relevant CA and intermediate certificates, so that legitimate clients can be validated without relaxing checks.
- Implementing strict validation for certificate validity periods, rejecting not-yet-valid and expired certificates.
- Designing authentication flows so that any ambiguity in certificate status results in denial of access (fail-safe defaults).
How teams detect issues like this
Detection can focus on both code-level review and runtime behavior:
- Static analysis and code review:
- Search for custom OpenSSL/X.509 verification callbacks and inspect how error codes (e.g.,
X509_V_ERR_*) are handled. - Flag patterns where non-zero verification error codes are mapped to success or where return values from verification functions are forced to "pass".
- Review authentication logic paths where certificate validation results are transformed, ignored, or overridden.
- Policy and configuration checks:
- Enforce secure coding guidelines requiring fail-closed certificate validation and forbidding the suppression of verification errors without justification.
- Incorporate security-focused code review on cryptographic and authentication modules.
- Runtime and operational monitoring:
- Enable detailed TLS logging (where feasible) to detect connections that succeed with certificates that are not in the trusted CA list or that are expired.
- Use penetration testing or automated security tests to attempt connections with invalid, expired, or untrusted certificates and verify they are rejected.

