CVE-2024-39691: Matrix appservice irc Malicious Matrix Homeserver Can Leak Vulnerability
MODERATECVE-2024-39691 is a MODERATE (CVSS 4.3) malicious matrix homeserver can leak vulnerability (CWE-755: Improper Handling of Exceptional Conditions) affecting Matrix appservice irc libraries in the npm ecosystem. The issue involves malicious matrix homeserver can leak truncated message content of messages it shouldn't have access to. Remediation is available by upgrading affected packages to version 2.0.1.
CVE-2024-39691 at a Glance
Security Impact
CVSS: 4.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N).
How to Fix CVE-2024-39691
To remediate this vulnerability, upgrade all affected Matrix appservice irc dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install matrix-appservice-irc@2.0.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls matrix-appservice-irc
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-39691, inspect your project dependencies using npm:
npm ls matrix-appservice-irc
Analyze the terminal output to locate any version of Matrix appservice irc in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.1), your application is affected.
Note: The npm ls matrix-appservice-irc command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-755: Improper Handling of Exceptional Conditions, where the product does not handle or incorrectly handles an exceptional condition. In Matrix appservice irc, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-39691 Affected Matrix appservice irc Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
matrix-appservice-irc
|
npm |
< 2.0.1
|
2.0.1
|
References
Frequently Asked Questions
What is CVE-2024-39691?
Which Matrix appservice irc versions are affected?
What version fixes CVE-2024-39691?
Is matrix-appservice-irc affected?
What is the CVSS score of CVE-2024-39691?
What CWE is associated with CVE-2024-39691?
How can I check npm dependencies for CVE-2024-39691?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-w9mh-5x8j-9754",
"modified" : "2024-07-05T21:37:31Z",
"published" : "2024-07-05T20:06:06Z",
"aliases" : [ "CVE-2024-39691" ],
"summary" : "Malicious Matrix homeserver can leak truncated message content of messages it shouldn't have access to",
"details" : "### Impact\n\nThe fix for GHSA-wm4w-7h2q-3pf7 / [CVE-2024-32000](https://www.cve.org/CVERecord?id=CVE-2024-32000) included in matrix-appservice-irc 2.0.0 relied on the Matrix homeserver-provided timestamp to determine whether a user has access to the event they're replying to when determining whether or not to include a truncated version of the original event in the IRC message. Since this value is controlled by external entities, a malicious Matrix homeserver joined to a room in which a matrix-appservice-irc bridge instance (before version 2.0.1) is present can fabricate the timestamp with the intent of tricking the bridge into leaking room messages the homeserver should not have access to.\n\n### Patches\n\nmatrix-appservice-irc 2.0.1 [drops the reliance](https://github.com/matrix-org/matrix-appservice-irc/pull/1804) on `origin_server_ts` when determining whether or not an event should be visible to a user, instead tracking the event timestamps internally.\n\n### Workarounds\n\nIt's possible to limit the amount of information leaked by setting a reply template that doesn't contain the original message. See [these lines](https://github.com/matrix-org/matrix-appservice-irc/blob/d5d67d1d3ea3f0f6962a0af2cc57b56af3ad2129/config.sample.yaml#L601-L604) in the configuration file.\n\n### References\n\n- Patch: https://github.com/matrix-org/matrix-appservice-irc/pull/1804\n\n### For more information\n\nIf you have any questions or comments about this advisory, please email us at [security at matrix.org](mailto:security@matrix.org).",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "matrix-appservice-irc"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.0.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 2.0.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/matrix-org/matrix-appservice-irc/security/advisories/GHSA-w9mh-5x8j-9754"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-39691"
}, {
"type" : "WEB",
"url" : "https://github.com/matrix-org/matrix-appservice-irc/pull/1804"
}, {
"type" : "WEB",
"url" : "https://github.com/matrix-org/matrix-appservice-irc/commit/1835e047f269001054be4c68867797aa12372a0f"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/matrix-org/matrix-appservice-irc"
}, {
"type" : "WEB",
"url" : "https://github.com/matrix-org/matrix-appservice-irc/blob/d5d67d1d3ea3f0f6962a0af2cc57b56af3ad2129/config.sample.yaml#L601-L604"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-280", "CWE-755" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-07-05T20:06:06Z",
"nvd_published_at" : "2024-07-05T19:15:10Z"
}
}