Skip to content
Info disclosure Disclosed report Intermediate CVE-2024-6874

curl: stack-buffer overread during punycode conversions

When converting a domain name to or from punycode using libcurl's URL API with the macidn backend, a name of exactly 256 bytes causes the conversion function to fill the buffer without null-terminating it, leading to an out-of-bounds read of stack memory. This can cause adjacent stack contents, potentially including pointer values, to be returned as part of the converted string.

z2_ Follow

Originally disclosed on HackerOne

  • Triaged in 31 hours
  • Fixed in 30 days
  • Paid in 30 days
  • Disclosed after 2 months

Summary by the program

libcurl's URL API function curl_url_get() offers punycode conversions, to and from IDN. Asking to convert a name that is exactly 256 bytes, libcurl ends up reading outside of a stack based buffer when built to use the macidn IDN backend. The conversion function then fills up the provided buffer exactly - but does not null terminate the string.

This flaw can lead to stack contents accidentally getting returned as part of the converted string.

Full advisory: https://curl.se/docs/CVE-2024-6874.html

The report

Hello, I would like to report a vulnerability here, initially reported by me to the curl project.

HackerOne report: https://hackerone.com/reports/2604391 CVE: CVE-2024-6874 Advisory: https://curl.se/docs/CVE-2024-6874.html Severity: Low

Impact

When converting the domain name of a URL from/to punycode with libcurl's URL API, libcurl reads past the bounds of a stack-buffer and includes adjacent stack-memory in the conversion result. This potentially leaks pointer values.

The original report as published on HackerOne, by z2_. 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

The macidn conversion function fills the provided buffer exactly but does not null-terminate the string, so subsequent string operations read past the buffer.

Impact

This could leak pointer values from adjacent stack memory as part of the converted string.

What the attacker needed

Libcurl built with macidn backend; use of curl_url_get() for punycode conversion; domain name exactly 256 bytes

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 buffer is a fixed-size area of memory used to hold text. When a name is exactly as long as the buffer, the code that fills it forgets to add the special zero byte that marks the end of a string. Later, when the program reads the string, it keeps going past the buffer and picks up whatever happens to be next in memory, which can be secret data like memory addresses.

What is Info disclosure?

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

More by z2_

View all

11 more disclosed reports, best first.

More from Internet Bug Bounty

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.