9.9critical
OpenPLC Runtime v3 Path Traversal in Structured Text FILE Directive Leading to Arbitrary File Write
- Severity
- 9.9critical CVSS:3.1 by TuranSec
- Exploit likelihood
- 0.36% (higher than 32% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- TuranSec
Description
OpenPLC Runtime v3's compile_program function (webserver/openplc.py) parses directives from uploaded Structured Text (.st) program files and writes the referenced content to with no validation that file_path stays within the ./core directory. A path-validation function, validate_file_path, exists elsewhere in the codebase (webserver/credentials.py) but is never invoked from compile_program, leaving the sink unprotected.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| thiagoralves OpenPLC_v3 | up to * | CVE List |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.
What each source says
CVE List
OpenPLC Runtime v3's compile_program function (webserver/openplc.py) parses directives from uploaded Structured Text (.st) program files and writes the referenced content to with no validation that file_path stays within the ./core directory. A path-validation function, validate_file_path, exists elsewhere in the codebase (webserver/credentials.py) but is never invoked from compile_program, leaving the sink unprotected.
NVD (es)
La función compile_program() de OpenPLC Runtime v3 (webserver/openplc.py) analiza las directivas “(FILE:path content)” de los archivos de programa Structured Text (.st) cargados y escribe el contenido referenciado en “os.path.join(’./core’, file_path)” sin validación de que file_path permanezca dentro del directorio ./core. Un archivo .st manipulado que contiene una directiva como “(FILE:.. / .. / .. / etc/cron.d/x * * * * root [command]*)” escribe contenido controlado por el atacante en una ruta arbitraria del sistema de archivos, lo que permite la ejecución remota de código (por ejemplo, a través de cron o de las claves autorizadas de SSH). Una función de validación de rutas, validate_file_path(), existe en otra parte de la base de código (webserver/credentials.py) pero nunca se invoca desde compile_program(), dejando el ’sink’ desprotegido. OpenPLC se distribuye además con credenciales predeterminadas codificadas (openplc:openplc), lo que reduce la barrera práctica para la explotación.
References
| https://github.com/thiagoralves/OpenPLC_v3 | third-party-advisory | |
| https://github.com/thiagoralves/OpenPLC_v3/blob/master/webserver/openplc.py | third-party-advisory | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-71268 changed 2026-08-10 | CVE Terms of Use |
| NVD | CVE-2026-71268 changed 2026-10-24 | Public domain |