Skip to content

TensorFlow vulnerable to heap out of bounds read in filesystem glob matching

Critical severity GitHub Reviewed Published Dec 9, 2020 in tensorflow/tensorflow • Updated Apr 9, 2024

Package

pip tensorflow (pip)

Affected versions

>= 2.4.0rc0, < 2.4.0

Patched versions

2.4.0
pip tensorflow-cpu (pip)
>= 2.4.0rc0, < 2.4.0
2.4.0
pip tensorflow-gpu (pip)
>= 2.4.0rc0, < 2.4.0
2.4.0

Description

Impact

The general implementation for matching filesystem paths to globbing pattern is vulnerable to an access out of bounds of the array holding the directories:

if (!fs->Match(child_path, dirs[dir_index])) { ... }

Since dir_index is unconditionaly incremented outside of the lambda function where the vulnerable pattern occurs, this results in an access out of bounds issue under certain scenarios. For example, if /tmp/x is a directory that only contains a single file y, then the following scenario will cause a crash due to the out of bounds read:

>>> tf.io.gfile.glob('/tmp/x/')
Segmentation fault

There are multiple invariants and preconditions that are assumed by the parallel implementation of GetMatchingPaths but are not verified by the PRs introducing it (#40861 and #44310). Thus, we are completely rewriting the implementation to fully specify and validate these.

Patches

We have patched the issue in GitHub commit 8b5b9dc96666a3a5d27fad7179ff215e3b74b67c and will release TensorFlow 2.4.0 containing the patch. TensorFlow nightly packages after this commit will also have the issue resolved.

This issue only impacts master branch and the release candidates for TF version 2.4. The final release of the 2.4 release will be patched.

For more information

Please consult our security guide for more information regarding the security model and how to contact us with issues and questions.

Attribution

This vulnerability has been reported by members of the Aivul Team from Qihoo 360.

References

@mihaimaruseac mihaimaruseac published to tensorflow/tensorflow Dec 9, 2020
Published by the National Vulnerability Database Dec 10, 2020
Published to the GitHub Advisory Database Oct 7, 2022
Reviewed Oct 7, 2022
Last updated Apr 9, 2024

Severity

Critical

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H

EPSS score

0.093%
(40th percentile)

Weaknesses

CVE ID

CVE-2020-26269

GHSA ID

GHSA-9jjw-hf72-3mxw

Source code

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.