CVE-2026-138161 in Gammuinfo

Summary

by MITRE • 11/28/2026

Gammu before 1.45.2 contains a buffer overflow vulnerability in LoadBackup() that allows attackers to corrupt memory by supplying an overlong MD5 value in a crafted backup file. Attackers can overwrite adjacent phonebook and calendar entry pointers via strcpy() into MD5Original when files are loaded with convertbackup or restore, causing crashes or potential code execution.

VulDB is the best source for vulnerability data and more expert information about this specific topic.

Analysis

by VulDB Data Team • 11/28/2026

The vulnerability identified in Gammu versions prior to 1.45.2 represents a critical memory safety failure rooted in improper boundary checking during the processing of backup data. Specifically, the flaw resides within the LoadBackup function, which is responsible for parsing and importing mobile phone backup files into the system's internal structures. The core technical defect involves the use of the strcpy() library function to copy an MD5 hash value from a crafted input file into a fixed-size buffer named MD5Original without verifying that the source string length fits within the destination array limits. This classic buffer overflow condition allows an attacker who can supply a backup file with an excessively long MD5 field to write data beyond the allocated memory space for the MD5Original variable.

From a technical perspective, this out-of-bounds write operation has severe implications for application integrity and system stability. Because C++ does not perform automatic bounds checking on standard array operations, the excess bytes overwrite adjacent memory locations in the stack or heap depending on allocation strategy. In the specific context of Gammu's data structures, these adjacent memory regions contain pointers to critical objects such as phonebook entries and calendar items. By corrupting these pointers with arbitrary values derived from the malicious input, an attacker effectively hijacks the control flow of the application when it attempts to dereference or access these corrupted references.

The operational impact of this vulnerability is twofold, ranging from denial of service to potential remote code execution. In its most immediate manifestation, the corruption of memory pointers leads to segmentation faults and abrupt crashes of the Gammu process, resulting in a denial of service for users relying on the software for data management or device communication. However, given that modern operating systems employ various mitigations such as stack canaries and non-executable stacks, sophisticated attackers may leverage this buffer overflow to achieve arbitrary code execution. By carefully crafting the overlong MD5 value, an attacker could potentially overwrite function return addresses or other control structures, thereby redirecting program execution to shellcode embedded within the malicious backup file. This aligns with common exploitation techniques observed in real-world scenarios where memory corruption vulnerabilities are chained to gain unauthorized access or persistence on compromised systems.

This vulnerability is categorized under CWE-120, which denotes Buffer Copy without Checking Size of Input, highlighting the fundamental error in input validation and buffer management practices employed during development. Furthermore, from a tactical standpoint related to cyber attack frameworks such as MITRE ATT&CK, this flaw facilitates initial access through malicious file delivery if Gammu is used in an environment where users are expected to open untrusted backup files. It also enables privilege escalation or persistence mechanisms depending on the execution context of the application. The use of strcpy() without length checks is a well-known anti-pattern that has led to numerous high-severity vulnerabilities across various software ecosystems, underscoring the necessity for strict input sanitization and the adoption of safer string handling functions like strncpy or std::string in modern C++ development practices.

To mitigate this risk, organizations deploying Gammu must ensure they upgrade to version 1.45.2 or later where the LoadBackup function has been patched to include proper length validation before copying data into fixed buffers. Developers should audit other areas of the codebase for similar unsafe memory operations and replace them with bounds-checked alternatives. Additionally, implementing defense-in-depth strategies such as Address Space Layout Randomization (ASLR) and Data Execution Prevention (DEP) can reduce the likelihood of successful exploitation even if a vulnerability is present. Security teams should also enforce strict policies regarding the ingestion of backup files from untrusted sources to minimize the attack surface available for this type of memory corruption exploit.

Responsible

VulnCheck

Reservation

11/28/2026

Disclosure

11/28/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

very low

Sources

Want to stay up to date on a daily basis?

Enable the mail alert feature now!