CVE-2025-67268
CVE-2025-67268
Weakness (CWE)
CVSS Vector
v3.1- Attack Vector
- Network
- Attack Complexity
- Low
- Privileges Required
- None
- User Interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Description
gpsd before commit dc966aa contains a heap-based out-of-bounds write vulnerability in the drivers/driver_nmea2000.c file. The hnd_129540 function, which handles NMEA2000 PGN 129540 (GNSS Satellites in View) packets, fails to validate the user-supplied satellite count against the size of the skyview array (184 elements). This allows an attacker to write beyond the bounds of the array by providing a satellite count up to 255, leading to memory corruption, Denial of Service (DoS), and potentially arbitrary code execution.
Comprehensive Technical Analysis of CVE-2025-67268
CVE ID: CVE-2025-67268 CVSS Score: 9.8 (Critical) Vulnerability Type: Heap-Based Out-of-Bounds Write (CWE-787)
1. Vulnerability Assessment and Severity Evaluation
Technical Overview
CVE-2025-67268 is a heap-based out-of-bounds write vulnerability in gpsd, a widely used open-source GPS daemon that parses and distributes GPS data. The flaw resides in the hnd_129540 function within drivers/driver_nmea2000.c, which processes NMEA2000 PGN 129540 (GNSS Satellites in View) packets.
Root Cause
- The function fails to validate the satellite count field in incoming NMEA2000 messages against the fixed-size
skyviewarray (184 elements). - An attacker can craft a malicious NMEA2000 packet with a satellite count up to 255, causing the function to write beyond the allocated heap memory.
- This leads to memory corruption, which can result in:
- Denial of Service (DoS) (crash via heap corruption)
- Arbitrary Code Execution (ACE) (if an attacker can control the overwritten memory)
Severity Justification (CVSS 9.8)
| CVSS Metric | Value | Explanation |
|---|---|---|
| Attack Vector (AV) | Network (N) | Exploitable remotely via crafted NMEA2000 packets. |
| Attack Complexity (AC) | Low (L) | No special conditions required; trivial to exploit. |
| Privileges Required (PR) | None (N) | No authentication needed. |
| User Interaction (UI) | None (N) | Exploitable without user action. |
| Scope (S) | Unchanged (U) | Affects the gpsd process only. |
| Confidentiality (C) | High (H) | Potential for arbitrary code execution. |
| Integrity (I) | High (H) | Memory corruption can alter program behavior. |
| Availability (A) | High (H) | Crash or DoS via heap corruption. |
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Criticality: 9.8 (Critical) – High-impact, remotely exploitable, no authentication required.
2. Potential Attack Vectors and Exploitation Methods
Attack Vectors
-
Remote Exploitation via NMEA2000 Packets
- An attacker on the same network as a vulnerable gpsd instance can send crafted NMEA2000 PGN 129540 messages with an inflated satellite count.
- No prior authentication is required, making this a low-complexity attack.
-
Local Exploitation via Malicious GPS Hardware
- If an attacker has physical access to a system with a compromised GPS receiver, they can inject malicious NMEA2000 data.
- This is particularly dangerous in maritime, aviation, or IoT deployments where gpsd is used for navigation.
-
Supply Chain Attack via GPS Spoofing
- An attacker could spoof GPS signals to deliver malicious NMEA2000 packets, bypassing network-level protections.
Exploitation Steps
-
Craft a Malicious NMEA2000 PGN 129540 Packet
- Set the satellite count field to 255 (maximum allowed in NMEA2000).
- Populate the packet with arbitrary data to overwrite adjacent heap memory.
-
Trigger Heap Corruption
- The
hnd_129540function processes the packet and writes beyond theskyviewarray (184 elements), corrupting the heap.
- The
-
Achieve Arbitrary Code Execution (ACE)
- If the attacker can control the overwritten memory (e.g., via heap grooming), they may redirect execution to malicious shellcode.
- Alternatively, return-oriented programming (ROP) techniques could be used to bypass modern exploit mitigations (ASLR, DEP).
-
Denial of Service (DoS)
- Even if ACE is not achieved, heap corruption can crash the gpsd process, disrupting GPS-dependent services.
Exploitability Factors
- No Authentication Required: The vulnerability is exploitable by any entity that can send NMEA2000 packets.
- Low Attack Complexity: No special conditions (e.g., race conditions, memory leaks) are needed.
- Heap Layout Control: If an attacker can predict heap allocations, they may achieve reliable exploitation.
3. Affected Systems and Software Versions
Vulnerable Software
- gpsd versions before commit
dc966aa74c075d0a6535811d98628625cbfbe3f4(January 2026). - All versions of gpsd that process NMEA2000 PGN 129540 packets without the fix.
Affected Deployments
- Maritime & Aviation Systems (GPS-dependent navigation).
- IoT & Embedded Devices (e.g., drones, autonomous vehicles, precision agriculture).
- Critical Infrastructure (e.g., power grid synchronization, financial timestamping).
- Consumer & Enterprise GPS Receivers (e.g., Raspberry Pi + GPS modules, NTP servers).
Not Affected
- Systems that do not use gpsd for NMEA2000 processing.
- gpsd instances patched with commit
dc966aaor later.
4. Recommended Mitigation Strategies
Immediate Actions
-
Apply the Official Patch
- Upgrade to the latest gpsd version containing commit
dc966aaor later. - Patch URL: https://github.com/ntpsec/gpsd/commit/dc966aa74c075d0a6535811d98628625cbfbe3f4
- Upgrade to the latest gpsd version containing commit
-
Network-Level Protections
- Isolate GPS receivers from untrusted networks (e.g., VLAN segmentation).
- Firewall NMEA2000 traffic to allow only trusted sources.
- Disable NMEA2000 processing if not required (
--disable-nmea2000build flag).
-
Runtime Protections
- Enable ASLR, DEP, and Stack Canaries (if not already enabled).
- Use a hardened malloc implementation (e.g.,
jemalloc,tcmalloc) to mitigate heap exploitation. - Deploy gpsd in a sandbox (e.g.,
seccomp,AppArmor,SELinux).
-
Monitoring & Detection
- Log and alert on abnormal NMEA2000 packets (e.g., satellite count > 184).
- Deploy IDS/IPS rules to detect exploitation attempts (e.g., Suricata/Snort rules for malformed PGN 129540 packets).
Long-Term Recommendations
-
Input Validation Hardening
- Enforce strict bounds checking on all NMEA2000 fields.
- Use safe memory functions (
snprintf,memcpy_s) instead of rawmemcpy.
-
Fuzz Testing & Code Audits
- Integrate fuzzing (e.g., AFL++, libFuzzer) into gpsd’s CI/CD pipeline.
- Conduct a full security audit of NMEA2000 and other protocol handlers.
-
Dependency Management
- Monitor gpsd updates via CVE feeds (e.g., NVD, CISA KEV).
- Replace gpsd with alternative GPS daemons if long-term support is uncertain.
5. Impact on the Cybersecurity Landscape
Broader Implications
-
Critical Infrastructure at Risk
- gpsd is widely used in maritime, aviation, and industrial control systems (ICS).
- A successful exploit could disrupt navigation, timing synchronization, or automated systems.
-
Supply Chain & Third-Party Risks
- Many embedded Linux distributions (e.g., Yocto, Buildroot) bundle gpsd.
- Vendor firmware updates may lag, leaving devices vulnerable for extended periods.
-
GPS Spoofing & Cyber-Physical Attacks
- This vulnerability lowers the barrier for GPS spoofing attacks, which can:
- Mislead autonomous vehicles (e.g., drones, self-driving cars).
- Disrupt financial trading systems (e.g., timestamp manipulation).
- Cause maritime collisions (e.g., AIS spoofing).
- This vulnerability lowers the barrier for GPS spoofing attacks, which can:
-
Exploitability in the Wild
- Given the low complexity and high impact, this vulnerability is highly attractive to threat actors, including:
- Nation-state APTs (e.g., targeting critical infrastructure).
- Cybercriminals (e.g., ransomware via DoS).
- Hacktivists (e.g., disrupting GPS-dependent services).
- Given the low complexity and high impact, this vulnerability is highly attractive to threat actors, including:
Comparable Vulnerabilities
- CVE-2021-22204 (ExifTool RCE) – Similar heap overflow via crafted input.
- CVE-2020-11901 (gpsd Time Injection) – Previous gpsd vulnerability with critical impact.
- CVE-2019-11477 (TCP SACK Panic) – Remote DoS via network packet manipulation.
6. Technical Details for Security Professionals
Vulnerable Code Analysis
File: drivers/driver_nmea2000.c
Function: hnd_129540()
Vulnerable Code Snippet (Pre-Patch)
static void hnd_129540(struct gps_device_t *session, unsigned char *buf, size_t len)
{
struct skyview_t *sky = &session->gpsdata.skyview;
unsigned char *ptr = buf;
int i, satcount = *ptr++; // [1] No bounds check on satcount
for (i = 0; i < satcount; i++) { // [2] Writes beyond skyview[184]
sky->sat[i].PRN = getleu16(ptr); ptr += 2;
sky->sat[i].elevation = getles16(ptr); ptr += 2;
sky->sat[i].azimuth = getleu16(ptr); ptr += 2;
sky->sat[i].ss = *ptr++;
sky->sat[i].used = (*ptr++ & 0x01) ? true : false;
}
}
Key Issues:
- No validation of
satcount(can be up to 255). skyviewarray is fixed at 184 elements (MAXCHANNELSin gpsd.h).- Heap overflow occurs when
satcount > 184, corrupting adjacent memory.
Patched Code (Commit dc966aa)
static void hnd_129540(struct gps_device_t *session, unsigned char *buf, size_t len)
{
struct skyview_t *sky = &session->gpsdata.skyview;
unsigned char *ptr = buf;
int i, satcount = *ptr++;
if (satcount > MAXCHANNELS) { // [1] Bounds check added
gpsd_report(session->context->debug, LOG_WARN,
"NMEA2000 PGN 129540: satellite count %d > %d\n",
satcount, MAXCHANNELS);
return;
}
for (i = 0; i < satcount; i++) {
if (i >= MAXCHANNELS) break; // [2] Additional safety check
sky->sat[i].PRN = getleu16(ptr); ptr += 2;
sky->sat[i].elevation = getles16(ptr); ptr += 2;
sky->sat[i].azimuth = getleu16(ptr); ptr += 2;
sky->sat[i].ss = *ptr++;
sky->sat[i].used = (*ptr++ & 0x01) ? true : false;
}
}
Fixes Applied:
- Bounds check on
satcount(rejects values >MAXCHANNELS). - Additional loop termination if
iexceedsMAXCHANNELS.
Exploitation Technical Deep Dive
Heap Layout & Exploitation Primitives
-
Heap Grooming
- An attacker may spray the heap with controlled data to influence memory layout.
- Use-after-free (UAF) or double-free conditions could be leveraged if adjacent objects are freed.
-
Arbitrary Write Primitive
- By controlling the satellite data fields, an attacker can overwrite:
- Function pointers (e.g., in adjacent heap structures).
- Return addresses (if stack canary is bypassed).
- GOT/PLT entries (for dynamic linking attacks).
- By controlling the satellite data fields, an attacker can overwrite:
-
Return-Oriented Programming (ROP)
- If ASLR is bypassed (e.g., via information leaks), ROP chains can be constructed to:
- Disable DEP (
mprotect). - Execute shellcode from a known memory location.
- Disable DEP (
- If ASLR is bypassed (e.g., via information leaks), ROP chains can be constructed to:
Proof-of-Concept (PoC) Exploitation
- Craft a Malicious NMEA2000 Packet
import socket # Craft PGN 129540 with satcount=255 payload = b"\xFF" + b"\x00" * 254 * 8 # 255 satellites * 8 bytes each sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.sendto(payload, ("<gpsd_ip>", 2947)) # Default gpsd port - Trigger Heap Corruption
- The
hnd_129540function writes beyondskyview, corrupting adjacent heap metadata.
- The
- Achieve Code Execution
- If the attacker controls the overwritten memory, they can redirect execution to a ROP chain or shellcode.
Detection & Forensics
- Network-Based Detection
- IDS/IPS Rules (e.g., Suricata):
alert udp any any -> any 2947 (msg:"CVE-2025-67268 Exploit Attempt - NMEA2000 PGN 129540 Satcount > 184"; content:"|FF|"; depth:1; sid:1000001; rev:1;)
- IDS/IPS Rules (e.g., Suricata):
- Host-Based Detection
- Monitor gpsd logs for:
"NMEA2000 PGN 129540: satellite count X > 184" - Check for crashes in
gpsd(e.g.,SIGSEGV,SIGABRT).
- Monitor gpsd logs for:
- Memory Forensics
- Volatility/Rekall Analysis to detect heap corruption:
vol.py -f memory.dump linux_heap
- Volatility/Rekall Analysis to detect heap corruption:
Conclusion
CVE-2025-67268 is a critical heap-based buffer overflow in gpsd with remote code execution potential. Given its low attack complexity, high impact, and widespread deployment, it poses a significant risk to critical infrastructure, IoT, and embedded systems.
Immediate patching is strongly recommended, along with network segmentation, runtime protections, and monitoring to mitigate exploitation risks. Security teams should audit gpsd deployments and prepare for potential in-the-wild exploitation.
For further details, refer to: