{"id":"CVE-2024-52294","aliases":["GHSA-hq4h-w933-jm6c","PYSEC-2026-1493"],"title":"khoj has an IDOR in subscription management allows unauthorized subscription modifications","summary":"khoj has an IDOR in subscription management allows unauthorized subscription modifications","severity":"medium","cvss":4.3,"cvssVector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N","vendor":"khoj","product":"khoj","ecosystem":"pip","affected":["khoj < 1.29.0"],"patched":["khoj 1.29.0"],"published":"2024-12-30","updated":"2026-09-10","sourceUpdated":"2026-09-10T03:50:21.586447902Z","source":"OSV","sourceUrl":"https://osv.dev/vulnerability/GHSA-hq4h-w933-jm6c","references":[{"url":"https://github.com/khoj-ai/khoj/security/advisories/GHSA-hq4h-w933-jm6c"},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-52294"},{"url":"https://github.com/khoj-ai/khoj/commit/47d3c8c23597900af708bdc60aced3ae5d2064c1"},{"url":"https://github.com/khoj-ai/khoj"}],"tags":["osv","pip"],"epss":0.00381,"epssPercentile":0.31861,"ingestedAt":"2026-07-08T18:25:50.302Z","slug":"CVE-2024-52294","body":"## Overview\n\n### Summary\nAn 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.\n\n### Details\nThe 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.\n\nVulnerable code in `/api/subscription`:\n```python\n@subscription_router.patch(\"\")\n@requires([\"authenticated\"])\nasync def update_subscription(request: Request, email: str, operation: str):\n    # IDOR: email parameter directly references user subscriptions without ownership verification\n    customers = stripe.Customer.list(email=email).auto_paging_iter()\n    customer = next(customers, None)\n    \n    if operation == \"cancel\":\n        # Any authenticated user can modify any subscription referenced by email\n        customer_id = customer.id\n        for subscription in stripe.Subscription.list(customer=customer_id):\n            stripe.Subscription.modify(subscription.id, cancel_at_period_end=True)\n```\n\n### PoC\n1. Create a customer account in stripe:\n   - Customer A: `adventure8812@zeropath.com` (attacker)\n\n2. Log in as any user.\n\n3. Send this request:\n```http\nPATCH /api/subscription?email=adventure8812@zeropath.com&operation=cancel HTTP/1.1\n```\n\n4. The subscription for Customer A is successfully set to cancel.\n\n### Impact\nHigh:\nRevenue loss via mass cancellation of subscriptions.\nLoss of customer trust by re-enabling subscriptions they had set to cancel.\n\n### Resolution\n\nThis 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.\n\n\n## Affected packages\n\n- `khoj < 1.29.0`\n\n## Remediation\n\nUpgrade to a patched release:\n\n- `khoj 1.29.0`","depth":"sunlit","depthScore":24,"depthScoreParts":{"impact":23.7,"likelihood":0.1,"exploitation":0,"ransomware":0},"changes":[]}