You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An issue was discovered in MQTT-C through 1.1.5. The MQTT input data processing function mqtt_unpack_publish_response in mqtt.c does not validate the length of incoming topic_name_size, which leads to an out-of-bounds read when subsequent processing of the input data. And this could also lead to an integer overflow when calculating the remaining length of incoming response. Eventually causing Denial-of-Service or an information leak, even remote code execution.
Description
In mqtt_unpack_publish_response, topic_name_size is unpack from input data directly (Line 1352). And then buf pointer add topic_name_size without checking if it exceeds the range of buf, which leads to a buffer overflow. ([Line 1355])
And if attacker provide a topic_name_size is bigger than remaining_length, which could leads to an integer overflow. ([Line 1365] and [Line 1367])
Happy to accept a PR fixing this. I maintain this repo casually and I'm not paid; MQTT-C in it's current form is stable and pretty widely used. It looks like the author described how to fix the problem---not sure why this wasn't submitted as a PR, but I'm happy to merge a fix.
dns13
added a commit
to dns13/MQTT-C
that referenced
this issue
Apr 12, 2023
Overview
An issue was discovered in MQTT-C through 1.1.5. The MQTT input data processing function
mqtt_unpack_publish_response
in mqtt.c does not validate the length of incomingtopic_name_size
, which leads to an out-of-bounds read when subsequent processing of the input data. And this could also lead to an integer overflow when calculating the remaining length of incoming response. Eventually causing Denial-of-Service or an information leak, even remote code execution.Description
In
mqtt_unpack_publish_response
,topic_name_size
is unpack from input data directly (Line 1352). And thenbuf
pointer addtopic_name_size
without checking if it exceeds the range ofbuf
, which leads to a buffer overflow. ([Line 1355])And if attacker provide a
topic_name_size
is bigger thanremaining_length
, which could leads to an integer overflow. ([Line 1365] and [Line 1367])MQTT-C/src/mqtt.c
Lines 1332 to 1373 in be12c34
Impact
Denial-of-Service or an information leak, even remote code execution.
The text was updated successfully, but these errors were encountered: