CWE-552: Files or Directories Accessible to External Parties
Description
The product makes files or directories accessible to unauthorized actors, even though they should not be.
Submission Date :
July 19, 2006, midnight
Modification Date :
2023-10-26 00:00:00+00:00
Organization :
MITRE
Extended Description
Web servers, FTP servers, and similar servers may store a set of files underneath a "root" directory that is accessible to the server's users. Applications may store sensitive files underneath this root without also using access control to limit which users may request those files, if any. Alternately, an application might package multiple files or directories into an archive file (e.g., ZIP or tar), but the application might not exclude sensitive files that are underneath those directories.
In cloud technologies and containers, this weakness might present itself in the form of misconfigured storage accounts that can be read or written by a public or anonymous user.
Example - 1
The following Azure command updates the settings for a storage account: However, "Allow Blob Public Access" is set to true, meaning that anonymous/public users can access blobs. The command could be modified to disable "Allow Blob Public Access" by setting it to false.az storage account update --name <storage-account> --resource-group <resource-group> --allow-blob-public-access true
az storage account update --name <storage-account> --resource-group <resource-group> --allow-blob-public-access false
Example - 2
The following Google Cloud Storage command gets the settings for a storage account named 'BUCKET_NAME': Suppose the command returns the following result: This result includes the "allUsers" or IAM role added as members, causing this policy configuration to allow public access to cloud storage resources. There would be a similar concern if "allAuthenticatedUsers" was present. The command could be modified to remove "allUsers" and/or "allAuthenticatedUsers" as follows:
gsutil iam get gs://BUCKET_NAME
"projectEditor: PROJECT-ID","projectOwner: PROJECT-ID"
"members":[],"role":"roles/storage.legacyBucketOwner"
"allUsers","projectViewer: PROJECT-ID"],"role":"roles/storage.legacyBucketReader"
"members":[}
"bindings":[{},{]
{}
gsutil iam ch -d allUsers gs://BUCKET_NAMEgsutil iam ch -d allAuthenticatedUsers gs://BUCKET_NAME
Related Weaknesses
This table shows the weaknesses and high level categories that are related to this weakness. These relationships are defined to give an overview of the different insight to similar items that may exist at higher and lower levels of abstraction.
CWE-219: Storage of File with Sensitive Data Under Web Root
CWE-220: Storage of File With Sensitive Data Under FTP Root
CWE-285: Improper Authorization
CWE-527: Exposure of Version-Control Repository to an Unauthorized Control Sphere
CWE-528: Exposure of Core Dump File to an Unauthorized Control Sphere
CWE-529: Exposure of Access Control List Files to an Unauthorized Control Sphere
CWE-530: Exposure of Backup File to an Unauthorized Control Sphere
CWE-539: Use of Persistent Cookies Containing Sensitive Information
CWE-553: Command Shell in Externally Accessible Directory
CWE-668: Exposure of Resource to Wrong Sphere
Visit http://cwe.mitre.org/ for more details.