Описание
lobe-chat implemented an insufficient fix for GHSA-mxhq-xw3g-rphc (CVE-2024-32964)
Summary
SSRF protection implemented in https://github.com/lobehub/lobe-chat/blob/main/src/app/api/proxy/route.ts does not consider redirect and could be bypassed when attacker provides external malicious url which redirects to internal resources like private network or loopback address.
PoC
-
Run lobe-chat in docker container. In my setup lobe-chat runs on 0.0.0.0:3210;
-
Create file dummy-server.js with the following content:
And run
as an example server inside of container [1] (or in containers private network).
- Run in terminal to perform request to lobe-chat instance from [1]
where body contains url of server which redirects to internal network (in my case it redirects according url parameter).
- Observe in output of [2]
- Attacker is able to perform SSRF attacks against lobe-chat despite https://github.com/lobehub/lobe-chat/blob/main/src/app/api/proxy/route.ts#L26 check.
Fix recommendations:
- Disable redirects - lobe-chat should consider explicitly disable redirects.
- If redirects support is required, perform check before each http request.
Impact
Ссылки
- https://github.com/lobehub/lobe-chat/security/advisories/GHSA-3fc8-2r3f-8wrg
- https://github.com/lobehub/lobe-chat/security/advisories/GHSA-mxhq-xw3g-rphc
- https://nvd.nist.gov/vuln/detail/CVE-2024-47066
- https://github.com/lobehub/lobe-chat/commit/e960a23b0c69a5762eb27d776d33dac443058faf
- https://github.com/lobehub/lobe-chat/blob/main/src/app/api/proxy/route.ts
Пакеты
@lobehub/chat
<= 1.19.12
1.19.13
Связанные уязвимости
Lobe Chat is an open-source artificial intelligence chat framework. Prior to version 1.19.13, server-side request forgery protection implemented in `src/app/api/proxy/route.ts` does not consider redirect and could be bypassed when attacker provides an external malicious URL which redirects to internal resources like a private network or loopback address. Version 1.19.13 contains an improved fix for the issue.