Submit #1066399: davenardella snap7 up to and including 1.4.3 memory-corruptioninfo

Titledavenardella snap7 up to and including 1.4.3 memory-corruption
DescriptionA memory-corruption vulnerability exists in davenardella snap7 up to and including 1.4.3, in the function TSnap7MicroClient::opReadMultiVars() of src/core/s7_micro_client.cpp. The manipulation of the server-supplied per-item field DataLength leads to an out-of-bounds write. The affected code derives the length of a memcpy from this per-item field of the S7 read response and never validates it against the caller's destination size or the number of bytes actually received. Vulnerability class: Out-of-bounds Write (CWE-787) / Memory Corruption. Affected file: src/core/s7_micro_client.cpp Affected function: TSnap7MicroClient::opReadMultiVars() Affected parameter: DataLength (S7 read response item field) Affected version: up to and including 1.4.3 CVSS 3.1: AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:H (7.4) CVSS 4.0: AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N (8.3) Technical detail: in the per-item read loop, Slice is taken from the peer (Slice = SwapWord(ResData[c]->DataLength) at line 413) and used directly as the memcpy length into the caller's per-item buffer: memcpy(Item->pdata, ResData[c]->Data, Slice) at line 418. Item->pdata is the caller's destination, sized by the caller's own TS7DataItem.Amount, and Slice is checked against neither that amount nor the bytes actually received. Both the length and the TransportSize that selects the shift at line 416 are chosen by the peer. The ISO transport does not mitigate this: isoRecvBuffer() validates only the TPKT length, while DataLength is a separate field inside the S7 payload that is never cross-checked. Impact: client-side flaw; the destination is the calling application's own memory. The function backs Cli_ReadMultiVars, the batched read used by SCADA front ends, HMIs, historians and protocol gateways. Attacker position is the server end: a malicious PLC, a rogue device on the S7 network, or an attacker able to answer the read. The condition is reached on the first response, and because the defect is per item, a single malicious response can corrupt several distinct application buffers, with an up-to-65535-byte write into a small caller buffer. This is a separate function and code path from opReadArea (CVE-2026-111280, issue 31) and opUpload (CVE-2026-90572, issue 30), requiring its own patch. Confirmed dynamically against commit 30f37da under AddressSanitizer: a one-item one-byte read into a one-byte allocation, answered with DataLength = 0xFFFF, produces a heap-buffer-overflow WRITE of size 65535 at s7_micro_client.cpp:418. A reproducer exists but is not published because there is no released fix and upstream has had no commits since 14 July 2025; it can be provided privately to the maintainer or the CNA. Suggested fix: bound Slice before the copy against both the bytes actually received and the caller's item buffer size (Item->Amount * DataSizeByte(Item->WordLen)); break with errCliInvalidPlcAnswer otherwise. Reported upstream as davenardella/snap7 issue 32 on 1 August 2026; the maintainer has not responded.
Source⚠️ https://github.com/davenardella/snap7/issues/32
User
 mayur021 (UID 27195)
Submission10/30/2026 12:05 (27 days ago)
Moderation11/26/2026 21:43 (27 days later)
StatusDuplicate
VulDB entry439117 [davenardella Snap7 up to 1.4.3 opReadMultiVars out-of-bounds write]
Points0

Are you interested in using VulDB?

Download the whitepaper to learn more about our service!