erc721m icon indicating copy to clipboard operation
erc721m copied to clipboard

🐛 BUG Fix: arbitrary remote code execution within `wrangler dev` Workers sandbox

Open kreeksec opened this issue 1 year ago • 0 comments

The V8 inspector intentionally allows arbitrary code execution within the Workers sandbox for debugging. wrangler dev would previously start an inspector server listening on all network interfaces. This would allow an attacker on the local network to connect to the inspector and run arbitrary code. Additionally, the inspector server did not validate Origin/Host headers, granting an attacker that can trick any user on the local network into opening a malicious website the ability to run code. If wrangler dev --remote was being used, an attacker could access production resources if they were bound to the worker.

$ lsof -nPiTCP -sTCP:LISTEN
COMMAND   PID USER   FD   TYPE            DEVICE SIZE/OFF NODE NAME
node    51399  pwu   33u  IPv6 0xe8478a1f17ba37f      0t0  TCP *:9229 (LISTEN)
node    51399  pwu   37u  IPv4 0xe8478b51682305f      0t0  TCP *:56781 (LISTEN)
node    51399  pwu   38u  IPv6 0xe8478a1f17bab7f      0t0  TCP *:6284 (LISTEN)
workerd 51401  pwu   11u  IPv4 0xe8478b515f2f98f      0t0  TCP 127.0.0.1:56779 (LISTEN)
workerd 51401  pwu   12u  IPv6 0xe8478a1f17bb37f      0t0  TCP [::1]:56779 (LISTEN)
workerd 51401  pwu   14u  IPv4 0xe8478b5166e64ff      0t0  TCP *:8787 (LISTEN)
 export const openInspector = async ( 
 	inspectorPort: number, 
 	worker: string | undefined 
 ) => { 
 	const query = new URLSearchParams(); 
 	query.set("theme", "systemPreferred"); 
 	query.set("ws", `localhost:${inspectorPort}/ws`); 

CVE-2023-7080 CWE-269

kreeksec avatar Oct 25 '24 17:10 kreeksec