-
Notifications
You must be signed in to change notification settings - Fork 2k
FileUpload max_file_size check trusts client-reported size field #3815
Copy link
Copy link
Closed
Labels
bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.Something isn't working. Reports of errors, unexpected behavior, or broken functionality.high-prioritysecuritySecurity fixes: input validation, SSRF/LFI prevention, auth hardening, injection defenses.Security fixes: input validation, SSRF/LFI prevention, auth hardening, injection defenses.serverRelated to FastMCP server implementation or server-side functionality.Related to FastMCP server implementation or server-side functionality.
Metadata
Metadata
Assignees
Labels
bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.Something isn't working. Reports of errors, unexpected behavior, or broken functionality.high-prioritysecuritySecurity fixes: input validation, SSRF/LFI prevention, auth hardening, injection defenses.Security fixes: input validation, SSRF/LFI prevention, auth hardening, injection defenses.serverRelated to FastMCP server implementation or server-side functionality.Related to FastMCP server implementation or server-side functionality.
Description
The
store_filestool inFileUploadchecksf.get("size", 0) > provider._max_file_sizeto enforce the file size limit, but thesizefield is entirely client-provided and never validated against the actual base64-encoded data payload.A client can set
size: 1while sending an arbitrarily largedatapayload, completely bypassing the configuredmax_file_sizelimit.Reproduction
Expected behavior
The size limit should be enforced based on the actual base64 data length, not the client-reported
sizefield.Impact
The
max_file_sizesetting gives a false sense of security — it can be trivially bypassed by any client that sets a smallsizevalue.