Arbitrary memory read while parsing malicious mDNS queries #9
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
CVE Reporting (2018-12-27) reporter
Function uncompress_nlabel that uncompresses mDNS nlabels reads data from arbitrary address based on input from mDNS packet.
Based on DNS specification: "A compression label is a pointer that occupies the NAME field of the Answer section (16 bits). The first 2 bits are set to 1, the 14 remaining bits describe the offset, i.e. the position of the compression target from the beginning of the DNS message."
Offset to next label is calculated in mdns.c:237 (the same code is duplicated at line 255): uint8_t p2 = pkt_buf + (((p[0] & ~0xC0) << 8) | p[1]); And immediately used in next line without any check whether p2 is within allocated buffer: llen = p2 + 1; This allows to arbitrary data read up to 16383 bytes from the start of the buffer. This can lead do segmentation fault and crash of the server (depending on the memory protection of the CPU and the operating system) or disclosing the memory content via error messages or server response.
Proposed CVSS 3.0 score: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:H (9.3 Critical)
Packet that triggers this issue: crash_000_uncompress_nlabel_SEGV_16140.raw
Mitigation : While parsing the input buffer current offset should be checked and return with error when pkt_len is reached. Please take a look at patch that was produced to fix this issues in TizenRT (that uses tinysvcmdns):
2d9a3f156f
crash_000_uncompress_nlabel_SEGV_16140.raw