GHSA-gjqc-q9g6-q2j3 BIT-tensorflow-2022-23583 CVE-2022-23583 PYSEC-2022-147 PYSEC-2022-92 PYSEC-2026-3191
`CHECK`-failures in binary ops in Tensorflow
- Severity
- 6.5 / 10
- Medium · CVSS 3.1
- Exploit chance (EPSS)
- 0.88%
- Chance of exploitation in the next 30 days. Higher than 59.08% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-617 Reachable Assertion
- CWE-843 Access of Resource Using Incompatible Type ('Type Confusion')
- Fix
- Available
- 3 packages have a fixed version
Description
Impact
A malicious user can cause a denial of service by altering a SavedModel such that any binary op would trigger CHECK failures. This occurs when the protobuf part corresponding to the tensor arguments is modified such that the dtype no longer matches the dtype expected by the op. In that case, calling the templated binary operator for the binary op would receive corrupted data, due to the type confusion involved:
functor::BinaryFunctor<Device, Functor, 1>()(
eigen_device, out->template flat<Tout>(),
input_0.template flat<Tin>(), input_1.template flat<Tin>(),
error_ptr);
If Tin and Tout don't match the type of data in out and input_* tensors then flat<*> would interpret it wrongly. In most cases, this would be a silent failure, but we have noticed scenarios where this results in a CHECK crash, hence a denial of service.
Patches
We have patched the issue in GitHub commit a7c02f1a9bbc35473969618a09ee5f9f5d3e52d9. The fix will be included in TensorFlow 2.8.0. We will also cherrypick this commit on TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, as these are also affected and still in supported range.
For more information
Please consult our security guide for more information regarding the security model and how to contact us with issues and questions.
Affected versions
PyPI
| Package | Vulnerable | Fixed in |
|---|---|---|
| tensorflow | < 2.5.3 |
2.5.3 |
| tensorflow | >= 2.6.0, < 2.6.3 |
2.6.3 |
| tensorflow | >= 2.7.0, < 2.7.1 |
2.7.1 |
| tensorflow | < 2.5.3>= 2.6.0, < 2.6.3>= 2.7.0, < 2.7.1 |
2.5.32.6.32.7.1 |
| tensorflow-cpu | < 2.5.3 |
2.5.3 |
| tensorflow-cpu | >= 2.6.0, < 2.6.3 |
2.6.3 |
| tensorflow-cpu | >= 2.7.0, < 2.7.1 |
2.7.1 |
| tensorflow-cpu | < 2.5.3>= 2.6.0, < 2.6.3 |
2.5.32.6.3 |
| tensorflow-gpu | < 2.5.3 |
2.5.3 |
| tensorflow-gpu | >= 2.6.0, < 2.6.3 |
2.6.3 |
| tensorflow-gpu | >= 2.7.0, < 2.7.1 |
2.7.1 |
| tensorflow-gpu | < 2.5.3>= 2.6.0, < 2.6.3 |
2.5.32.6.3 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
tensorflow PyPI → 2.5.3
- pip
pip install --upgrade "tensorflow>=2.5.3"- poetry
poetry add "tensorflow>=2.5.3"- uv
uv add "tensorflow>=2.5.3"
tensorflow-cpu PyPI → 2.5.3
- pip
pip install --upgrade "tensorflow-cpu>=2.5.3"- poetry
poetry add "tensorflow-cpu>=2.5.3"- uv
uv add "tensorflow-cpu>=2.5.3"
tensorflow-gpu PyPI → 2.5.3
- pip
pip install --upgrade "tensorflow-gpu>=2.5.3"- poetry
poetry add "tensorflow-gpu>=2.5.3"- uv
uv add "tensorflow-gpu>=2.5.3"
Severity breakdown
CVSS 3.1 6.5
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- Low
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- None
- Integrity
- None
- Availability
- High
Weakness
CWE-617: Reachable Assertion
The product contains an assert() or similar statement that can be triggered by an attacker, which leads to an application exit or other behavior that is more severe than necessary.
How to prevent it
- Implementation: Make sensitive open/close operation non reachable by directly user-controlled data (e.g. open/close resources)
- Implementation: Perform input validation on user data.
CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')
The product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type.
References
Advisories
Packages
Other links
- github.com/tensorflow/tensorflow/security/advisories/GHSA-gjqc-q9g6-q2j3
- github.com/tensorflow/tensorflow/commit/a7c02f1a9bbc35473969618a09ee5f9f5d3e52d9
- github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2022-92.…
- github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2022-147…
- github.com/tensorflow/tensorflow
- github.com/tensorflow/tensorflow/blob/a1320ec1eac186da1d03f033109191f715b2b130/…
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-gjh7-xx4r-x345 TensorFlow has segfault in array_ops.upper_bound | High | Also affects tensorflow |
| GHSA-fxgc-95xx-grvq TensorFlow Denial of Service vulnerability | Medium | Also affects tensorflow |
| GHSA-93vr-9q9m-pj8p TensorFlow vulnerable to Out-of-Bounds Read in DynamicStitch | High | Also affects tensorflow |
| GHSA-qjqc-vqcf-5qvj TensorFlow vulnerable to seg fault in `tf.raw_ops.Print` | High | Also affects tensorflow |
| GHSA-7jvm-xxmr-v5cw TensorFlow vulnerable to integer overflow in EditDistance | High | Also affects tensorflow |
| GHSA-64jg-wjww-7c5w TensorFlow has Null Pointer Error in TensorArrayConcatV2 | High | Also affects tensorflow |
| GHSA-6hg6-5c2q-7rcr TensorFlow has Heap-buffer-overflow in AvgPoolGrad | High | Also affects tensorflow |
| GHSA-558h-mq8x-7q9g TensorFlow has Null Pointer Error in SparseSparseMaximum | High | Also affects tensorflow |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor