CVE-2024-4941 是 Gradio 应用中发现的一个本地文件包含漏洞。该漏洞源于 gradio/components/json_component.py 中 postprocess() 函数对用户控制字符串的 JSON 解析不当。攻击者可以利用此漏洞读取服务器上的任意文件,从而可能导致敏感信息泄露。该漏洞影响 Gradio 版本小于或等于 4.9.1 的用户,建议升级至 4.31.3 版本以修复。
攻击者可以利用此漏洞通过构造恶意的 JSON 数据,在 postprocess() 函数中触发文件包含。具体来说,如果 JSON 对象包含一个 path 键,processingutils.movefilestocache() 函数会遍历该对象,并将指定的文件移动到临时目录。随后,攻击者可以通过 /file=.. 端点访问该文件,从而读取任意文件。这可能导致敏感配置信息、源代码或其他重要数据的泄露。如果 Gradio 应用用于处理用户上传的文件,攻击者甚至可能通过此漏洞读取用户上传的私有文件。
目前,该漏洞尚未被广泛利用,但已公开披露,存在被利用的风险。该漏洞的公开 PoC 尚未发现,但由于其易于利用,预计未来可能会出现。CISA 尚未将其添加到 KEV 目录,但其 CVSS 评分为高,表明其潜在风险较高。建议密切关注安全社区的动态,及时采取应对措施。
Applications utilizing Gradio for building interactive web interfaces, particularly those handling sensitive data or deployed in environments with limited security controls, are at risk. This includes developers using Gradio for machine learning demos, data visualization tools, or internal dashboards.
• python / gradio:
import os
import json
# Check for vulnerable Gradio versions
process = os.popen('pip show gradio')
output = process.read()
version = None
for line in output.splitlines():
if line.startswith('Version:'):
version = line.split('==')[1]
break
if version and float(version) <= 4.9.1:
print("VULNERABLE: Gradio version is {}".format(version))
else:
print("Gradio version is safe or not installed.")• generic web: Check Gradio application endpoints for the existence of /file=.. and attempt to access arbitrary files.
disclosure
漏洞利用状态
EPSS
0.56% (68% 百分位)
CISA SSVC
CVSS 向量
为了缓解 CVE-2024-4941 的风险,建议立即升级至 Gradio 4.31.3 或更高版本。如果无法立即升级,可以考虑以下临时缓解措施:首先,严格限制 Gradio 应用的访问权限,仅允许必要的用户访问。其次,对输入进行严格的验证和过滤,确保 JSON 数据不包含恶意 path 键。此外,可以配置 Web 应用防火墙 (WAF) 或代理服务器,阻止对 /file=.. 端点的访问。最后,监控 Gradio 应用的日志,查找任何异常的文件访问行为。
Actualice la biblioteca gradio a la versión 4.31.4 o superior. Esto corrige la vulnerabilidad de inclusión de archivos locales en el componente JSON. La actualización se puede realizar utilizando el gestor de paquetes pip: `pip install --upgrade gradio`.
漏洞分析和关键警报直接发送到您的邮箱。
CVE-2024-4941 是 Gradio 应用中发现的一个本地文件包含漏洞,由于 JSON 解析过程中的输入验证不当,攻击者可以读取任意文件。
如果您使用的 Gradio 版本小于或等于 4.9.1,则可能受到影响。请立即升级至 4.31.3 或更高版本。
建议升级至 Gradio 4.31.3 或更高版本。如果无法升级,请实施临时缓解措施,例如限制访问权限和过滤输入。
目前尚未发现大规模利用,但已公开披露,存在被利用的风险。
请访问 Gradio 的官方安全公告页面或 GitHub 仓库,查找相关信息。
上传你的 requirements.txt 文件,立即知道是否受影响。