The vulnerability is a code injection in the frontend, triggered by a malicious Server-Sent Event (SSE) from an external model server. The root cause is the frontend code's use of new Function() to execute code received in an execute event. The provided patch is in the backend file backend/open_webui/utils/middleware.py, within the flush_pending_delta_data function. This function is responsible for streaming data from the backend to the frontend. The patch introduces a condition to block 'event' type data when the connection is a 'direct' one, effectively preventing the malicious event from reaching the frontend. Therefore, flush_pending_delta_data is a vulnerable function as it was the component that passed the malicious data to the frontend. While the primary vulnerability is in the frontend's JavaScript code, this backend function is a critical and identifiable part of the execution flow that enables the exploit. Without a direct patch on the frontend code available for analysis, this backend function is the most reliable indicator of the vulnerable code path from the provided information.