Skip to content

Add OSS-Fuzz harness for JSON tensor REST API parser - #4143

Open
rishuranjanofficial wants to merge 1 commit into
tensorflow:masterfrom
rishuranjanofficial:add/oss-fuzz-json-tensor-harness
Open

Add OSS-Fuzz harness for JSON tensor REST API parser#4143
rishuranjanofficial wants to merge 1 commit into
tensorflow:masterfrom
rishuranjanofficial:add/oss-fuzz-json-tensor-harness

Conversation

@rishuranjanofficial

@rishuranjanofficial rishuranjanofficial commented Aug 3, 2026

Copy link
Copy Markdown

Summary

This PR adds a libFuzzer fuzz harness targeting the JSON tensor parsing
layer in tensorflow_serving/util/json_tensor.cc, which processes
untrusted HTTP request bodies for the TF Serving REST API.

What's fuzzed

Endpoint Function
POST /v1/models/*:predict FillPredictRequestFromJson
POST /v1/models/*:classify FillClassificationRequestFromJson
POST /v1/models/*:regress FillRegressionRequestFromJson

Three tensor dtype variants are covered per endpoint (float, string/b64,
int64) to exercise different parsing branches including the base64 decode
path and the recursive shape inference path.

Security motivation

CVE-2025-0649 (uncontrolled recursion in GetDenseTensorShape and
FillTensorProto, CVSS 7.5 HIGH) was found in this exact code path.
The vulnerability allows an unauthenticated attacker to crash the
serving process with a single ~100 KB HTTP request.

Continuous fuzzing via OSS-Fuzz will:

  • Provide regression coverage ensuring CVE-2025-0649 class bugs are
    caught before they reach users
  • Surface any new memory corruption or logic errors in the JSON parser
  • Generate a maintained seed corpus for the REST API attack surface

Files changed

  • tensorflow_serving/util/json_tensor_fuzzer.cc — libFuzzer entry point
  • tensorflow_serving/util/BUILD — Bazel build target for the fuzzer

Related

Adds a libFuzzer harness covering the three HTTP REST API JSON parsing
entry points in json_tensor.cc:
  - FillPredictRequestFromJson  (/v1/models/*:predict)
  - FillClassificationRequestFromJson  (/v1/models/*:classify)
  - FillRegressionRequestFromJson  (/v1/models/*:regress)

CVE-2025-0649 (uncontrolled recursion, stack overflow DoS) was found
in this path. This harness enables continuous fuzzing via OSS-Fuzz
to catch future regressions.
@rishuranjanofficial

Copy link
Copy Markdown
Author

Happy to add a json_tensor_fuzzer_seed_corpus.zip with representative JSON payloads for each endpoint if that would help reviewers or the OSS-Fuzz integration. Let me know.

rishuranjanofficial added a commit to rishuranjanofficial/oss-fuzz that referenced this pull request Aug 3, 2026
Adds continuous fuzzing for the TensorFlow Serving JSON tensor parser,
which processes untrusted HTTP request bodies for the REST API
(/v1/models/:predict, :classify, :regress).

Fuzzer targets:
- FillPredictRequestFromJson (DT_FLOAT, DT_STRING, DT_INT64 inputs)
- FillClassificationRequestFromJson
- FillRegressionRequestFromJson

CVE-2025-0649 (uncontrolled recursion in GetDenseTensorShape / FillTensorProto)
was found in this exact code path. This harness provides regression coverage
and enables detection of future parser vulnerabilities.

Companion fix PR: tensorflow/serving#4143
@rishuranjanofficial

Copy link
Copy Markdown
Author

@rtg0795

I've submitted this pull request and would appreciate a review when you have some bandwidth. Please let me know if any changes or additional context are needed.

Thank you for your time and consideration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant