Description
The /api/upload endpoint accepts a localUploadUrl from the client, allowing file uploads to arbitrary destinations.
Affected File
app/api/upload/route.ts
Current Behavior
const localUploadUrl = formData.get("localUploadUrl") as string || "http://localhost:9000"
const response = await fetch(`${localUploadUrl}/tost/${filename}`, {
method: "PUT",
body: file,
})
Security Impact
An attacker could upload files to internal services or overwrite data on accessible endpoints.
Suggested Fix
const LOCAL_UPLOAD_URL = process.env.LOCAL_UPLOAD_URL || 'http://localhost:9000';
// Don't accept localUploadUrl from client
Description
The
/api/uploadendpoint accepts alocalUploadUrlfrom the client, allowing file uploads to arbitrary destinations.Affected File
app/api/upload/route.tsCurrent Behavior
Security Impact
An attacker could upload files to internal services or overwrite data on accessible endpoints.
Suggested Fix