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 Vulnerable Codes

Example - 1

The following Azure command updates the settings for a storage account:

az storage account update --name <storage-account> --resource-group <resource-group> --allow-blob-public-access true

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 false

Example - 2

The following Google Cloud Storage command gets the settings for a storage account named 'BUCKET_NAME':


gsutil iam get gs://BUCKET_NAME

Suppose the command returns the following result:





"projectEditor: PROJECT-ID","projectOwner: PROJECT-ID"
"members":[],"role":"roles/storage.legacyBucketOwner"

"allUsers","projectViewer: PROJECT-ID"],"role":"roles/storage.legacyBucketReader"
"members":[}
"bindings":[{},{]
{}

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 ch -d allUsers gs://BUCKET_NAMEgsutil iam ch -d allAuthenticatedUsers gs://BUCKET_NAME

Visit http://cwe.mitre.org/ for more details.

© cvefeed.io
Latest DB Update: Dec. 22, 2024 5:20