[Security Issue]: Open Redirect Vulnerability in Stable Diffusion WebUI via Gradio (CVE-2024-4940) #16715
Open
5 of 6 tasks
Labels
bug-report
Report of a bug, yet to be confirmed
Checklist
What happened?
An Open Redirect vulnerability was discovered in Stable Diffusion WebUI due to improper validation of the
file
parameter inGradio.
This vulnerability, tracked as CVE-2024-4940, affectsGradio versions 4.36.1 and below
. It allows attackers to redirect users to attacker-controlled websites by crafting malicious URLs.CVE-2024-4940 details: https://nvd.nist.gov/vuln/detail/CVE-2024-4940
The issue arises due to improper handling of user-supplied input in URL processing. When a malicious URL is supplied, the application redirects users to an unintended external location without validation.
Steps to reproduce the problem
Launch Stable Diffusion WebUI in a local environment (e.g.,
http://127.0.0.1:7860
).Use a crafted URL to supply an external URL to the
file
parameter:https://google.com
without proper validation of the input.What should have happened?
Stable-Diffusion WebUI currently utilizes
Gradio version 3.41.2
, which is outdated and vulnerable to known security issues, including CVE-2024-4940. To address these vulnerabilities, it is recommended to updateGradio to version 4.37.1 or later
Upgrade Gradio
Update Gradio to version 4.37.1 or later, where this vulnerability has been addressed.
pip install gradio>=4.37.1
Add Input Validation
create_prompts
function to check if thefile
parameter contains a valid file path. Reject or sanitize external URLs.What browsers do you use to access the UI ?
No response
Sysinfo
Vulnerable Code Location
/modules/ui_toprow.py
create_prompts
The
create_prompts
function processes user input for text or file-based prompts. However, thegr.File()
component does not properly validate inputs, allowing URLs to be treated as file paths. This leads to unintended redirections.Console logs
Additional information
No response
The text was updated successfully, but these errors were encountered: