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

High 8.6 Published Updated

Attackers can impersonate users by inserting invalid room keys because the client fails to verify the key's origin, compromising encrypted communication integrity.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-39254?

CVE-2022-39254 is a high-severity authentication bypass vulnerability in poljar matrix-nio, published on 29 Sep 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

matrix-nio is a Python Matrix client library, designed according to sans I/O principles. Prior to version 0.20, when a users requests a room key from their devices, the software correctly remember the request. Once they receive a forwarded room key, they accept it without checking who the room key came from. This allows homeservers to try to insert room keys of questionable validity, potentially mounting an impersonation attack. Version 0.20 fixes the issue.

Weakness: CWE-322, CWE-287

Which versions are affected by CVE-2022-39254?

3 open source packages ship an affected version, including matrix-nio. It affects 1 product.

PackageAffectedFixed in
matrix-nio PyPIAll versions0.20
matrix-nio PyPIAll versions0.20
matrix-nio PyPIAll versions0.20

Products include Matrix-Nio Project Matrix-Nio.

How do I fix CVE-2022-39254?

Upgrade matrix-nio to 0.20 or later.

Upgrade, and rotate credentials and sessions that may have been exposed. More about Authentication bypass.

Is CVE-2022-39254 being exploited?

There is no known exploitation of CVE-2022-39254 in the wild and no public exploit code.

Sources

Also known as DEBIAN-CVE-2022-39254, GHSA-w4pr-4vjg-hffh, PYSEC-2026-842, UBUNTU-CVE-2022-39254.

Is CVE-2022-39254 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free