LibTomCrypt up to 1.18.2 UTF-8 der_decode_utf8_string.c der_decode_utf8_string out-of-bounds

CVSS Meta Temp Score
CVSS is a standardized scoring system to determine possibilities of attacks. The Temp Score considers temporal factors like disclosure, exploit and countermeasures. The unique Meta Score calculates the average score of different sources to provide a normalized scoring system.
Current Exploit Price (≈)
Our analysts are monitoring exploit markets and are in contact with vulnerability brokers. The range indicates the observed or calculated exploit price to be seen on exploit markets. A good indicator to understand the monetary effort required for and the popularity of an attack.
CTI Interest Score
Our Cyber Threat Intelligence team is monitoring different web sites, mailing lists, exploit markets and social media networks. The CTI Interest Score identifies the interest of attackers and the security community for this specific vulnerability in real-time. A high score indicates an elevated risk to be targeted for this vulnerability.
7.8$0-$5k0.00

A vulnerability, which was classified as critical, was found in LibTomCrypt up to 1.18.2. This affects the function der_decode_utf8_string of the file der_decode_utf8_string.c of the component UTF-8 Handler. The manipulation with an unknown input leads to a out-of-bounds vulnerability. CWE is classifying the issue as CWE-125. The product reads data past the end, or before the beginning, of the intended buffer. This is going to have an impact on confidentiality, integrity, and availability. The summary by CVE is:

In LibTomCrypt through 1.18.2, the der_decode_utf8_string function (in der_decode_utf8_string.c) does not properly detect certain invalid UTF-8 sequences. This allows context-dependent attackers to cause a denial of service (out-of-bounds read and crash) or read information from other memory locations via carefully crafted DER-encoded data.

The weakness was published 10/03/2019 by Luigi Coniglio (werew) as confirmed bug report (GitHub Repository). It is possible to read the advisory at github.com. This vulnerability is uniquely identified as CVE-2019-17362 since 10/09/2019. It is possible to initiate the attack remotely. No form of authentication is needed for exploitation. Technical details and a public exploit are known. The reason for this vulnerability is this part of code:

/* proceed to decode */
for (y = 0; x < inlen; ) {
  /* get first byte */
  tmp = in[x++];

  /* count number of bytes */
  for (z = 0; (tmp & 0x80) && (z <= 4); z++, tmp = (tmp << 1) & 0xFF);

  if (z > 4 || (x + (z - 1) > inlen)) {
	 return CRYPT_INVALID_PACKET;
  }

  /* decode, grab upper bits */
  tmp >>= z;

  /* grab remaining bytes */
  if (z > 1) { --z; }
  while (z-- != 0) {
	 if ((in[x] & 0xC0) != 0x80) {
		return CRYPT_INVALID_PACKET;
	 }
	 tmp = (tmp << 6) | ((wchar_t)in[x++] & 0x3F);
  }

  if (y < *outlen) {
	 out[y] = tmp;
  }
  y++;
}

A public exploit has been developed by Luigi Coniglio (werew) and been published immediately after the advisory. The exploit is shared for download at github.com. It is declared as proof-of-concept. The code used by the exploit is:

char *poc1 = "\x30\x04"                  // Start DER-sequence of length 4
             "\x0c\x02\xbf\xbf"          // Start UTF8 string of actual length 2 and evaluated length 3
             "\xaa"                      // One byte padding
             "\x30\x84\xff\xff\xff\xff"; // Start DER-sequence of length 0xffffffff (will very likely cause a crash)

Applying a patch is able to eliminate this problem. The bugfix is ready for download at github.com.

Similar entries are available at VDB-77059, VDB-77060, VDB-82792 and VDB-118970.

Productinfo

Name

Version

CPE 2.3info

CPE 2.2info

CVSSv4info

VulDB CVSS-B Score: 🔍
VulDB CVSS-BT Score: 🔍
VulDB Vector: 🔍
VulDB Reliability: 🔍

CVSSv3info

VulDB Meta Base Score: 8.2
VulDB Meta Temp Score: 7.8

VulDB Base Score: 7.3
VulDB Temp Score: 6.6
VulDB Vector: 🔍
VulDB Reliability: 🔍

NVD Base Score: 9.1
NVD Vector: 🔍

CVSSv2info

AVACAuCIA
💳💳💳💳💳💳
💳💳💳💳💳💳
💳💳💳💳💳💳
VectorComplexityAuthenticationConfidentialityIntegrityAvailability
unlockunlockunlockunlockunlockunlock
unlockunlockunlockunlockunlockunlock
unlockunlockunlockunlockunlockunlock

VulDB Base Score: 🔍
VulDB Temp Score: 🔍
VulDB Reliability: 🔍

NVD Base Score: 🔍

Exploitinginfo

Class: Out-of-bounds
CWE: CWE-125 / CWE-119
CAPEC: 🔍
ATT&CK: 🔍

Local: No
Remote: Yes

Availability: 🔍
Access: Public
Status: Proof-of-Concept
Author: Luigi Coniglio (werew)
Download: 🔍

EPSS Score: 🔍
EPSS Percentile: 🔍

Price Prediction: 🔍
Current Price Estimation: 🔍

0-Dayunlockunlockunlockunlock
Todayunlockunlockunlockunlock

Threat Intelligenceinfo

Interest: 🔍
Active Actors: 🔍
Active APT Groups: 🔍

Countermeasuresinfo

Recommended: Patch
Status: 🔍

0-Day Time: 🔍
Exploit Delay Time: 🔍

Patch: github.com

Timelineinfo

10/03/2019 🔍
10/03/2019 +0 days 🔍
10/08/2019 +5 days 🔍
10/09/2019 +1 days 🔍
01/03/2024 +1547 days 🔍

Sourcesinfo

Advisory: 507
Researcher: Luigi Coniglio (werew)
Status: Confirmed

CVE: CVE-2019-17362 (🔍)
scip Labs: https://www.scip.ch/en/?labs.20161013
See also: 🔍

Entryinfo

Created: 10/08/2019 15:47
Updated: 01/03/2024 19:06
Changes: 10/08/2019 15:47 (66), 10/09/2019 13:55 (2), 09/28/2020 06:41 (1), 01/03/2024 18:59 (4), 01/03/2024 19:06 (1)
Complete: 🔍
Submitter: werew
Committer: werew
Cache ID: 3:5E6:103

Submitinfo

Accepted

  • Submit #92: Out-of-bounds read in LibTomCrypt 1.18.2 and earlier versions (by werew)

Discussion

No comments yet. Languages: en.

Please log in to comment.

Are you interested in using VulDB?

Download the whitepaper to learn more about our service!