🔍 CVE-2021-29521

2.5
CVSS Score
LOW
2021-05-14
2026-06-17 03:47
✅ 완료

🇰🇷 한글 설명

TensorFlow의 `tf.raw_ops.SparseCountSparseOutput` 함수에서 음수 밀집 형상(dense shape)을 지정할 경우 표준 라이브러리의 `std::vector` 불변성이 깨지면서 세그멘테이션 결함(Segmentation Fault)이 발생합니다. 이는 구현 과정에서 형상의 첫 번째 요소가 항상 양수라고 가정하고 데이터 구조를 초기화하기 때문에 발생하는 문제입니다.

💡 쉬운 설명

머신러닝 도구인 TensorFlow를 사용할 때 잘못된 숫자(음수)를 입력하면 프로그램이 갑자기 종료되는 오류가 발생할 수 있습니다. 이는 프로그램이 예상치 못한 값을 처리하지 못해 발생하는 현상입니다.

🇺🇸 원문 (English)

TensorFlow is an end-to-end open source platform for machine learning. Specifying a negative dense shape in `tf.raw_ops.SparseCountSparseOutput` results in a segmentation fault being thrown out from the standard library as `std::vector` invariants are broken. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/8f7b60ee8c0206a2c99802e3a4d1bb55d2bc0624/tensorflow/core/kernels/count_ops.cc#L199-L213) assumes the first element of the dense shape is always positive and uses it to initialize a `BatchedMap<T>` (i.e., `std::vector<absl::flat_hash_map<int64,T>>`(https://github.com/tensorflow/tensorflow/blob/8f7b60ee8c0206a2c99802e3a4d1bb55d2bc0624/tensorflow/core/kernels/count_ops.cc#L27)) data structure. If the `shape` tensor has more than one element, `num_batches` is the first value in `shape`. Ensuring that the `dense_shape` argument is a valid tensor shape (that is, all elements are non-negative) solves this issue. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2 and TensorFlow 2.3.3.

📍 영향받는 시스템

TensorFlow 2.5.0 미만 버전 (2.4.2, 2.3.3 포함)

⚔️ 공격 벡터

조작된 음수 값을 포함한 `dense_shape` 텐서를 `tf.raw_ops.SparseCountSparseOutput` 연산에 입력하여 서비스 거부(DoS) 유도

🛡️ 대응 방법

TensorFlow를 2.5.0 이상 버전으로 업데이트하거나, 입력되는 `dense_shape`의 모든 요소가 0 이상인지 검증하는 로직을 추가합니다.

🔧 검증 코드

출력된 버전이 2.5.0 미만인 경우 해당 취약점에 노출되어 있을 가능성이 높습니다.

Shell / Script
python3 -c 'import tensorflow as tf; print(tf.__version__)'

📊 CVSS Vector String

CVSS Vector
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L

💻 영향받는 소프트웨어

Azure Machine Learning