Skip to content
Info disclosure Disclosed report Advanced

Libcurl ocasionally sends HTTPS traffic to port 443 rather than specified port 8080

A Windows agent using libcurl to talk to a server on port 8080 occasionally sent HTTPS traffic to port 443 instead, despite the application setting the port explicitly. An attacker who controls a service on port 443 on the same host could receive a small fraction of traffic meant for the real application.

omdr Follow

Originally disclosed on HackerOne

Medium 5.3 View original
  • Disclosed after 19 months

Summary:

We have encountered an issue with libcurl where, under certain network conditions, the library will attempt to submit data to an incorrect port as was set by CURLOPT_PORT. As information is sent to an unauthorised port, we consider this an information disclosure issue.

Our security software encompasses a Windows application (an agent) that runs as a Windows service. Its purpose is to collect custom metrics from the machine, such as IO operations (file reads, file writes, ...), process start/stops, user login, and some other forensic info. We use libcurl to communicate with a server over HTTPS.

A customer with ~5000 our agents raised an issue that approx 0.5% of all traffic is sent to port 443. In our application, we only use port 8080. Each request is made with source code (nearly identical) to the one I attach to this report.

This client uses Windows DNS load balancing. An agent will make a request to a local DNS server and the server will return an IP of one of the 5 servers based on round-robin. All servers have a web server running and our server-side application working on port 8080.

We were unable to pin-point exactly which network conditions trigger this issue reliably, however, we have been able to reproduce it in a production environment with logging enabled. This could potentially be triggered by a slow server response or when the web server is down.

Steps To Reproduce:

  1. Configure a round-robin DNS load balancing
  2. Make a high number of small HTTPS request to port 8080
  3. [Potentially] Server fails to handle a response [exact conditions were not established]
  4. Approx 0.5% of all traffic will be directed to port 443, under the hood, without application instructions

Supporting Material/References:

  • Example source code
  • Log sample showing the primary port is changed to 443

Versions

  • OS: Windows 10 x64

Libraries

  • curl:x86-windows-static 7.61.1-7
  • curl[http2]:x86-windows-static
  • curl[openssl]:x86-windows-static
  • curl[ssl]:x86-windows-static
  • curl[winssl]:x86-windows-static
  • fmt:x86-windows-static 5.3.0-1
  • gtest:x86-windows-static 2019-01-04-2
  • nghttp2:x86-windows-static 1.35.0
  • nlohmann-json:x86-windows-static 3.6.1
  • openssl-windows:x86-windows-static 1.0.2q-2
  • openssl:x86-windows-static 0
  • rapidcheck:x86-windows-static 2018-11-05-1
  • rapidxml:x86-windows-static 1.13
  • spdlog:x86-windows-static 1.3.1
  • zlib:x86-windows-static 1.2.11-5

Impact

An attacker must have access to the authorised server, for example, be a local admin.

The server is expected to run a web app on a port other than 443, for example, port 8080.

A client application will send traffic to only port 8080. But libcurl will occasionally send traffic to port 443.

If an attacker set up a web app on port 443, they will receive some traffic (0.5%) that was supposed to be sent to a different port.

The original report as published on HackerOne, by omdr. 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 bug in libcurl's connection handling where, under some network conditions such as a slow or failed server response, the connection falls back to the default HTTPS port instead of the port set by the application.

Impact

An attacker with access to the authorised server, such as a local admin, could run a service on port 443 and receive about 0.5% of traffic that was meant for port 8080, though the exact trigger conditions were not established.

What the attacker needed

Attacker has access to the authorised server; attacker runs a service on port 443; specific network conditions, not fully known

How it was found

  1. Set up round-robin DNS load balancing across several servers.
  2. Send many small HTTPS requests to port 8080.
  3. Have the server fail to handle a response; the exact conditions were not established.
  4. Observe that roughly 0.5% of traffic goes to port 443 instead.

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.

A program was told to send its data to one specific door (port 8080) on a server. Sometimes, without being asked, it knocked on a different door (port 443) instead. If someone else was listening at that other door, they could see data that was meant for the real service.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More from curl

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.