Vulnerability PYSEC-2026-1493

Medium Risk
MEDIUM RISK
CVSS Score: 4.3
Score Range: 4.0–6.9
Medium severity vulnerabilities (CVSS 4.0–6.9). Important issues that meaningfully reduce security confidence.
2 months ago
July 07, 2026 at 02:34 PM UTC
khoj has an IDOR in subscription management allows unauthorized subscription modifications
1.0 - 1.28.4.dev94
1.0 - 1.28.4.dev94

Summary

khoj has an IDOR in subscription management allows unauthorized subscription modifications

Details

Summary

An Insecure Direct Object Reference (IDOR) vulnerability in the update_subscription endpoint allows any authenticated user to manipulate other users' Stripe subscriptions by simply modifying the email parameter in the request.

Details

The vulnerability exists in the subscription endpoint at /api/subscription. The endpoint uses an email parameter as a direct reference to user subscriptions without verifying object ownership. While authentication is required, there is no authorization check to verify if the authenticated user owns the referenced subscription.

Vulnerable code in /api/subscription:

@subscription_router.patch("")
@requires(["authenticated"])
async def update_subscription(request: Request, email: str, operation: str):
    # IDOR: email parameter directly references user subscriptions without ownership verification
    customers = stripe.Customer.list(email=email).auto_paging_iter()
    customer = next(customers, None)
    
    if operation == "cancel":
        # Any authenticated user can modify any subscription referenced by email
        customer_id = customer.id
        for subscription in stripe.Subscription.list(customer=customer_id):
            stripe.Subscription.modify(subscription.id, cancel_at_period_end=True)

PoC

  1. Create a customer account in stripe:

  2. Log in as any user.

  3. Send this request:

PATCH /api/[email protected]&operation=cancel HTTP/1.1
  1. The subscription for Customer A is successfully set to cancel.

Impact

High: Revenue loss via mass cancellation of subscriptions. Loss of customer trust by re-enabling subscriptions they had set to cancel.

Resolution

This was fixed in the following commit which limited subscription update operations to the authenticated user: https://github.com/khoj-ai/khoj/commit/47d3c8c23597900af708bdc60aced3ae5d2064c1. Support for arbitrarily presenting an email for update has been deprecated.

Impacted packages

Timeline

Published
2 months ago
July 07, 2026 at 02:34 PM UTC
Fixed (1.29.0)
1 year ago
November 12, 2024 at 05:54 AM UTC
Last Modified
2 months ago
July 07, 2026 at 05:46 PM UTC