-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potential security vulnerability in create_pyi #8853
Comments
Hi @kmulka-bloomberg as far as I understand, this is not a real security vulnerability since it only affects a user who runs specifically crafted code that happens to use gradio library. But is someone is executing code from a third party, then they are already executing arbitrary code anyways, so the fact that jinja2 is injecting some code is not a real additional security threat. If I'm misunderstanding something, please let me know. |
@abidlabs Thanks for the response. I don't understand the ComponentMeta code enough to understand if user-contributed data (via the gradio web UI or API) would be fed to the create_pyi function. Maybe you could help me / others understand what the purpose of this function is and if it is possible user-contributed data could be passed through. |
Wondering if you or someone from the gradio team could dispute the creation of the CVE if you believe it is not a vulnerability. |
We'll look into it. I'll reopen this issue for now |
I used this form https://cveform.mitre.org/ to dispute the security vulnerability. I used this script to provide an alternate way where a user could simply monkeypatch the gradio library to produce a similar effect: import os
import re
import gradio
gradio_dir = os.path.dirname(gradio.__file__)
components_file_path = os.path.join(gradio_dir, 'components.py')
with open(components_file_path, 'r') as file:
file_contents = file.read()
pattern = r'(class Textbox\(.*?\):\s+def __init__\(self,.*?\):\s+)'
replacement = r'\1\n print("Custom code executed: Textbox is being created")\n'
new_file_contents = re.sub(pattern, replacement, file_contents, flags=re.DOTALL)
with open(components_file_path, 'w') as file:
file.write(new_file_contents)
print("gradio package has been modified. Custom code will now execute whenever Textbox is instantiated.") |
Describe the bug
According to this report, there is a security vulnerability in gradio. It looks like it has been in the wild without a patch for a few weeks.
GHSA-9v2f-6vcg-3hgv
Have you searched existing issues? 🔎
Reproduction
Screenshot
No response
Logs
No response
System Info
Severity
Blocking usage of gradio
The text was updated successfully, but these errors were encountered: