CVE-2024-27101
Executive Summary
CVE-2024-27101 is a high-severity vulnerability in SpiceDB, an open-source, Google Zanzibar-inspired database for managing security-critical application permissions. The vulnerability is an integer overflow in the chunking helper, which can cause the dispatching process to miss elements or panic. This affects any SpiceDB cluster where a resource being checked has more than 65,535 relationships for the same resource and subject type. The CheckPermission, BulkCheckPermission, and LookupSubjects API methods are impacted. The vulnerability has a CVSS score of 7.3 and is fixed in version 1.29.2.
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
SpiceDB is a Go-based project. The vulnerability is in the core library, not in a specific package manager. However, organizations using SpiceDB should ensure they are using the latest patched version (1.29.2 or later) from the official GitHub repository or container images.
CVSS Breakdown & Threat Level
- CVSS Score: 7.3 (High)
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low
- User Interaction: None
- Scope: Unchanged
- Confidentiality Impact: None
- Integrity Impact: None
- Availability Impact: High
The vulnerability is rated High due to the potential for denial of service (panic) and data integrity issues (missing elements) with low attack complexity and network access.
Deep Dive & Mechanics
The vulnerability is an integer overflow in the chunking helper function within SpiceDB. When processing relationships, SpiceDB uses chunking to handle large datasets. The chunking helper calculates the size of chunks to process. If the number of relationships for a given resource and subject type exceeds 65,535 (the maximum value for a 16-bit unsigned integer), an integer overflow can occur. This overflow can cause the chunking logic to miscalculate the boundaries, leading to two primary issues:
- Missing Elements: The dispatcher may skip processing some relationships, leading to incorrect permission checks.
- Panic: The miscalculation can cause an out-of-bounds access or other memory safety issue, resulting in a panic and denial of service.
The affected API methods are:
- CheckPermission: Checks if a subject has a specific permission on a resource.
- BulkCheckPermission: Checks multiple permissions in a single request.
- LookupSubjects: Finds all subjects that have a specific permission on a resource.
An attacker with low privileges (e.g., a user who can create or modify relationships) can trigger this vulnerability by creating a large number of relationships (over 65,535) for a single resource and subject type.
Vulnerable vs. Patched Code
The vulnerable code is in the chunking helper function. The exact code is not publicly available, but the fix involves ensuring that the chunk size calculation does not overflow. The patched version (1.29.2) likely uses a larger integer type (e.g., uint64 instead of uint16) or adds bounds checking to prevent overflow.
Vulnerable Code (Conceptual):
func chunkHelper(count uint16) []chunk {
// Vulnerable: count can overflow if > 65535
// ...
}
Patched Code (Conceptual):
func chunkHelper(count uint64) []chunk {
// Patched: uses uint64 to prevent overflow
// ...
}
Exploitation & Lab Setup
Red Team
Prerequisites:
- Access to a SpiceDB instance with permission to create relationships.
- Ability to send gRPC requests to the SpiceDB API.
Exploitation Steps:
- Identify a resource and subject type that can have relationships created.
- Create more than 65,535 relationships for the same resource and subject type. This can be done using the SpiceDB API or SDK.
- Send a CheckPermission, BulkCheckPermission, or LookupSubjects request that involves that resource and subject type.
- The server may either return incorrect results (missing elements) or panic, causing a denial of service.
Example gRPC Request (using grpcurl):
grpcurl -plaintext -d '{
"resource": {"object_type": "resource", "object_id": "target_resource"},
"subject": {"object": {"object_type": "user", "object_id": "attacker"}},
"permission": "view"
}' <spicedb-address>:50051 authzed.api.v1.PermissionsService/CheckPermission
Blue Team
Detection:
- Monitor for a large number of relationship creation requests for the same resource and subject type.
- Monitor for SpiceDB panics or crashes.
- Monitor for unusual error messages related to chunking or dispatching.
Mitigation:
- Immediately upgrade to SpiceDB version 1.29.2 or later.
- If upgrading is not possible, implement rate limiting on relationship creation to prevent an attacker from creating a large number of relationships.
- Monitor logs for signs of exploitation.
Indicators of Compromise (IOCs)
- Log Entries: SpiceDB logs containing panic messages or errors related to chunking or dispatching.
- Network Traffic: A high volume of gRPC requests creating relationships for the same resource and subject type.
- System Behavior: SpiceDB service crashes or restarts.
- File Hashes: (Not applicable, as this is a logic vulnerability, not a file-based one.)
Detection Engineering
YARA Rule
rule CVE_2024_27101_SpiceDB_Chunking_Overflow {
meta:
description = "Detects potential exploitation of CVE-2024-27101 in SpiceDB logs"
author = "Valters IT"
date = "2024-01-01"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2024-27101"
strings:
$panic = "panic:" nocase
$chunk_error = "chunk" nocase
$overflow = "overflow" nocase
condition:
all of ($panic, $chunk_error, $overflow)
}
Sigma Rule
title: SpiceDB Chunking Overflow Exploitation
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects potential exploitation of CVE-2024-27101 in SpiceDB logs
author: Valters IT
date: 2024-01-01
logsource:
product: spicedb
service: spicedb
detection:
selection:
- "panic:"
- "chunk"
- "overflow"
condition: selection
falsepositives:
- Legitimate large-scale operations
level: high
Suricata Rule
alert tcp any any -> any 50051 (msg:"CVE-2024-27101 SpiceDB Chunking Overflow Exploitation"; flow:to_server; content:"CheckPermission"; content:"LookupSubjects"; content:"BulkCheckPermission"; threshold: type both, track by_src, count 100, seconds 60; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate Action: Upgrade to SpiceDB version 1.29.2 or later.
- Workaround: If upgrading is not immediately possible, implement rate limiting on relationship creation to prevent an attacker from creating a large number of relationships for the same resource and subject type.
- Monitoring: Enable detailed logging and monitoring for SpiceDB to detect any signs of exploitation.
- Network Segmentation: Restrict network access to the SpiceDB API to trusted clients only.
- Regular Updates: Keep SpiceDB and all dependencies up to date.
Valters IT