CVE-2024-52294: khoj has an IDOR in subscription management allows unauthorized subscription modifications
Summary An Insecure Direct Object Reference (IDOR) vulnerability in the updatesubscription 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.
Published Dec 30, 2024
Affected packages
khoj
- Ecosystem
- PyPI
- Affected
- < 1.29.0
- Fixed in
- 1.29.0
- Check
pip show khoj
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
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
- Create a customer account in stripe:
- Customer A:
[email protected](attacker)
- Log in as any user.
- Send this request:
PATCH /api/[email protected]&operation=cancel HTTP/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.
Credited to adventure8812, r0path.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More PyPI vulnerabilities
All PyPI entriesGHSA-62mm-xwmv-crhg
khoj has an unauthenticated path traversal in /home/ endpoint that allows file read from server filesystem
high8.7Sep 25, 2026CVE-2025-69207
Khoj has an IDOR in Notion OAuth Flow that Enables Index Poisoning
medium5.4No fixFeb 2, 2026CVE-2024-43396
Khoj Vulnerable to Stored Cross-site Scripting In Automate (Preview feature)
medium5.4Aug 20, 2024
