Miggo Logo

CVE-2021-40824:
Logic error in Matrix SDK for Android

5.9

CVSS Score
3.1

Basic Information

EPSS Score
0.47007%
Published
5/24/2022
Updated
8/18/2023
KEV Status
No
Technology
TechnologyJava

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
org.matrix.android:matrix-android-sdk2maven< 1.2.21.2.2

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from improper device identity verification during encryption key sharing. The patches show critical changes in how device authentication is handled:

  1. MXMegolmEncryption.shareKeyWithDevices was modified to use full deviceInfo instead of separate user/device IDs when checking cryptoStore
  2. SharedWithHelper and IMXCryptoStore interfaces were updated to require device identity keys in session tracking
  3. Database queries in RealmCryptoStore now join with device identity keys
  4. The migration adds deviceIdentityKey field to shared session records These changes indicate the original code paths used only user ID and device ID for authentication, allowing impersonation by malicious servers controlling those identifiers. The vulnerable functions would appear in profilers during key sharing operations when processing untrusted device claims.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

* lo*i* *rror in t** room k*y s**rin* *un*tion*lity o* *l*m*nt *n*roi* ***or* *.*.* *n* m*trix-*n*roi*-s*k* (*k* M*trix S*K *or *n*roi*) ***or* *.*.* l***s to * situ*tion w**r* i**ntity v*ri*i**tion is in***qu*t* *n* t*us * k*y-r*qu*stin* **vi** **n

Reasoning

T** vuln*r**ility st*ms *rom improp*r **vi** i**ntity v*ri*i**tion *urin* *n*ryption k*y s**rin*. T** p*t***s s*ow *riti**l ***n**s in *ow **vi** *ut**nti**tion is **n*l**: *. MXM**olm*n*ryption.s**r*K*yWit***vi**s w*s mo*i*i** to us* *ull **vi**In*o