CVE-2022-36015: Tensorflow TensorFlow Vulnerable To Integer Overflow Vulnerability
LOWCVE-2022-36015 is a LOW tensorflow vulnerable to integer overflow vulnerability (CWE-190: Integer Overflow or Wraparound) affecting Tensorflow libraries in the PyPI ecosystem. The issue involves tensorflow vulnerable to integer overflow in math ops. Remediation is available by upgrading affected packages to version 2.7.2, 2.8.1, 2.9.1.
CVE-2022-36015 at a Glance
How to Fix CVE-2022-36015
To remediate this vulnerability, upgrade all affected Tensorflow dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install tensorflow>=2.7.2
pip install tensorflow>=2.8.1
pip install tensorflow>=2.9.1
pip install tensorflow-cpu>=2.7.2
pip install tensorflow-cpu>=2.8.1
pip install tensorflow-cpu>=2.9.1
pip install tensorflow-gpu>=2.7.2
pip install tensorflow-gpu>=2.8.1
pip install tensorflow-gpu>=2.9.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show tensorflow
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2022-36015, inspect your installed packages using pip:
pip show tensorflow
Analyze the terminal output to locate any version of Tensorflow in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.7.2), your application is affected.
Note: The pip show tensorflow command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-190: Integer Overflow or Wraparound, where the product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. this occurs when an integer value is incremented to a value that is too large to store in the associated representation. when this occurs, the value may become a very small or negative number. In Tensorflow, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2022-36015 Affected Tensorflow Versions
9 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
tensorflow
|
PyPI |
< 2.7.2
|
2.7.2
|
|
tensorflow
|
PyPI |
≥ 2.8.0
< 2.8.1
|
2.8.1
|
|
tensorflow
|
PyPI |
≥ 2.9.0
< 2.9.1
|
2.9.1
|
|
tensorflow-cpu
|
PyPI |
< 2.7.2
|
2.7.2
|
|
tensorflow-cpu
|
PyPI |
≥ 2.8.0
< 2.8.1
|
2.8.1
|
|
tensorflow-cpu
|
PyPI |
≥ 2.9.0
< 2.9.1
|
2.9.1
|
|
tensorflow-gpu
|
PyPI |
< 2.7.2
|
2.7.2
|
|
tensorflow-gpu
|
PyPI |
≥ 2.8.0
< 2.8.1
|
2.8.1
|
|
tensorflow-gpu
|
PyPI |
≥ 2.9.0
< 2.9.1
|
2.9.1
|
References
Frequently Asked Questions
What is CVE-2022-36015?
Which Tensorflow versions are affected?
What version fixes CVE-2022-36015?
Is tensorflow affected?
Is tensorflow-cpu affected?
What CWE is associated with CVE-2022-36015?
How can I check PyPI dependencies for CVE-2022-36015?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-rh87-q4vg-m45j",
"modified" : "2022-09-16T21:20:28Z",
"published" : "2022-09-16T21:20:28Z",
"aliases" : [ "CVE-2022-36015" ],
"summary" : "TensorFlow vulnerable to integer overflow in math ops",
"details" : "### Impact\nWhen [`RangeSize`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/ops/math_ops.cc) receives values that do not fit into an `int64_t`, it crashes.\n```cpp\n auto size = (std::is_integral<T>::value\n ? ((Eigen::numext::abs(limit - start) +\n Eigen::numext::abs(delta) - T(1)) /\n Eigen::numext::abs(delta))\n : (Eigen::numext::ceil(\n Eigen::numext::abs((limit - start) / delta))));\n\n // This check does not cover all cases.\n if (size > std::numeric_limits<int64_t>::max()) {\n return errors::InvalidArgument(\"Requires ((limit - start) / delta) <= \",\n std::numeric_limits<int64_t>::max());\n }\n\n c->set_output(0, c->Vector(static_cast<int64_t>(size)));\n return Status::OK();\n}\n```\n\n### Patches\nWe have patched the issue in GitHub commit [37e64539cd29fcfb814c4451152a60f5d107b0f0](https://github.com/tensorflow/tensorflow/commit/37e64539cd29fcfb814c4451152a60f5d107b0f0).\nThe fix will be included in TensorFlow 2.10.0. We will also cherrypick this commit on TensorFlow 2.9.1, TensorFlow 2.8.1, and TensorFlow 2.7.2, as these are also affected and still in supported range.\n\n\n### For more information\nPlease consult [our security guide](https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md) for more information regarding the security model and how to contact us with issues and questions.\n",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.7.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.8.0"
}, {
"fixed" : "2.8.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.9.0"
}, {
"fixed" : "2.9.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-cpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.7.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-cpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.8.0"
}, {
"fixed" : "2.8.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-cpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.9.0"
}, {
"fixed" : "2.9.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-gpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.7.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-gpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.8.0"
}, {
"fixed" : "2.8.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-gpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.9.0"
}, {
"fixed" : "2.9.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/tensorflow/tensorflow/security/advisories/GHSA-rh87-q4vg-m45j"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-36015"
}, {
"type" : "WEB",
"url" : "https://github.com/tensorflow/tensorflow/commit/37e64539cd29fcfb814c4451152a60f5d107b0f0"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/tensorflow/tensorflow"
}, {
"type" : "WEB",
"url" : "https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/ops/math_ops.cc"
}, {
"type" : "WEB",
"url" : "https://github.com/tensorflow/tensorflow/releases/tag/v2.10.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-190" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2022-09-16T21:20:28Z",
"nvd_published_at" : "2022-09-16T23:15:00Z"
}
}