Skip to content
UI spoofing Disclosed report Beginner

RTLO character allowed in shared files

The sharing page of a file did not strip the right-to-left override (RTLO) character, allowing an attacker to mask a file's real extension. A victim who downloads and opens the file could execute malicious content, such as HTML or an executable.

inhibitor181 Follow

Originally disclosed on HackerOne

  • Triaged in 5 hours
  • Disclosed after 3.3 years

SUMMARY

Hello, I have notices that you do not properly strip the RTLO (right to left override) character in the sharing page of the file, thus allowing someone to mask the real extension of a file and if the user downloads, then opens the file something may be executed on his machine.

Very important : This char is handles correctly in file lists, but incorrectly if you get the share link of that file.

POC

First of all, create a file with a fake extension by utilizing the RTLO character. I usually do it like this (my example is to fake a .html as a .txt) :

  1. Create a file called : testtxt.lmth
  2. Go to Chrome, open the JS console and write copy("\u202e");
  3. Go to your file, try to rename it, place the cursor between the . and the l from the extension and CTRL+V to paste the copied RTLO char. The name should be now testtxt.html

Now, back to nextcloud. I used https://demo.nextcloud.com for my test

  1. Upload the file
  2. You will notice that the name is correctly written in file file manager (you see the .html extension, not .txt)
  3. Share the file (I also added a password, but it shouldn't matter)
  4. With another account / user go to that file
  5. The name you will see is testtxt.html. But, if you download this file and open it the html will be executed in your browser

Video POC attached (I cannot attach the RTLO file because h1 strips the char out, as it should)

ADVICE

Normally you should strip this char out along with more unicode chars. I have reported this / seen this behaviour and stripping the unicodes out fixes it, and I recommend it. Also in some other programs, the user cannot even download the file (after he downloads the file, it cannot be opened as it is not found on the disk anymore - the name is replaced again by the system).

But, the behaviour from nextcloud should be patched.

Also, the txt <-> html faking is trivial, but faking .exe / .bat / .cmd etc can have other consequences as the user knows he should have downloaded a .txt file from nextcloud.

The original report as published on HackerOne, by inhibitor181. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the application failed to sanitise or strip Unicode bidirectional control characters from filenames when generating the sharing page, while other parts of the application did handle them correctly.

Impact

An attacker could trick a user into downloading and opening a file that appears harmless but actually contains executable content, potentially leading to code execution on the victim's machine.

What the attacker needed

Ability to upload a file with RTLO in name; victim downloads and opens the shared file

The fix

The application should strip the RTLO character and other Unicode control characters from filenames on the sharing page.

How it was found

  1. Create a file with a fake extension using the RTLO character.
  2. Upload the file to Nextcloud.
  3. Share the file (optionally with a password).
  4. Access the shared file with another account.
  5. Observe the displayed filename shows the fake extension.
  6. Download and open the file to execute the hidden content.

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 report has not been written yet. The Original tab links to the source.

The RTLO character is an invisible Unicode control that reverses the display order of text. By inserting it into a filename, an attacker can make a dangerous file appear to have a harmless extension, like showing '.txt' when the file is actually '.html'. If a user downloads and opens the file, the hidden content runs.

What is UI spoofing?

The interface lies to the user: a framed page catches their clicks, or a browser shows the wrong address or a fake prompt. Paid when it leads to a sensitive action or convincing phishing.

More by inhibitor181

View all

10 more disclosed reports, best first.

More from Nextcloud

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Clickjacking and UI spoofing

The lesson behind this report.

The interface lies to the user: a framed page catches their clicks, or a browser shows the wrong address or a fake prompt. Paid when it leads to a sensitive action or convincing phishing.