Heap-based Buffer Overflow Affecting gpac4ios package, versions >=0.0.0


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.22% (62nd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-COCOAPODS-GPAC4IOS-1567335
  • published19 Aug 2021
  • disclosed19 Aug 2021
  • creditCisco Talos

Introduced: 19 Aug 2021

CVE-2021-21838  (opens in a new tab)
CWE-122  (opens in a new tab)

How to fix?

There is no fixed version for GPAC4iOS.

Overview

GPAC4iOS is a GPAC4iOS is the libgpac library packaged for iOS as a Pod. It is preconfigured and tested to do a single task: create a MP4 file from a raw H.264 and an audio track.

Affected versions of this package are vulnerable to Heap-based Buffer Overflow. In order to parse an atom with the "fpar" FOURCC code, the following function is used. After reading a few fields from the beginning of the atom, at line 25 the library will read 32-bits from the input if the “version” field is set to a value other than 0. Due to it being verified against a 64-bit size, the check is insufficient. Afterwards at line 26, the library will use the GF_SAFE_ALLOC_N macro to multiply the number of entries with the size of the FilePartitionEntry type. This multiplication can result in an integer overflow which can result in an undersized buffer being made. Later at line 27, the library will read integers from the input directly into this undersized buffer. This will eventually write outside the bounds of the allocation, resulting in a heap-based buffer overflow.

CVSS Scores

version 3.1