GHSA-564j-v29w-rqr6: Khoj Open Redirect Vulnerability in Login Page
Summary An attacker can use the next parameter on the login page to redirect a victim to a malicious page, while masking this using a legit-looking app.khoj.dev url. For example, https://app.khoj.dev/login?next=//example.com will redirect to the https://example.com page.
Published Jul 8, 2024 · Updated Aug 7, 2024
Affected packages
khoj-assistant
- Ecosystem
- PyPI
- Affected
- < 1.14.0
- Fixed in
- 1.14.0
- Check
pip show khoj-assistant
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
An attacker can use the next parameter on the login page to redirect a victim to a malicious page, while masking this using a legit-looking app.khoj.dev url. For example, https://app.khoj.dev/login?next=//example.com will redirect to the https://example.com page.
Details
The problem seems to be in this method: https://github.com/khoj-ai/khoj/blob/2667ef45449eb408ce1d7c393be04845be31e15f/src/khoj/routers/auth.py#L95
PoC
Open the https://app.khoj.dev/login?next=//example.com url in a Gecko-based browser (Firefox).
Impact
The impact is low, and this could only be used in phishing attempts, but it's still a problem nonetheless.
Credited to davidxbors.
References
- https://github.com/khoj-ai/khoj/security/advisories/GHSA-564j-v29w-rqr6
- https://github.com/khoj-ai/khoj/commit/4daf16e5f916641304e11d56a6071ad365c21a18
- https://github.com/khoj-ai/khoj/blob/2667ef45449eb408ce1d7c393be04845be31e15f/src/khoj/routers/auth.py#L95
- https://github.com/advisories/GHSA-564j-v29w-rqr6
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
