Skip to content

Commit

Permalink
Add testbed for Gradio CVE-2023-51449
Browse files Browse the repository at this point in the history
  • Loading branch information
inkz authored Mar 29, 2024
1 parent 4ad1d26 commit 9f7f7cf
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
19 changes: 19 additions & 0 deletions gradio/CVE-2023-51449/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Gradio CVE-2023-51449

## Vulnerable setup

```bash
docker build -t gradio:vuln -f vulnerable.Dockerfile .
docker run --name gradio-vuln -p 8000:8000 -d gradio:vuln
```

Application will be available at `localhost:8000`

## Non-vulnerable setup

```bash
docker build -t gradio:novuln -f non-vulnerable.Dockerfile .
docker run --name gradio-novuln -p 8000:8000 -d gradio:novuln
```

Application will be available at `localhost:8000`
9 changes: 9 additions & 0 deletions gradio/CVE-2023-51449/non-vulnerable.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM python:3.9-slim

RUN python -m pip install gradio==4.11.0

ADD test_app.py /workspace/

EXPOSE 8000

CMD [ "python3" , "/workspace/test_app.py" ]
13 changes: 13 additions & 0 deletions gradio/CVE-2023-51449/test_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import gradio as gr

def greet(name, intensity):
return "Hello, " + name + "!" * int(intensity)

demo = gr.Interface(
fn=greet,
inputs=["text", "slider"],
outputs=["text"],
)

if __name__ == "__main__":
demo.launch(server_name="0.0.0.0", server_port=8000)
9 changes: 9 additions & 0 deletions gradio/CVE-2023-51449/vulnerable.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM python:3.9-slim

RUN python -m pip install gradio==4.10.0

ADD test_app.py /workspace/

EXPOSE 8000

CMD [ "python3" , "/workspace/test_app.py" ]

0 comments on commit 9f7f7cf

Please sign in to comment.