Medium

khoj has an IDOR in subscription management allows unauthorized subscription modifications

  • Disclosed: 30.12.2024
  • Updated: 11.10.2026 15:17

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:

python
@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:

    • Customer A: adventure8812@zeropath.com (attacker)
  2. Log in as any user.

  3. Send this request:

http
PATCH /api/subscription?email=adventure8812@zeropath.com&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.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Python (PyPI) khoj < 1.29.0 1.29.0

References

CVSS score 4.3/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N
Weakness (CWE)
CWE-639
Platform
Python (PyPI)
Package
khoj
Disclosed
30.12.2024
Updated
11.10.2026 15:17

Sources and licenses

OSV / GitHub Advisory Database - PYSEC-2026-1493 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-hq4h-w933-jm6c - CC BY 4.0

Vulnerability history: khoj

All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.

Total entries
4
First → latest
08.2024 09.2026
Without a fix
1
Exploited in attacks
0

Severity breakdown

  • High 1
  • Medium 3

Disclosures per year

  1. 2024: 2
  2. 2025: 0
  3. 2026: 2
  1. High ghsa-62mm-xwmv-crhg >= 2.0.0-beta.23, < 2.0.0-beta.25 2.0.0-beta.25
  2. Medium · 5.4 CVE-2025-69207 <= 2.0.0b25.dev3 no fix
  3. khoj has an IDOR in subscription management allows unauthorized subscription modifications this entry
    Medium · 4.3 CVE-2024-52294 < 1.29.0 1.29.0

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.