Note

.DS_Store 文件是 macOS 操作系统中的一个文件,它存储了其所在文件夹的自定义属性,如文件夹视图选项、图标位置和其他视觉信息。“DS”代表”Desktop Services”。这个文件由 Finder 应用程序在每个文件夹中创建和维护,具有类似于 Windows 中的 desktop.ini 文件的功能。
从 macOS 10.12开始,Finder 不再显示.DS_Store 文件。

1. 漏洞影响


  • 目录结构泄露.DS_Store 文件是 Mac 下 Finder 用来保存如何展示文件/文件夹的数据文件,每个文件夹下对应一个。可能会造成文件目录结构泄漏。
  • 敏感信息泄露:除了目录结构外,.DS_Store 文件还可能包含其他敏感信息,如文件夹的访问权限或特定的文件属性、数据库备份文件、配置文件以及一些缓存文件,甚至是密钥等。

2. 漏洞利用


GitHub - 0xHJK/dumpall: 一款信息泄漏利用工具,适用于.git/.svn/.DS_Store泄漏和目录列出
GitHub - lijiejie/ds_store_exp: A .DS_Store file disclosure exploit. It parses .DS_Store file and downloads files recursively.
GitHub - hanwenzhu/.DS_Store-parser: Parses everything from the .DS_Store files generated by macOS
GitHub - gehaxelt/Python-dsstore: A library for parsing .DS_Store files and extracting file names

3. 漏洞修复和预防


  1. 删除 .DS_Store 文件。
  2. 设置访问权限,禁止访问 .DS_Store 文件。
  3. 在 mac 系统进行设置,禁止生成 .DS_Store 文件。
  4. 如果使用 git,配置 .gitignore 文件,将 .DS_Store 文件忽略。