Skip to content
DoS Disclosed report Intermediate

Denial of Service vulnerability in curl when parsing MQTT server response

curl enters an infinite loop when parsing a crafted MQTT server response, causing the process to hang. An attacker can cause a denial of service by serving malicious content behind an MQTT URL.

jenny Follow

Originally disclosed on HackerOne

Medium 4.3 View original
  • Disclosed after 4 days

Summary:

Curl remains in infinite loop with suitable MQTT server response.

Steps To Reproduce:

###Step 1: Run the following on linux with the attached file "poc" :

$ socat -u FILE:poc TCP-LISTEN:12345,reuseaddr,fork

###Step 2: Use curl:

$ curl mqtt://localhost:12345

###Step 3: Observe output of "top".

Supporting Material/References:

[list any additional material (e.g. screenshots, logs, etc.)]

  • F1667277 (poc file to host for curl to access)
  • F1667276 (screen capture of top)

Debugging Notes:

Debug trace output before going to the loop:

=> Send header, 26 bytes (0x1a)
0000: 10 18 00 04 4d 51 54 54 04 02 00 3c 00 0c 63 75 ....MQTT...<..cu
0010: 72 6c 36 30 64 33 32 37 66 39                   rl60d327f9
== Info: MQTT_FIRST (from MQTT_FIRST) (next is MQTT_CONNACK)
== Info: STATE: DO => DOING handle 0x5555555dc0d8; line 2132 (connection #0)
== Info: mqtt_doing: state [0]
== Info: mqtt_doing: state [0]
== Info: mqtt_doing: state [0]
== Info: mqtt_doing: state [0]
== Info: mqtt_doing: state [0]
== Info: mqtt_doing: state [0]
== Info: mqtt_doing: state [0]
...

This section of lib/multi.c looks suspicious (line 2132 points here before entering the loop):

   2130             /* DO was not completed in one function call, we must continue
   2131                DOING... */
   2132             multistate(data, MSTATE_DOING);
   2133             rc = CURLM_OK;
   2134           }

Credits

Jenny Heino and Antti Levomäki from Forcepoint

Impact

Attacker can cause a Denial of Service by delivering malicious content behind a MQTT URL. For example internet crawlers could be affected, or any other implementations automatically fetching provided URLs using curl.

Attachments

top.PNG
top.PNG From the original on HackerOne

The original report as published on HackerOne, by jenny. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a state machine bug in lib/multi.c where the DO state is not completed and the code loops without progress.

Impact

An attacker can cause a denial of service by delivering malicious content behind an MQTT URL, potentially affecting internet crawlers or any implementation that automatically fetches URLs with curl.

What the attacker needed

Curl built with MQTT support; attacker controls MQTT server response

How it was found

  1. Start a TCP listener that serves the provided proof-of-concept file.
  2. Run curl against the MQTT URL pointing to that listener.
  3. Observe the process using top and see it stuck in a loop.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

curl is a tool for fetching data from URLs. When it talks to an MQTT server, a specially crafted reply can make curl loop forever instead of finishing, so the program hangs and stops working.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More from curl

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.