Skip to content
File upload Write-up Intermediate

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.

alimuhammadsecured Follow

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).

Alimuhammadsecured, on medium.com

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

  1. Log in to the OpenPLC3 web panel with valid credentials.
  2. Upload a file of any type (e.g., HTML) to the server.
  3. Send the link to the uploaded file to a victim employee.
  4. 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.

More by alimuhammadsecured

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Unrestricted file upload

The lesson behind this report.

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.