Files Accessible Without Authentication

Private files such as uploads, reports or exports can be downloaded by anyone who has their address, because file requests are not checked for a valid session.

SeverityMedium
CVSS 3.15.9 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N Open in the calculator
CVSS 4.08.2 CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N Open in the calculator
CWECWE-552: Files or Directories Accessible to External Parties
OWASP Top 10A01:2025 Broken Access Control
MITRE ATT&CKT1190 Exploit Public-Facing Application
CategoryBroken Access Control

Description

Files that should only be available to particular signed-in users, such as uploaded documents, generated reports, invoices, data exports and attachments, are stored where the web server or a storage service delivers them directly. The application checks the user before showing a link to the file, but the request for the file itself is not checked.

Anyone who obtains or guesses a file's address can therefore download it without a session or account, and the access is not tied to any user. Addresses of private files leak more widely than is often assumed: through browser history, shared emails and chat messages, proxy and server logs, Referer headers sent to third parties, and search engine indexing of any page that links to them. Where names are predictable, every file of that kind can be downloaded by script; long random names reduce the risk to files whose addresses have leaked, but do not remove it. The impact depends on the content: personal data, identity documents, financial records and commercially sensitive reports are common, and their exposure may also create regulatory obligations for the organisation.

The weakness is identified by taking the address of a private file and requesting it again with no session cookie or token, for example from a private browser window, and with a different user's session. File names and paths are then examined: sequential numbers, dates, user identifiers or original file names make other files easy to guess, whereas long random names mean an attacker needs the address itself. Signed links that do not expire, or that stay valid for long periods, show the same weakness in a different form.

Remediation

Check authentication and authorisation every time a private file is requested:

  • Store private files outside the web root, or in a private storage container, so that they cannot be fetched directly.
  • Serve them through an application endpoint that checks, on every request, that the signed-in user may access that specific file, then streams it. To keep the web server doing the transfer, the application can respond with an internal redirect, such as nginx's X-Accel-Redirect header pointing to a location marked internal.
  • Where files must be delivered directly by a storage service or content delivery network, issue short-lived signed links only after the authorisation check.
  • Use long random file identifiers as defence in depth, and send Cache-Control: no-store with private files so that shared caches do not keep copies.
# nginx: files reachable only through the application location /protected-files/ { internal; alias /srv/app/private-files/; }

As an interim measure, deny direct requests to the storage path at the web server. Confirm the fix by requesting private files with no session and with another user's session: both should be refused.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More Web Applications Findings

Every Web Applications finding