Skip to content
DoS Disclosed report Intermediate CVE-2016-6308CVE-2016-6307

Excessive allocation of memory in dtls1_preprocess_fragment() (CVE-2016-6308)

A logic flaw in OpenSSL 1.1.0 DTLS handling caused memory to be allocated for a message before checking its declared length, allowing an attacker to force up to 21 MB of allocation per connection. This could lead to a denial of service through memory exhaustion, though the impact is limited because the connection fails and memory is freed if the application calls SSL_free promptly.

theyarestone Follow

Originally disclosed on HackerOne

  • Fixed in 36 days
  • Paid in 36 days
  • Disclosed after 37 days

Summary by the program

This issue is very similar to CVE-2016-6307. The underlying defect is different but the security analysis and impacts are the same except that it impacts DTLS.

A DTLS message includes 3 bytes for its length in the header for the message.

This would allow for messages up to 16Mb in length. Messages of this length are excessive and OpenSSL includes a check to ensure that a peer is sending reasonably sized messages in order to avoid too much memory being consumed to service a connection. A flaw in the logic of version 1.1.0 means that memory for the message is allocated too early, prior to the excessive message length check. Due to way memory is allocated in OpenSSL this could mean an attacker could force up to 21Mb to be allocated to service a connection. This could lead to a Denial of Service through memory exhaustion. However, the excessive message length check still takes place, and this would cause the connection to immediately fail. Assuming that the application calls SSL_free() on the failed conneciton in a timely manner then the 21Mb of allocated memory will then be immediately freed again. Therefore the excessive memory allocation will be transitory in nature. This then means that there is only a security impact if:

  1. The application does not call SSL_free() in a timely manner in the event that the connection fails

or 2) The application is working in a constrained environment where there is very little free memory

or 3) The attacker initiates multiple connection attempts such that there are multiple connections in a state where memory has been allocated for the connection; SSL_free() has not yet been called; and there is insufficient memory to service the multiple requests.

Except in the instance of (1) above any Denial Of Service is likely to be transitory because as soon as the connection fails the memory is subsequently freed again in the SSL_free() call. However there is an increased risk during this period of application crashes due to the lack of memory - which would then mean a more serious Denial of Service.

This issue does not affect TLS users.

OpenSSL 1.1.0 DTLS users should upgrade to 1.1.0a

This issue was reported to OpenSSL on 18th September 2016 by Shi Lei (Gear Team, Qihoo 360 Inc.). The fix was developed by Matt Caswell of the OpenSSL development team.

The report

This issue is very similar to CVE-2016-6307. The underlying defect is different but the security analysis and impacts are the same except that it impacts DTLS.

A DTLS message includes 3 bytes for its length in the header for the message. This would allow for messages up to 16Mb in length. Messages of this length are excessive and OpenSSL includes a check to ensure that a peer is sending reasonably sized messages in order to avoid too much memory being consumed to service a connection. A flaw in the logic of version 1.1.0 means that memory for the message is allocated too early, prior to the excessive message length check. Due to way memory is allocated in OpenSSL this could mean an attacker could force up to 21Mb to be allocated to service a connection. This could lead to a Denial of Service through memory exhaustion. However, the excessive message length check still takes place, and this would cause the connection to immediately fail. Assuming that the application calls SSL_free() on the failed conneciton in a timely manner then the 21Mb of allocated memory will then be immediately freed again. Therefore the excessive memory allocation will be transitory in nature. This then means that there is only a security impact if:

  1. The application does not call SSL_free() in a timely manner in the

event that the connection fails or 2) The application is working in a constrained environment where there

is very little free memory or 3) The attacker initiates multiple connection attempts such that there

are multiple connections in a state where memory has been allocated for the connection; SSL_free() has not yet been called; and there is insufficient memory to service the multiple requests.

Except in the instance of (1) above any Denial Of Service is likely to be transitory because as soon as the connection fails the memory is subsequently freed again in the SSL_free() call. However there is an increased risk during this period of application crashes due to the lack of memory - which would then mean a more serious Denial of Service.

This issue does not affect TLS users.

refer: https://www.openssl.org/news/secadv/20160922.txt

The original report as published on HackerOne, by theyarestone. 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 the code allocated memory for a DTLS message based on its declared length before validating that the length was within acceptable limits.

Impact

An attacker could cause a denial of service through memory exhaustion, but the impact is limited because the connection fails immediately and the memory is freed if the application calls SSL_free in a timely manner; the issue does not affect TLS users.

What the attacker needed

OpenSSL 1.1.0 with DTLS; Application does not call SSL_free promptly or is…; Attacker can send DTLS messages

The fix

The issue was fixed in OpenSSL 1.1.0a; users should upgrade.

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.

DTLS is a version of TLS (the encryption behind HTTPS) that runs over UDP instead of TCP. OpenSSL is a widely used library that implements TLS and DTLS. In this bug, OpenSSL reserved memory for an incoming message before checking whether the message's claimed size was reasonable, so an attacker could make the server allocate a large amount of memory just by sending a specially crafted message. This could exhaust memory and cause a denial of service, but only under certain conditions such as the application not freeing the connection quickly.

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 by theyarestone

View all

7 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.

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.