/

CVE-2026-35489

Severity:

HIGH RISK

(7.3)

Improper Access Control and Input Validation in Tandoor

CVE-2026-35489

Analyzed

Vulnerability type

Category:

Improper Access Control and Input Validation

CWE:

CWE-639, CWE-1284

Impact:

Cross-Tenant Data Leakage and Application Instability

Severity:

HIGH RISK

(7.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A flaw in the Tandoor Recipes /api/food/{id}/shopping/ endpoint allows unvalidated amount and unit fields from the request body to be passed directly into database object creation.

This can cause unhandled server errors with malformed input and, more critically, allows a unit identifier from another tenant "Space" to be associated with a shopping list entry, leaking cross-tenant foreign key references.

Affected context

The issue occurs in Tandoor Recipes instances that expose the /api/food/{id}/shopping/ POST endpoint and rely on multi-tenant separation using "Spaces."

In affected versions, this specific endpoint bypasses the usual serializer-based validation and sanitization used elsewhere for ShoppingListEntry creation, instead reading amount and unit directly from request.data.

In environments where multiple tenants share the same deployment, this can allow references to units belonging to a different Space to be attached to a user's shopping list, and malformed amounts can crash the endpoint.

Exploit preconditions

  • Attack surface: HTTP API endpoint POST /api/food/{id}/shopping/.
  • Required access: Ability to call the API for a valid food ID; typically authenticated as any user allowed to add items to a shopping list in a given Space.
  • Trigger point (invalid amount): Supplying a non-numeric string or otherwise invalid value in the amount field causes an unhandled exception when the ORM tries to persist it.
  • Trigger point (cross-space unit): Supplying a unit identifier that belongs to a different Space than the caller's current Space leads to a cross-tenant association of the foreign key.
  • Why exploitation is possible: The endpoint bypasses the ShoppingListEntrySerializer used elsewhere, so there is no type validation, range checking, or tenant-scope enforcement on these fields before object creation.

Why this happens

The underlying issue is a combination of missing object-level access control and inconsistent input validation for a single API endpoint.

Instead of consistently using the ShoppingListEntrySerializer, the endpoint directly reads amount and unit from request.data and passes them to ShoppingListEntry.objects.create() without verifying:

  • That amount adheres to the expected numeric type or domain.
  • That the unit foreign key belongs to the same Space as the requesting user or food item.

This matches CWE-639 (Authorization Bypass Through User-Controlled Key) because the client can select arbitrary foreign key IDs and have the system accept them, crossing tenant boundaries.

It also matches CWE-1284 (Improper Validation of Specified Quantity in Input) due to lack of robust validation for amount, resulting in unhandled exceptions and server errors.

Potential impact

  • Cross-tenant exposure of unit relationships, as shopping list entries in one Space can be linked to units from another.
  • Leakage of internal identifiers (IDs) across tenant boundaries, which can assist in further reconnaissance.
  • Inconsistent or corrupted domain data where entries point to logically invalid or unauthorized units.
  • Application instability and HTTP 500 errors when malformed amount values are submitted repeatedly.
  • Potential denial of service at the endpoint level if automated or malicious clients send large volumes of invalid amount values.

General mitigation guidance

Mitigation generally centers on enforcing consistent validation and strict tenant-aware access control for all object creation paths.

Useful patterns include:

  • Centralize validation: Ensure all endpoints that create ShoppingListEntry objects go through a common serializer or validation layer that enforces type checks, range limits, and required fields for amount and unit.
  • Enforce tenant scoping: When resolving foreign keys such as unit, always filter by the current Space or tenant context, rejecting IDs that cannot be found within that scope.
  • Fail safely on invalid quantities: Treat unparseable or out-of-range amount values as validation errors and return structured client errors (e.g., 4xx) instead of allowing unhandled exceptions.
  • Apply least privilege to identifiers: Never trust client-supplied IDs alone; always re-derive accessible objects from the authenticated user context and tenant membership.
  • Consistency across endpoints: Periodically audit API endpoints for bypasses of shared serializers or validation helpers, especially when new routes are added.

How teams detect issues like this

Organizations can detect this and similar issues through a mix of code-level and operational measures:

  • Static analysis and linters: Flag direct uses of request.data or request payloads passed into ORM create() calls without intermediate validation or serializer logic, especially for multi-tenant models.
  • Code review practices: During review, verify that every endpoint creating or updating ShoppingListEntry (or analogous entities) consistently uses serializers and enforces tenant scoping on foreign keys.
  • Access control checks: Establish patterns where any lookup by ID must also constrain by tenant/Space and have reviewers confirm this in pull requests.
  • Runtime monitoring: Monitor logs and metrics for repeated HTTP 500 errors from POST /api/food/{id}/shopping/ or similar endpoints, correlating them with invalid amount payloads or suspicious unit IDs.
  • Automated tests: Add multi-tenant unit tests that attempt to use objects from another Space and verify that the system rejects these operations.

Sources

SourceLink
github.comgithub.com/TandoorRecipes/recipes/releases/tag/2.6.4
github.comgithub.com/TandoorRecipes/recipes/security/advisories/GHSA-8w8h-3pv2-3554

Frequently asked

questions

Exploitability depends on how widely the /api/food/{id}/shopping/ endpoint is exposed and how many tenants share the same deployment. Any authenticated user who can add items to a shopping list can attempt to reference units from other Spaces or send malformed amount values.

Typically, no elevated privileges are needed beyond the ability to call the shopping list creation endpoint. However, they must already be able to authenticate or otherwise access the API in a way that the application recognizes them as a user within a Space.

Route all object creation through a shared serializer or validation layer that enforces type and range constraints for amount and strictly verifies that foreign keys like unit belong to the caller's Space. Treat validation failures as client errors and never rely on the database layer to surface them safely.

Establish coding standards that forbid direct use of request payloads in ORM operations, require tenant-scoped queries for all multi-tenant entities, and enforce these patterns through code review and static analysis. Complement this with multi-tenant test cases that attempt cross-space access to validate isolation guarantees.

Find out what's already
exploitable in your codebase.