CVE-2021-0341 — okhttp
CVE-2021-0341 is a CWE-295 vulnerability in platform/external/okhttp. A fix is available for platform/external/okhttp — see the affected versions and patch details below.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
Real-World Exposure
platform/external/okhttp📦platform/libcore📦platform/external/okhttp📦platform/libcore📦platform/external/okhttp📦platform/libcore📦platform/external/okhttp📦platform/libcore+2 moreReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Android packages — download data is not available via public APIs for these ecosystems.
Description
In verifyHostName of OkHostnameVerifier.java, there is a possible way to accept a certificate for the wrong domain due to improperly used crypto. This could lead to remote information disclosure with no additional execution privileges needed. User interaction is not needed for exploitation.Product: AndroidVersions: Android-8.1 Android-9 Android-10 Android-11Android ID: A-171980069
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦Android | platform/external/okhttp | ≥ 8.0:0&&< 8.0:2021-02-01 | 8.0:2021-02-01 |
| 📦Android | platform/libcore | ≥ 8.0:0&&< 8.0:2021-02-01 | 8.0:2021-02-01 |
| 📦Android | platform/external/okhttp | ≥ 8.1:0&&< 8.1:2021-02-01 | 8.1:2021-02-01 |
| 📦Android | platform/libcore | ≥ 8.1:0&&< 8.1:2021-02-01 | 8.1:2021-02-01 |
| 📦Android | platform/external/okhttp | ≥ 9:0&&< 9:2021-02-01 | 9:2021-02-01 |
| 📦Android | platform/libcore | ≥ 9:0&&< 9:2021-02-01 | 9:2021-02-01 |
Affected Products
androidgoogleDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for platform/external/okhttp, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update platform/external/okhttp to 8.0:2021-02-01 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2021-0341 is resolved across your whole dependency graph.
Workarounds
Assume what was exposed is already known: rotate any credential, token or key that the affected component could return, restrict the endpoint to callers that genuinely need it, and strip sensitive fields from responses and error output at the boundary rather than relying on the client not to read them.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat AMQ Streams 2.4.0 | okhttp | RHSA-2023:3223 |
| Red Hat Data Grid 8.4.2 | okhttp | RHSA-2023:2723 |
| Red Hat JBoss Enterprise Application Platform Expansion Pack | okhttp | RHSA-2023:0756 |
| Red Hat OpenShift Dev Spaces 3 Containers | devspaces/server-rhel8:3.16-14 | RHSA-2024:6667 |
| Red Hat Single Sign-On 7 | okhttp | RHSA-2023:2713 |
| Red Hat Single Sign-On 7.6 for RHEL 7 | rh-sso7-keycloak-0:18.0.7-1.redhat_00001.1.el7sso | RHSA-2023:2705 |
| Red Hat Single Sign-On 7.6 for RHEL 8 | rh-sso7-keycloak-0:18.0.7-1.redhat_00001.1.el8sso | RHSA-2023:2706 |
| Red Hat Single Sign-On 7.6 for RHEL 9 | rh-sso7-keycloak-0:18.0.7-1.redhat_00001.1.el9sso | RHSA-2023:2707 |
Frequently Asked Questions
Is CVE-2021-0341 in your dependencies?
Find it across Android, including transitive dependencies.