Open Redirector via (apps/files_pdfviewer) for un-authenticated users.
The PDF viewer app accepted a file parameter pointing to an external domain and, when the download button was clicked, redirected the browser to that domain. An attacker could use this to send victims to a malicious site under the guise of a shared file.
- Triaged in under an hour
- Fixed in 19 days
- Paid in 25 days
- Disclosed after 3 months
Affected Products: OWNCLOUD (https://demo.owncloud.org/index.php/apps/files_pdfviewer) Version Tested: v1.0.712, other versions might be vulnerable Class: Open Redirector Remote: Yes
A non authenticated user can be easily tricked into following one of the following links in order to download a supposedly uploaded file on an owncloud instance: The EvilFile the pdfviewer is trying to redirect will not load in the viewer automatically. But if the user clicks the download button on the right upper corner of the viewer any file will be downloaded instantly and the browser will be redirected to a different domain (ex. https://evildomain.xx ).
****OPEN REDIRECT Attack Replication Steps:
Step 1: Visit https://demo.owncloud.org/index.php/apps/files_pdfviewer?file=https://evildomain.xx/EvilFile.xx [ Check POC1.jpg ]
Step 2: Click Download button on the right upper corner of the viewer.
Step 3: Browser is redirected to https://evildomain.xx/EvilFile.xx
Comment: No user authentication is required for the user to be redirected. All owncloud installations in the wild are vulnerable to this attack.
****Example Phishing Message with OPEN REDIRECT Attack:
Message:
Please view the files i have shared with you by following the link below, if this file is not automatically opened please click the download button on the right upper corner:
Attachments


Context
The target is ownCloud, specifically the files_pdfviewer app, which renders PDF files stored in an ownCloud instance inside a viewer in the browser. The affected product is listed as OWNCLOUD at https://demo.owncloud.org/index.php/apps/files_pdfviewer, and the version tested was v1.0.712, with the note that other versions might be vulnerable. The weakness class is an open redirector, reachable remotely, and the researcher reports that no authentication is required.
The feature normally takes a file parameter and loads the referenced file into the PDF viewer. The viewer offers a download button in the right upper corner. The report's claim is that the value of file is not constrained to the ownCloud instance, so the download action can send the browser to an arbitrary external domain.
Setup
The report does not describe any account, role or tooling. The only precondition it states is the absence of authentication: a non authenticated user can be tricked into following the crafted link. Testing was done against the public demo instance at https://demo.owncloud.org, and the version recorded is v1.0.712.
Finding it
The report shows that the file parameter of the files_pdfviewer endpoint accepts a full external URL. When such a URL is supplied, the PDF viewer does not load the remote file automatically, but the download button in the right upper corner still acts on it: clicking it downloads a file and redirects the browser to the different domain named in the parameter. That behaviour, a user controlled parameter driving a redirect to an arbitrary host, is what made it look wrong.
Exploitation
The attack is described as a three step replication.
Step 1: Open the crafted viewer URL
https://demo.owncloud.org/index.php/apps/files_pdfviewer?file=https://evildomain.xx/EvilFile.xx
The file parameter carries an absolute URL on an attacker controlled domain (https://evildomain.xx/EvilFile.xx) instead of a path inside the ownCloud instance. The remote file is not loaded into the viewer automatically.

Step 2: Click the download button
The user clicks the download button in the right upper corner of the viewer. This is the action the viewer offers for retrieving the file being displayed.
Step 3: Observe the redirect
https://evildomain.xx/EvilFile.xx
The browser is redirected to the external URL supplied in the file parameter, and any file will be downloaded instantly. The report notes that no user authentication is required for the user to be redirected, and that all ownCloud installations in the wild are vulnerable to this attack.
Phishing scenario
The report frames the bug as a phishing primitive. The example message asks the recipient to view shared files by following a link and, if the file is not opened automatically, to click the download button in the right upper corner. The link is:
https://demo.owncloud.org/index.php/apps/files_pdfviewer?file=https://evildomain.xx/remote.php/webdav/Demo.pdf%20%3CIf%20this%20file%20is%20not%20available%20please%20click%20the%20dowload%20button%20on%20the%20right%20upper%20corner%3E
The parameter value is an external URL whose path points at remote.php/webdav/Demo.pdf, followed by a percent encoded string that decodes to <If this file is not available please click the dowload button on the right upper corner>. Because the link starts with the legitimate ownCloud demo host, the recipient sees a trusted domain, while the redirect target is the attacker's domain.

Root cause
The report does not include code or a patch, so the exact defect is not shown. What the behaviour implies is that the file parameter is used as the redirect target for the download action without being restricted to the ownCloud instance, so an absolute external URL is accepted and followed. The viewer's own handling does not neutralise this: the remote file is not rendered in the viewer, but the download button still acts on the supplied URL. Whether any validation existed and why it failed is not stated in the report.
Impact
A non authenticated user who follows a crafted files_pdfviewer link and clicks the download button is sent to an attacker chosen domain. The report's phishing example shows the practical use: the link begins with the trusted ownCloud host, which lends credibility, and the redirect lands on the attacker's site. The report states that all ownCloud installations in the wild are vulnerable. It does not describe any further consequence beyond the redirect and the file download.
Fix
What the behaviour calls for is to stop treating the file parameter as an arbitrary redirect target, for example by only accepting references that resolve inside the ownCloud instance and rejecting absolute external URLs before the download action uses them.
Variants to test
- Other viewer or preview apps that take a file parameter and offer a download action. A positive result is the same pattern: the remote file does not render, but the download button sends the browser to the external host.
- Different encodings of the external URL in the
fileparameter, such as percent encoded or double encoded forms. A positive result is a redirect to the decoded external host. - Absolute URLs with paths that mimic internal endpoints, as in the phishing example's
remote.php/webdav/Demo.pdfpath. A positive result is that the path does not constrain the redirect and the browser still leaves for the external domain. - The same endpoint without authentication, to confirm the precondition the report states. A positive result is the redirect occurring for a user who never logged in.
Hunting notes
This kind of bug hides in features that accept a file reference and then act on it in a second step, such as preview and viewer apps with a download button. During recon, the signal is a parameter that takes a URL or path and is reflected into a redirect or a download action rather than being resolved against the local instance. The report shows impact by pairing the redirect with a phishing message whose link starts on the legitimate ownCloud host, and it states that no authentication is needed. The bounty recorded for the report was 150.00 USD.
What happened, in plain words
ownCloud is a piece of software that organisations install on their own servers to store and share files, a bit like running your own private version of a cloud drive. One of its optional apps, files_pdfviewer, lets you open a PDF stored in ownCloud directly in the browser instead of downloading it first. The viewer has a download button in its right upper corner for saving the file to your computer.
The report shows that this viewer trusts a value in the web address (the file parameter) too much. Normally that value should point at a file inside the ownCloud installation. Instead, it also accepts a full web address pointing at somebody else's website. The remote file does not appear in the viewer, but if the visitor clicks the download button, the browser is sent away to that other website. This is called an open redirect: a trusted site that will forward visitors to any address an attacker chooses.
The trick matters because the link a victim receives starts with the real ownCloud address, so it looks trustworthy, while the final destination is the attacker's site. No login is needed for any of this. The report was disclosed on 2 July 2016 and a bounty of 150.00 USD was recorded.
Context
The affected product is listed as OWNCLOUD, at the address https://demo.owncloud.org/index.php/apps/files_pdfviewer. The version tested was v1.0.712, and the report notes that other versions might be vulnerable. The weakness class is an open redirector, and it can be reached remotely, meaning over the network from anywhere, not only from the machine the software runs on.
The feature works like this: the viewer takes a file parameter and loads the referenced file into the PDF viewer. The viewer offers a download button in the right upper corner. The report's claim is that the value of file is not limited to the ownCloud instance, so the download action can send the browser to an arbitrary external domain.
A parameter is simply a named value attached to the end of a web address after a question mark, the way a search box puts your words into the address bar. An open redirect is a feature that is supposed to send you somewhere on the same site but can be made to send you anywhere, like a receptionist who is told to escort a visitor to "room 12" and happily walks them to any building in town because nobody checks the address.
Setup
The report does not describe any account, role or tooling. The only precondition it states is the absence of authentication: a non authenticated user can be tricked into following the crafted link. Authentication means proving who you are, usually by logging in with a username and password. Testing was done against the public demo instance at https://demo.owncloud.org, and the version recorded is v1.0.712.
Finding it
The report shows that the file parameter of the files_pdfviewer endpoint accepts a full external URL. An endpoint is one specific address on a website that performs one job, like a particular counter in a large office. When such a URL is supplied, the PDF viewer does not load the remote file automatically, but the download button in the right upper corner still acts on it: clicking it downloads a file and redirects the browser to the different domain named in the parameter. That behaviour, a user controlled parameter driving a redirect to an arbitrary host, is what made it look wrong.
Exploitation
The attack is described as a three step replication.
Step 1: Open the crafted viewer URL
https://demo.owncloud.org/index.php/apps/files_pdfviewer?file=https://evildomain.xx/EvilFile.xx
Reading this address from left to right: https://demo.owncloud.org is the real ownCloud demo server, so the browser's address bar shows a trusted name. /index.php/apps/files_pdfviewer is the path to the PDF viewer app. The question mark starts the parameters, and file= gives the parameter its value. That value is itself a complete web address, https://evildomain.xx/EvilFile.xx, on a domain the attacker controls, instead of a path inside the ownCloud instance. The remote file is not loaded into the viewer automatically. This step is taken to show that the viewer accepts an outside address in a place where only an internal file reference should be accepted.

Step 2: Click the download button
The user clicks the download button in the right upper corner of the viewer. This is the action the viewer offers for retrieving the file being displayed. The step is taken because the redirect does not happen on its own: the viewer has to be asked to act on the supplied address, and the download button is the ordinary, innocent looking control that does it.
Step 3: Observe the redirect
https://evildomain.xx/EvilFile.xx
This is the address the browser ends up at. The browser is redirected to the external URL supplied in the file parameter, and any file will be downloaded instantly. The report notes that no user authentication is required for the user to be redirected, and that all ownCloud installations in the wild are vulnerable to this attack. The step is taken to confirm that the value from step 1 is what decides the destination, and that the visitor leaves the trusted site.
Phishing scenario
The report frames the bug as a phishing primitive. Phishing is a con in which a message pretends to come from someone trustworthy to make the recipient click a link or hand over information. The example message asks the recipient to view shared files by following a link and, if the file is not opened automatically, to click the download button in the right upper corner. The link is:
https://demo.owncloud.org/index.php/apps/files_pdfviewer?file=https://evildomain.xx/remote.php/webdav/Demo.pdf%20%3CIf%20this%20file%20is%20not%20available%20please%20click%20the%20dowload%20button%20on%20the%20right%20upper%20corner%3E
The parameter value is an external URL whose path points at remote.php/webdav/Demo.pdf, followed by a percent encoded string. Percent encoding is how special characters travel inside a web address: %20 stands for a space, %3C for < and %3E for >. Decoded, that string reads <If this file is not available please click the dowload button on the right upper corner>. Because the link starts with the legitimate ownCloud demo host, the recipient sees a trusted domain, while the redirect target is the attacker's domain. The step is taken to show how the bug would be used in practice: the trusted name does the convincing, and the message even instructs the victim to press the very button that triggers the redirect.

Root cause
The report does not include code or a patch, so the exact defect is not shown. What the behaviour implies is that the file parameter is used as the redirect target for the download action without being restricted to the ownCloud instance, so an absolute external URL is accepted and followed. The viewer's own handling does not neutralise this: the remote file is not rendered in the viewer, but the download button still acts on the supplied URL. Whether any validation existed and why it failed is not stated in the report.
Impact
A non authenticated user who follows a crafted files_pdfviewer link and clicks the download button is sent to an attacker chosen domain. The report's phishing example shows the practical use: the link begins with the trusted ownCloud host, which lends credibility, and the redirect lands on the attacker's site. The report states that all ownCloud installations in the wild are vulnerable. It does not describe any further consequence beyond the redirect and the file download.
Fix
What the behaviour calls for is to stop treating the file parameter as an arbitrary redirect target, for example by only accepting references that resolve inside the ownCloud instance and rejecting absolute external URLs before the download action uses them.
Variants to test
- Other viewer or preview apps that take a file parameter and offer a download action. A positive result is the same pattern: the remote file does not render, but the download button sends the browser to the external host.
- Different encodings of the external URL in the
fileparameter, such as percent encoded or double encoded forms. A positive result is a redirect to the decoded external host. - Absolute URLs with paths that mimic internal endpoints, as in the phishing example's
remote.php/webdav/Demo.pdfpath. A positive result is that the path does not constrain the redirect and the browser still leaves for the external domain. - The same endpoint without authentication, to confirm the precondition the report states. A positive result is the redirect occurring for a user who never logged in.
Hunting notes
This kind of bug hides in features that accept a file reference and then act on it in a second step, such as preview and viewer apps with a download button. During recon, the signal is a parameter that takes a URL or path and is reflected into a redirect or a download action rather than being resolved against the local instance. The report shows impact by pairing the redirect with a phishing message whose link starts on the legitimate ownCloud host, and it states that no authentication is needed. The bounty recorded for the report was 150.00 USD.
Glossary
- ownCloud: software an organisation installs on its own server to store and share files, like a private cloud drive.
- App (in ownCloud): an optional add-on that gives ownCloud extra features, here the PDF viewer.
- files_pdfviewer: the ownCloud app that displays PDF files in the browser.
- Endpoint: one specific address on a website that performs one particular job.
- Parameter: a named value attached to a web address after a question mark, used to pass information to the page.
- URL: the full address of something on the web, such as
https://demo.owncloud.org/index.php/apps/files_pdfviewer. - Domain: the name part of a web address that identifies a site, such as
demo.owncloud.orgorevildomain.xx. - Host: the server a domain name points to; used here interchangeably with domain.
- Absolute URL: a complete web address including the domain, as opposed to a path that only makes sense inside one site.
- Path: the part of a web address after the domain that points at a particular place on the site, such as
/index.php/apps/files_pdfviewer. - Open redirect: a flaw where a trusted site can be made to forward a visitor to any address an attacker chooses.
- Redirect: an instruction from a server or page that tells the browser to go to a different address.
- Authentication: proving who you are, usually by logging in.
- Non authenticated user: a visitor who has not logged in.
- Remote: reachable over the network from another machine, not only locally.
- Version: the particular release of a piece of software, here v1.0.712.
- Vulnerable: containing a weakness that can be abused.
- Phishing: a con in which a message pretends to come from someone trustworthy to make the recipient click a link or give something away.
- Percent encoding: a way of writing special characters inside a web address, for example
%20for a space and%3Cfor<. - Decode: turning percent encoded text back into the characters it stands for.
- Root cause: the underlying reason a flaw exists in the software.
- Validation: checking that a value is acceptable before using it.
- Patch: a code change that fixes a flaw.
- Recon: the information gathering phase of security testing, looking for features and inputs worth probing.
- Bounty: a reward paid to a researcher for reporting a valid security flaw.
- POC: proof of concept, a demonstration that a flaw is real.