Skip to content
DoS Disclosed report Intermediate

NULL Pointer Dereference (DoS) in libcurl SFTP QUOTE command parsing due to missing return statement

A missing return statement in libcurl's SFTP QUOTE command parsing lets execution continue after an error handler has freed memory, so the code dereferences NULL pointers. An attacker who can supply a QUOTE command with trailing garbage can crash the process, causing a denial of service.

m777m0 Follow

Originally disclosed on HackerOne

  • Disclosed after 22 hours

Summary:

A logic flaw in lib/vssh/libssh2.c causes a NULL pointer dereference when parsing SFTP QUOTE commands with trailing garbage. The function return_quote_error is called to handle errors and free memory, but the return keyword is missing in several blocks (e.g., lines 840, 857, 870). This allows the state machine to continue execution using NULL pointers, leading to an immediate segmentation fault. This is a reliable Remote Denial of Service (DoS) vector.

Affected version

[curl 8.18.0 (x86_64-pc-linux-gnu) libcurl/8.18.0 OpenSSL/3.5.4 zlib/1.3.1 brotli/1.1.0 zstd/1.5.7 libidn2/2.3.8]

Steps To Reproduce:

[Ensure a local SFTP server is running. Execute the following command with trailing garbage in the QUOTE command: curl -k -u user:pass sftp://127.0.0.1/ -Q "mkdir /tmp/test trailing_garbage" Observe the immediate crash: Segmentation fault (core dumped).]

Impact

Summary:

This vulnerability allows for a reliable Remote Denial of Service (DoS). Any application, service, or automated script utilizing libcurl to process SFTP QUOTE commands (especially those accepting user-supplied input) can be crashed instantly. This leads to service unavailability and can be used to disrupt critical infrastructure relying on curl for file transfers.

The original report as published on HackerOne, by m777m0. 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 missing return after the error-handling call, so the parser continues into code that assumes valid state and dereferences pointers that were already freed or never set.

Impact

Any application or script that passes user-supplied input into SFTP QUOTE commands through libcurl can be crashed, causing service unavailability.

What the attacker needed

Libcurl used for SFTP QUOTE commands; attacker controls the QUOTE command text

How it was found

  1. Have a local SFTP server running.
  2. Run curl against it with a QUOTE command that has trailing garbage after the valid part.
  3. Observe the immediate segmentation fault.

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.

The error handler ran and freed memory, but the program kept going and used NULL pointers, so it crashed. An attacker who can send a crafted QUOTE command can make it fall over.

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.