.DS_Store file

  • PCI 3.2-6.5.1
  • CWE 200
  • CAPEC 152
  • OWASP 2017-A6
  • WASC 33
  • CWE 425
  • WASC 34

The .DS_Store file is a hidden macOS system file created in directories to store metadata such as icon positions, view settings, and folder attributes. When inadvertently uploaded to web-accessible directories, .DS_Store files can leak sensitive information about directory structure, filenames, and other system data. Attackers can use this information to map the application’s file system, locate backup files, configuration files, or other sensitive resources, facilitating further attacks such as file inclusion, information disclosure, or predictable resource access.

Common patterns leading to .DS_Store exposure:

  • Uploading directories from macOS without removing .DS_Store files.
  • Deploying websites or web applications directly from development machines with .DS_Store files included.
  • Misconfigured web servers serving hidden files or ignoring default deny rules.
  • Lack of scanning for hidden files during deployment.

Impacts:

  • Information Disclosure: Reveals directory contents, file names, and potentially sensitive resources.
  • Facilitates Enumeration: Attackers can discover hidden files, backup directories, or configuration files.
  • Increases Attack Surface: Knowledge from .DS_Store can be used for targeted attacks.
  • Reconnaissance Aid: Provides attackers with insight into application structure and potential vulnerabilities.

Detection indicators:

  • Requests to .DS_Store return the file contents in the browser.
  • Security scans flag .DS_Store files in web-accessible directories.
  • Automated tools detect metadata revealing directory structure or filenames.
Remediation

Mitigation strategies focus on preventing exposure and removing unnecessary files:

  1. Remove .DS_Store Files Before Deployment
    Ensure that all hidden files from macOS development environments are deleted prior to deployment.

  2. Block Access via Web Server Configuration
    Deny access to .DS_Store and other hidden files using .htaccess, nginx rules, or server configuration.

  3. Scan Deployment Packages
    Include checks for hidden or unnecessary system files as part of the deployment pipeline.

  4. Educate Developers
    Train teams to be aware of .DS_Store files and their potential risks when deploying web applications.

  5. Automate Cleanup
    Use scripts or deployment tools to automatically remove hidden macOS files.

  6. Monitor and Audit Web Directories
    Regularly review publicly accessible directories to ensure no hidden system files are exposed.

  7. Security Testing
    Include checks for .DS_Store and similar hidden files during penetration testing and automated security scans.

References