Cyberforce 2024: How I found my first CVE OpenPLCV3
The OpenPLC3 web application allowed authenticated users to upload any file type, including HTML and scripts, to a static directory. An attacker could upload a malicious HTML file containing an XSS payload and send its link to an employee; if clicked, the script would run on the trusted domain and could steal the victim's session, leading to account takeover and control over connected PLC devices.
Published on medium.com
For DoE Cyberforce competition we were given a website where we had to find vulnerabilities and protect our networks, inadvertently I found an AFU that led to stored XSS and ATO (Account Take Over).
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The application did not enforce file type restrictions on uploads, allowing executable or scriptable files to be stored and served from the web server.
Impact
An attacker could steal an employee's session and take over their account, then control PLC devices, shut them down, delete or upload configuration files, and use the server as a command-and-control channel to bypass network firewalls; however, the attack requires the victim to click a link.
What the attacker needed
Valid login credentials; victim clicks a link
The fix
The vulnerability was fixed by adding file type checks in a later commit.
How it was found
- Log in to the OpenPLC3 web panel with valid credentials.
- Upload a file of any type (e.g., HTML) to the server.
- Send the link to the uploaded file to a victim employee.
- The victim clicks the link, and the XSS payload executes in their browser.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The web application let logged-in users upload files without checking what kind of file they were. Because of this, someone could upload a web page that contains malicious code. If another user visited that page, the code would run in their browser and could steal their login session, letting the attacker take over their account.
What is File upload?
An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.