VYPR
Moderate severityNVD Advisory· Published Nov 5, 2021· Updated Aug 4, 2024

A use of uninitialized value vulnerability in Tensorflow

CVE-2021-41225

Description

TensorFlow is an open source platform for machine learning. In affected versions TensorFlow's Grappler optimizer has a use of unitialized variable. If the train_nodes vector (obtained from the saved model that gets optimized) does not contain a Dequeue node, then dequeue_node is left unitialized. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
tensorflowPyPI
>= 2.6.0, < 2.6.12.6.1
tensorflowPyPI
>= 2.5.0, < 2.5.22.5.2
tensorflowPyPI
< 2.4.42.4.4
tensorflow-cpuPyPI
>= 2.6.0, < 2.6.12.6.1
tensorflow-cpuPyPI
>= 2.5.0, < 2.5.22.5.2
tensorflow-cpuPyPI
< 2.4.42.4.4
tensorflow-gpuPyPI
>= 2.6.0, < 2.6.12.6.1
tensorflow-gpuPyPI
>= 2.5.0, < 2.5.22.5.2
tensorflow-gpuPyPI
< 2.4.42.4.4

Affected products

1

Patches

1
68867bf01239

Prevent unitialized variable use in grappler.

https://github.com/tensorflow/tensorflowMihai MaruseacSep 29, 2021via ghsa
2 files changed · +25 1
  • tensorflow/core/grappler/optimizers/auto_parallel.cc+1 1 modified
    @@ -152,7 +152,7 @@ Status AutoParallel::Initialize(const GrapplerItem& item) {
       TF_RETURN_IF_ERROR(ComputeTransitiveFanin(graph_, item.fetch, &train_nodes));
       LOG(INFO) << "Number of training nodes: " << train_nodes.size();
     
    -  const NodeDef* dequeue_node;
    +  const NodeDef* dequeue_node = nullptr;
       for (const auto& train_node : train_nodes) {
         if (IsDequeueOp(*train_node)) {
           dequeue_node = train_node;
    
  • tensorflow/core/grappler/optimizers/auto_parallel_test.cc+24 0 modified
    @@ -126,6 +126,30 @@ TEST_F(AutoParallelTest, SimpleParallel) {
       EXPECT_EQ("^AutoParallel-Control-Fetch", node_gradient.input(0));
     }
     
    +TEST_F(AutoParallelTest, SimpleParallelNoDequeue) {
    +  tensorflow::Scope s = tensorflow::Scope::DisabledShapeInferenceScope();
    +  Output constant_a = ops::Const(s.WithOpName("constant_a"), 1.0f, {1});
    +  Output constant_c = ops::Const(s.WithOpName("constant_c"), 1.0f, {1});
    +  Output constant_b = ops::Const(s.WithOpName("constant_b"), 1, {1});
    +  Output var = ops::Variable(s.WithOpName("var"), {1}, DT_FLOAT);
    +  Output assign = ops::Assign(s.WithOpName("assign"), {var}, {constant_a});
    +  Output add = ops::AddN(s.WithOpName("add"), {constant_a, constant_c});
    +  Output learning_rate = ops::Const(s.WithOpName("learning_rate"), 0.01f, {1});
    +  Output apply_gradient = ops::ApplyGradientDescent(
    +      s.WithOpName("apply_gradient"), {var}, {learning_rate}, {add});
    +
    +  GrapplerItem item;
    +  item.init_ops.push_back("assign");
    +  item.fetch.push_back("apply_gradient");
    +  item.init_ops.push_back("assign");
    +  TF_CHECK_OK(s.ToGraphDef(&item.graph));
    +
    +  AutoParallel parallel(2);
    +  GraphDef output;
    +  Status status = parallel.Optimize(nullptr, item, &output);
    +  TF_EXPECT_OK(status);
    +}
    +
     }  // namespace
     }  // namespace grappler
     }  // namespace tensorflow
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

7

News mentions

0

No linked articles in our index yet.