Unicode RTLO character allowed in uploaded filenames leading to executable file upload and misleading UI handling in Nextcloud Notes
The Nextcloud Notes app allowed filenames containing the Unicode right-to-left override character (U+202E) to be uploaded as attachments, and also permitted executable files such as .exe. An attacker could upload a file with a misleading name that appears to be a harmless document, tricking other users into downloading and running it.
- Triaged in under an hour
- Fixed in 3 months
- Paid in 3 months
- Disclosed after 11 months
Summary by the program
The Text app, which also handles attachments in Notes, did not remove the Unicode right-to-left override character (U+202E) from the names of attached files. An attacker could attach a file whose name was displayed in a misleading way, for example an executable that looks like a PDF, and trick other users into downloading and opening it.
The right-to-left override character is now removed from attachment names.
Fixed in Nextcloud Server 32.0.7 and 33.0.1, and in Nextcloud Enterprise 29.0.16.13, 30.0.17.8 and 31.0.14.3.
The report
Product
Nextcloud – Notes app
Vulnerability Type
Improper handling of Unicode bidirectional control characters (RTLO) in filenames (CWE‑116: Improper Encoding or Escaping of Output)
Description
Nextcloud Notes allows uploading files containing Unicode Right‑To‑Left Override (RTLO – U+202E) characters in their filenames. These characters are invisible and can be abused to manipulate how filenames are interpreted or trusted by users.
Although the Notes UI displays the filename in logical order, the application still allows executable files (.exe) to be uploaded and downloaded without restriction, which may mislead users into trusting and opening dangerous files.
Steps to Reproduce
-
On a Linux system, create a filename containing an RTLO character:
Bash touch "invoice$(printf '\u202E')fdp.exe" -
Verify the filename:
Bash lsThe file appears as:
invoicefdp.exe -
Upload the file to Nextcloud Notes as an attachment.
-
Observe the filename in the Notes UI:
invoicefdp.exe -
Download the file from Notes.
-
Observe that the downloaded file retains the
.exeextension.
Expected Result
- Filenames containing Unicode bidirectional control characters should be sanitized or rejected.
- Executable files should be clearly marked, restricted, or blocked.
- Users should not be exposed to potentially dangerous file types through Notes.
Actual Result
- RTLO characters are allowed in filenames.
- Executable files (
.exe) can be uploaded and downloaded. - The filename contains invisible control characters that may confuse users or downstream systems.
Impact
An attacker can upload executable files with manipulated filenames that may appear harmless to users or automated systems. This can lead to social‑engineering attacks, where users are tricked into downloading and executing malicious files.
While no direct code execution occurs on the server, this poses a user‑level security risk, especially in collaborative environments.
Proof of Concept
Filename used:
invoice<U+202E>fdp.exe
Command used:
touch "invoice$(printf '\u202E')fdp.exe"
Security Risk
Medium
- Requires user interaction
- Can lead to malware execution on user systems
- Known attack technique used in phishing campaigns
Recommendation
- Strip or escape Unicode bidi control characters from filenames.
- Reject or warn on executable file uploads.
- Normalize filenames before display and download.
The PoC Video
Context
Nextcloud Notes is a note-taking app for Nextcloud. Notes can carry file attachments, and the attachment handling is done by the Text app. When a user attaches a file to a note, the Text app stores it and shows its name in the Notes interface, and other users can download it from there.
The issue described here is about how those attachment names are displayed and handled. The Unicode right-to-left override character (RTLO, U+202E) is an invisible bidirectional control character. When it appears in a string, it changes the direction in which the following characters are rendered, so the visual order of a filename can differ from its logical order. That property has a long history in phishing, because it lets a file's displayed name suggest a different type from the one it actually has.
Setup
The report does not describe any special accounts, roles or versions. The reproduction was done on a Linux system, using the shell to create a file with a crafted name, and then the Nextcloud Notes web interface to upload and download it. The only precondition is the ability to attach a file to a note.
Finding it
The researcher noticed that Nextcloud Notes accepts filenames containing the RTLO character. Because the character is invisible, a name can be constructed whose rendered form is misleading. The report also notes that the application allows executable files (.exe) to be uploaded and downloaded without restriction. The combination of the two is what makes the finding interesting: an executable can be attached under a name that may mislead users.
Exploitation
Step 1: create a file with an RTLO in its name
On Linux, the researcher created a file whose name contains the override character:
touch "invoice$(printf '\u202E')fdp.exe"
The printf call emits U+202E, and the shell substitutes it into the filename between invoice and fdp.exe. The resulting name is invoice, then the invisible override, then fdp.exe.
Step 2: check how the name is rendered
The file appears as:
invoicefdp.exe
This is the core of the trick. The override character reverses the display direction of the text that follows it, so the visible order of the characters no longer matches the stored order. A user reading the name sees something that does not correspond to the actual extension.
Step 3: upload the file as a Notes attachment
The file was uploaded to Nextcloud Notes as an attachment. The report does not show the upload request or describe any restriction encountered at this stage.
Step 4: observe the name in the Notes UI
In the Notes interface the filename is displayed as:
invoicefdp.exe
The report states that the Notes UI displays the filename in logical order. In other words, the interface does not itself apply the misleading rendering; the invisible control character is simply carried through in the name that is shown and stored.
Step 5: download the file
The file was downloaded again from Notes.
Step 6: check the downloaded file
The downloaded file retains the .exe extension. Nothing in the upload or download path strips the control character or changes the file type.
The proof-of-concept video walks through the same sequence.
Root cause
The report classifies the weakness as improper handling of Unicode bidirectional control characters in filenames, mapped to CWE-116 (Improper Encoding or Escaping of Output). The Text app, which handles attachments in Notes, did not remove U+202E from attachment names. Because the character is invisible and affects rendering, a name can be displayed in a way that misrepresents the file's real type.
A second design decision compounds this: executable files are accepted as attachments and served back for download without restriction or warning. The report treats the acceptance of executables as part of the problem. The existing handling did not sanitise the name, and executables were accepted without restriction.
Impact
An attacker can attach a file with a manipulated name so that it appears harmless to users or to automated systems that consume the name. This enables social-engineering attacks in which a user is tricked into downloading and running a malicious executable. The report is explicit that no code execution occurs on the server; the risk is at the user level, and it is most relevant in collaborative environments. Exploitation requires user interaction: someone has to download and open the file. The researcher rated the risk as medium on that basis.
Fix
The right-to-left override character is now removed from attachment names. The change shipped in Nextcloud Server 32.0.7 and 33.0.1, and in Nextcloud Enterprise [redacted], [redacted] and 31.0.14.3.
The report's own recommendations go further than the implemented fix: strip or escape Unicode bidi control characters from filenames, reject or warn on executable uploads, and normalise filenames before display and download.
Variants to test
- Other bidi control characters. Try U+202D (left-to-right override), U+202A/U+202B (embedding), U+2066 to U+2069 (isolates) and U+200E/U+200F (marks) in attachment names. A positive result is a stored name whose rendered order differs from its logical order in the UI or in a download.
- Other attachment surfaces. Apply the same filename to other Nextcloud apps that accept uploads, such as file sharing, comments or mail. A positive result is a name that survives storage and is rendered misleadingly to a second user.
- Double extensions with bidi. Combine the override with names like
report.pdf.exeso the rendered form ends in a benign-looking extension. A positive result is a download that keeps the executable extension while the displayed name suggests a document. - Downstream consumers. Feed the stored name to mail gateways, antivirus scanners or archive tools. A positive result is a component that classifies the file by its displayed rather than its real extension.
- Normalisation gaps. Test names that mix the override with combining characters or unusual encodings. A positive result is a name that passes a sanitiser but still renders misleadingly after normalisation.
What happened, in plain words
Nextcloud is a piece of software that organisations run on their own servers so that people can store files, share them and work together on documents. One of its apps is called Notes, and it lets you write notes and attach files to them. The part of Nextcloud that actually stores and shows those attachments is a separate app called Text.
A security researcher found that the Text app accepted attachment names containing a special, invisible character called the right-to-left override (RTLO, written U+202E). This character does not show up on screen, but it changes the direction in which the text after it is drawn. That means the name a person sees can look different from the name that is actually stored. The researcher also found that executable files, the kind of file that runs a program when you open it (.exe on Windows), could be attached and downloaded without restriction.
Put the two together and you get a file that is really a program but can be shown to another user under a misleading name. If that user downloads and opens it, their computer runs the program. Nothing dangerous happens on the Nextcloud server itself; the danger is to the person who opens the file. The researcher rated this a medium risk because someone has to be tricked into downloading and opening the file.
The problem has been fixed: the RTLO character is now removed from attachment names. The fix is in Nextcloud Server 32.0.7 and 33.0.1, and in Nextcloud Enterprise [redacted], [redacted] and 31.0.14.3.
The product and the feature
Nextcloud Notes is a note-taking app for Nextcloud. A note is just text, but you can also attach files to it, the same way you attach a photo to an email. The attachment handling is done by the Text app: when you attach a file to a note, the Text app stores it and shows its name in the Notes interface, and other users can download it from there.
This report is about how those attachment names are displayed and handled. It is not about the note text itself, and it is not about who is allowed to see which note.
The vulnerability type, explained
The report calls the weakness "improper handling of Unicode bidirectional control characters (RTLO) in filenames", and maps it to CWE-116, "Improper Encoding or Escaping of Output".
A few of those words need unpacking.
- Unicode is the standard that gives every character in every writing system a number, so that computers can store and exchange text in many languages. The number for a character is written like
U+202E. - Bidirectional (bidi for short) refers to the fact that some scripts, such as Arabic and Hebrew, are written right to left, while others, such as English, are written left to right. When both appear in one line, the software has to decide the order in which to draw the characters. Unicode includes special invisible characters that tell the software how to do that.
- RTLO, the right-to-left override, is one of those invisible characters. When it appears in a string, it tells the software to draw everything after it from right to left. The characters are stored in one order but drawn in another.
- CWE-116 is a catalogue entry for a common kind of mistake: a program takes some data and passes it on to a place where it is displayed or interpreted, without encoding or escaping it properly. Escaping means converting characters that have a special meaning into a safe form so they cannot change how the output is read.
A simple everyday comparison: imagine writing a word on a transparent sheet and then holding it up to a mirror. The letters are the same, but the order you read them in changes. The RTLO character is like that mirror: it does not change the stored name, only the way it is presented.
This trick has a long history in phishing, the practice of pretending to be something trustworthy to get someone to do something harmful. Because the character is invisible, a filename can be made to suggest a different file type from the one it actually has.
Setting up
The report does not describe any special accounts, roles or versions. The reproduction was done on a Linux system, using the shell (the text-based command line) to create a file with a crafted name, and then the Nextcloud Notes web interface to upload and download it. The only precondition is the ability to attach a file to a note.
Finding it
The researcher noticed that Nextcloud Notes accepts filenames containing the RTLO character. Because the character is invisible, a name can be constructed whose rendered form is misleading. The report also notes that the application allows executable files (.exe) to be uploaded and downloaded without restriction. The combination of the two is what makes the finding interesting: a file that is really an executable can be presented to a user under a name that looks like something harmless, such as a PDF.
Exploitation, step by step
Step 1: create a file with an RTLO in its name
On Linux, the researcher created a file whose name contains the override character:
touch "invoice$(printf '\u202E')fdp.exe"
Line by line:
touchis a Linux command that creates an empty file. If the file already exists, it just updates its timestamp. Here it is used purely to make a file with a chosen name.- The name is given in double quotes:
"invoice$(printf '\u202E')fdp.exe". The quotes keep the whole thing together as one name, even though it contains special characters. $( ... )is command substitution: the shell runs the command inside the brackets and puts its output into the name. So the name is built from three parts joined together.printf '\u202E'prints the character whose Unicode number is 202E, which is the invisible RTLO.printfis a command that formats and prints text, and\ufollowed by four hexadecimal digits is how it is told to print a Unicode character.- The result is a name made of
invoice, then the invisible override, thenfdp.exe.
Why this step: the researcher needed a file whose name contains the character under test, and building it with printf is a reliable way to insert an invisible character that cannot easily be typed.
Step 2: check how the name is rendered
lslists the files in the current directory. It is the simplest way to see what a filename looks like when it is printed to a terminal.
The file appears as:
invoicefdp.exe
This is the core of the trick. The override character reverses the display direction of the text that follows it, so the visible order of the characters no longer matches the stored order. A user reading the name sees something that does not correspond to the actual extension.
Why this step: before uploading anything, the researcher wanted to confirm that the crafted name really does render in a misleading way. Seeing it in the terminal is the quickest check.
Step 3: upload the file as a Notes attachment
The file was uploaded to Nextcloud Notes as an attachment. The report does not show the upload request or describe any restriction encountered at this stage.
Why this step: the point of the test is what happens inside Nextcloud, so the crafted file has to get into the application the same way a normal user would put it there.
Step 4: observe the name in the Notes UI
In the Notes interface the filename is displayed as:
invoicefdp.exe
The report states that the Notes UI displays the filename in logical order. In other words, the interface does not itself apply the misleading rendering; the invisible control character is simply carried through in the name that is shown and stored.
Why this step: this shows that the application accepted the name without cleaning it. The character survived the upload and is now part of what other users will see.
Step 5: download the file
The file was downloaded again from Notes.
Why this step: an attachment is only dangerous if it can come back out of the application and reach someone's computer. Downloading it checks the other half of the round trip.
Step 6: check the downloaded file
The downloaded file retains the .exe extension. Nothing in the upload or download path strips the control character or changes the file type.
Why this step: this is the confirmation. The file that arrives on the user's machine is still an executable, and its name still carries the invisible character that can make it look like something else.
The proof-of-concept video walks through the same sequence.
Why it works (root cause)
The report classifies the weakness as improper handling of Unicode bidirectional control characters in filenames, mapped to CWE-116 (Improper Encoding or Escaping of Output). The Text app, which handles attachments in Notes, did not remove U+202E from attachment names. Because the character is invisible and affects rendering, a name can be displayed in a way that misrepresents the file's real type.
A second design decision compounds this: executable files are accepted as attachments and served back for download without restriction. The report treats the acceptance of executables as part of the problem. In plain terms, the application did not clean names before showing them and did not restrict executables. Neither layer stopped the misleading name from reaching other users.
Impact
An attacker can attach a file with a manipulated name so that it appears harmless to users or to automated systems that consume the name. This enables social-engineering attacks in which a user is tricked into downloading and running a malicious executable. The report is explicit that no code execution occurs on the server; the risk is at the user level, and it is most relevant in collaborative environments. Exploitation requires user interaction: someone has to download and open the file. The researcher rated the risk as medium on that basis.
The fix
The right-to-left override character is now removed from attachment names. The change shipped in Nextcloud Server 32.0.7 and 33.0.1, and in Nextcloud Enterprise [redacted], [redacted] and 31.0.14.3.
The report's own recommendations go further than the implemented fix: strip or escape Unicode bidi control characters from filenames, reject or warn on executable uploads, and normalise filenames before display and download.
Other things worth testing
These are follow-up ideas in the same spirit, not findings from this report.
- Other bidi control characters. Try U+202D (left-to-right override), U+202A/U+202B (embedding), U+2066 to U+2069 (isolates) and U+200E/U+200F (marks) in attachment names. A positive result is a stored name whose rendered order differs from its logical order in the UI or in a download.
- Other attachment surfaces. Apply the same filename to other Nextcloud apps that accept uploads, such as file sharing, comments or mail. A positive result is a name that survives storage and is rendered misleadingly to a second user.
- Double extensions with bidi. Combine the override with names like
report.pdf.exeso the rendered form ends in a benign-looking extension. A positive result is a download that keeps the executable extension while the displayed name suggests a document. - Downstream consumers. Feed the stored name to mail gateways, antivirus scanners or archive tools. A positive result is a component that classifies the file by its displayed rather than its real extension.
- Normalisation gaps. Test names that mix the override with combining characters or unusual encodings. A positive result is a name that passes a sanitiser but still renders misleadingly after normalisation.
Glossary
- Attachment: a file that is added to a note, message or other item, rather than being part of its text.
- Bidirectional (bidi): text that mixes left-to-right and right-to-left writing, which software has to order correctly when drawing it.
- Command substitution: a shell feature, written
$( ... ), that runs a command and inserts its output into the surrounding text. - CWE-116: a catalogue entry for the mistake of passing data to output without encoding or escaping it properly.
- Executable: a file that runs a program when opened, such as a
.exefile on Windows. - Extension: the part of a filename after the last dot, such as
.exeor.pdf, which usually indicates the file type. - Hexadecimal: a way of writing numbers using digits 0 to 9 and letters A to F, often used for character codes.
- Linux: an operating system, common on servers, that provides a command-line shell.
- Logical order: the order in which characters are actually stored in a string, as opposed to the order in which they are drawn.
- Normalisation: converting text into a standard form so that equivalent spellings compare and display consistently.
- Phishing: pretending to be something trustworthy in order to trick someone into doing something harmful.
printf: a command that prints text according to a format, including special characters such as\u202E.- Rendered form: the way text actually appears on screen after the software has applied its display rules.
- RTLO (right-to-left override, U+202E): an invisible Unicode character that makes the text after it display from right to left.
- Sanitise: clean input by removing or neutralising characters that could cause problems.
- Shell: the text-based interface for giving commands to an operating system.
- Social engineering: manipulating people, rather than machines, into taking an unsafe action.
touch: a Linux command that creates an empty file or updates an existing file's timestamp.- Unicode: the standard that assigns a number to every character in every writing system.
- User interaction: a step that requires a person to act, such as clicking or opening a file, for an attack to succeed.
ls: a Linux command that lists the files in a directory.