Miggo Logo

CVE-2022-39254:
When matrix-nio receives forwarded room keys, the receiver doesn't check if it requested the key from the forwarder

8.6

CVSS Score
3.1

Basic Information

EPSS Score
0.23016%
Published
9/30/2022
Updated
9/7/2023
KEV Status
No
Technology
TechnologyPython

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
matrix-niopip< 0.200.20

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from the _handle_forwarded_room_key_event function's lack of sender device validation. The commit diff shows the fix introduced a new _should_accept_forward method that adds three critical checks: 1) device exists in store, 2) device is verified, and 3) device belongs to the current user. The original vulnerable version lacked these checks, allowing any device (even untrusted or malicious) to fulfill key requests as long as they had a matching session ID.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

W**n m*trix-nio ***or* *.** r*qu*sts * room k*y *rom our **vi**s, it *orr**tly ****pts k*y *orw*r*s only i* t**y *r* * r*spons* to * pr*vious r*qu*st. *ow*v*r, it *o*sn't ****k t**t t** **vi** t**t r*spon*** m*t***s t** **vi** t** k*y w*s r*qu*st** *

Reasoning

T** vuln*r**ility st*ms *rom t** _**n*l*_*orw*r***_room_k*y_*v*nt *un*tion's l**k o* s*n**r **vi** v*li**tion. T** *ommit *i** s*ows t** *ix intro*u*** * n*w _s*oul*_****pt_*orw*r* m*t*o* t**t ***s t*r** *riti**l ****ks: *) **vi** *xists in stor*, *)