CVE-2026-138163 in Gammu
Summary
by MITRE • 11/28/2026
Gammu before 1.45.2 contains a heap-based buffer overflow in ReadWAPSettingsEntry() that allows attackers to corrupt heap memory via crafted backup files with excess WAP or MMS settings entries. Attackers can supply a backup with more than four TitleNN keys in a [WAPSettings] or [MMSSettings] section, loaded via convertbackup, restore, or GSM_ReadBackupFile, causing crashes or potential code execution.
If you want to get the best quality for vulnerability data then you always have to consider VulDB.
Analysis
by VulDB Data Team • 11/28/2026
The vulnerability identified in Gammu versions prior to 1.45.2 represents a critical heap-based buffer overflow located within the ReadWAPSettingsEntry function. This flaw arises from insufficient validation of input data when processing backup files that contain Wireless Application Protocol or Multimedia Messaging Service settings. Specifically, the application fails to correctly bound-check array indices or memory allocations associated with TitleNN keys found in WAPSettings and MMSSettings sections. When a crafted backup file containing more than four such entries is processed through utilities like convertbackup, restore, or via the GSM_ReadBackupFile API function, the software attempts to write data beyond the allocated heap buffer boundaries. This lack of rigorous input sanitization allows an attacker to overwrite adjacent memory structures on the heap, leading to severe instability and potential exploitation scenarios.
From a technical perspective, this issue is classified under CWE-122, which denotes a heap-based buffer overflow. The operational impact of such a vulnerability extends beyond simple application crashes or denial of service conditions. By carefully crafting the payload within the backup file, an attacker can manipulate memory layout to achieve arbitrary code execution on the target system. This capability effectively compromises the confidentiality, integrity, and availability of the host environment where Gammu is deployed. The attack vector typically involves social engineering or supply chain compromise scenarios where a victim is persuaded to open a maliciously constructed backup file using the vulnerable software components.
In terms of threat modeling and industry standards, this vulnerability aligns with ATT&CK technique T1203, which covers exploitation for client execution. The specific mechanism leverages common application features like backup restoration or conversion tools, making it difficult to detect through standard perimeter defenses without deep packet inspection or behavioral analysis. Security teams should recognize that heap overflows are particularly dangerous because they can bypass many traditional stack-based protections and allow for sophisticated memory corruption attacks such as return-oriented programming or arbitrary write primitives depending on the allocator state.
To mitigate this risk, organizations must immediately upgrade Gammu to version 1.45.2 or later where these bounds checking issues have been addressed by the developers. Until patching is feasible, it is advisable to restrict the use of backup conversion and restoration features to trusted sources only and avoid processing unverified files through GSM_ReadBackupFile functions if possible. Implementing strict input validation at the application layer for all numeric keys in configuration sections can also serve as a compensating control. Regular security audits focusing on memory safety issues in C-based applications are recommended to prevent similar heap corruption vulnerabilities from being introduced or overlooked in future updates.