Skip to content

Latest commit

 

History

History
48 lines (39 loc) · 4.79 KB

File metadata and controls

48 lines (39 loc) · 4.79 KB

Threat Model Analysis for square/okhttp

Description: Attacker exploits outdated or weak TLS versions or cipher suites configured in OkHttp to eavesdrop on communication, perform man-in-the-middle attacks, or downgrade connection security. This is achieved by intercepting network traffic and exploiting known vulnerabilities in weak TLS configurations supported by OkHttp. Impact: Confidentiality breach, data integrity compromise, potential for unauthorized access or manipulation of data transmitted via OkHttp. OkHttp Component Affected: OkHttpClient configuration, ConnectionSpec Risk Severity: High Mitigation Strategies:

  • Configure OkHttpClient to use ConnectionSpec.MODERN_TLS or explicitly specify ConnectionSpec with TLS 1.2 or higher and strong cipher suites.
  • Regularly update OkHttp library to benefit from security updates and modern TLS defaults.
  • Disable support for older TLS versions (TLS 1.0, TLS 1.1) and weak cipher suites within OkHttp's configuration if possible or rely on secure defaults of latest OkHttp versions.

Description: Attacker performs a man-in-the-middle (MITM) attack by presenting a fraudulent certificate. If certificate validation in OkHttp is disabled or improperly implemented, the application using OkHttp will accept the malicious certificate, allowing the attacker to intercept and potentially modify communication. This can be done by compromising DNS, ARP poisoning, or controlling network infrastructure. Impact: Confidentiality breach, data integrity compromise, potential for unauthorized access or manipulation of data, phishing attacks targeting applications using OkHttp. OkHttp Component Affected: OkHttpClient configuration, HostnameVerifier, CertificatePinner Risk Severity: Critical Mitigation Strategies:

  • Ensure default certificate validation in OkHttp is enabled and not bypassed.
  • Implement CertificatePinner within OkHttp's configuration for critical connections to enforce certificate pinning and prevent MITM attacks.
  • Avoid using HostnameVerifier.ALLOW_ALL_HOSTNAME_VERIFIER or disabling certificate validation in OkHttp's configuration in production code.
  • Carefully review and test any custom HostnameVerifier or CertificatePinner implementations used with OkHttp.

Description: Attacker intercepts network traffic by routing it through a malicious proxy server configured within OkHttp. This can happen if the application is configured to use an untrusted or compromised proxy via OkHttp's ProxySelector or Proxy settings, either through automatic proxy detection or manual configuration. The attacker can then eavesdrop on or modify communication handled by OkHttp. Impact: Confidentiality breach, data integrity compromise, potential for unauthorized access or manipulation of data transmitted through OkHttp. OkHttp Component Affected: OkHttpClient configuration, ProxySelector, Proxy Risk Severity: High Mitigation Strategies:

  • Carefully configure proxy settings within OkHttp and ensure they are secure and trusted.
  • Avoid automatic proxy detection in OkHttp if the network environment is not fully trusted.
  • If using proxies with OkHttp, ensure they are properly secured and authenticated.
  • Educate users about the risks of using untrusted proxies, especially when applications are configured to use system-wide proxy settings that OkHttp might respect.

Description: Attacker exploits publicly known security vulnerabilities present in specific versions of the OkHttp library itself. This requires the application to be using a vulnerable version of OkHttp. Vulnerabilities can range from remote code execution to denial of service or information disclosure within the OkHttp library. Impact: Depends on the specific vulnerability, ranging from application compromise to denial of service or data breach, potentially affecting all network communication handled by the vulnerable OkHttp library. OkHttp Component Affected: Various components within OkHttp depending on the specific vulnerability. Risk Severity: Varies from High to Critical depending on the specific vulnerability. Mitigation Strategies:

  • Keep the OkHttp library updated to the latest stable version to patch known vulnerabilities.
  • Regularly monitor security advisories specifically for OkHttp and its dependencies.
  • Use dependency scanning tools to proactively identify and flag vulnerable versions of OkHttp in your project.