Skip to content

Latest commit

 

History

History
42 lines (33 loc) · 4.58 KB

File metadata and controls

42 lines (33 loc) · 4.58 KB

Threat Model Analysis for realm/realm-kotlin

Description: An attacker who gains physical access to a device or unauthorized access to the device's file system can directly read the Realm database file. The attacker can then extract and analyze sensitive data stored within the unencrypted Realm file. Impact: Confidentiality breach, exposure of sensitive user data, privacy violation, potential regulatory compliance issues (e.g., GDPR, HIPAA). Affected Realm-Kotlin Component: Core Realm Database File Storage (default configuration). Risk Severity: High (if sensitive data is stored). Mitigation Strategies:

  • Enable Realm file encryption using RealmConfiguration.Builder.encryptionKey().
  • Securely manage the encryption key, utilizing platform-specific secure storage mechanisms like Android Keystore or iOS Keychain.

Description: When using Realm Sync, if communication between the application and the Realm Object Server/Atlas Device Services is not properly secured with HTTPS/TLS, an attacker performing a man-in-the-middle (MITM) attack can intercept network traffic. This allows the attacker to eavesdrop on synchronized data, potentially modify data in transit, or inject malicious data. Impact: Confidentiality breach, data interception, data manipulation, data integrity compromise, man-in-the-middle attacks. Affected Realm-Kotlin Component: Realm Sync Module, Network Communication. Risk Severity: Critical (if sensitive data is synchronized). Mitigation Strategies:

  • Mandatory: Enforce HTTPS/TLS for all Realm Sync connections by configuring the Realm Object Server/Atlas Device Services and application connection settings to use secure protocols.
  • Implement certificate pinning (if applicable and feasible) to further mitigate MITM attacks by validating the server's TLS certificate against a known, trusted certificate.

Description: An attacker could exploit vulnerabilities or misconfigurations in the authentication and authorization mechanisms of Realm Sync/Atlas Device Services to gain unauthorized access to backend data. This could involve bypassing authentication checks, exploiting weak authentication methods, or circumventing authorization rules to access or modify data they are not permitted to. Impact: Unauthorized data access, data modification, data deletion, privilege escalation, account takeover, backend system compromise. Affected Realm-Kotlin Component: Realm Sync Authentication and Authorization Modules, Realm Object Server/Atlas Device Services Security Configuration. Risk Severity: Critical (if backend data is highly sensitive and access control is crucial). Mitigation Strategies:

  • Utilize strong authentication methods provided by Realm Sync/Atlas Device Services (e.g., username/password with strong password policies, API keys, OAuth 2.0, custom authentication providers).
  • Implement fine-grained authorization rules on the Realm Object Server/Atlas Device Services to control data access based on user roles, permissions, and data ownership.

Description: Although highly improbable for the official Realm Kotlin library from the reputable Realm team, there is a theoretical risk of using a compromised or malicious library if obtained from untrusted sources or through a supply chain attack. A malicious library could contain backdoors, malware, or code designed to exfiltrate data or compromise the application. Impact: Complete application compromise, data breach, malware infection, unauthorized access to device resources, severe security incident. Affected Realm-Kotlin Component: Entire Realm Kotlin Library, Application Integration. Risk Severity: High to Critical (if using untrusted sources). Mitigation Strategies:

  • Crucial: Always obtain Realm Kotlin libraries from official and trusted sources like Maven Central, the official Realm GitHub repository, or the official Realm website.
  • Verify library integrity using checksums or digital signatures provided by Realm (if available).