# 保存的凭证

关于凭证，尤其是 Windows 平台的不同类型的凭证，我们会在稍后章节作讲解。这里指的凭证，更多指的是明文帐号密码，例如存放在文本文件中的明文密码、保存在浏览器里的密码等。

在上一篇，我们讨论了双平台的一些敏感文件，其中一些文件可能已经包含凭证了。除此之外，我们来查看注册表、应用、缓存中所保存的凭证。

### **Windows开机自动登陆**

有些主机会设置开机自动登陆，那么明文的帐号密码会存储于注册表 **HKLM\\SOFTWARE\\Microsoft\\Windows NT\\Currentversion\\Winlogon** 处

提权应用 **winpeas** 可以帮助我们枚举到

[![image.png](https://raven-medicine.com/uploads/images/gallery/2023-03/scaled-1680-/0TnHE6ArhmYgGYeG-image.png)](https://raven-medicine.com/uploads/images/gallery/2023-03/0TnHE6ArhmYgGYeG-image.png)

在注册表中的位置

[![image.png](https://raven-medicine.com/uploads/images/gallery/2023-03/scaled-1680-/ACB2Yhcssm7ZKw36-image.png)](https://raven-medicine.com/uploads/images/gallery/2023-03/ACB2Yhcssm7ZKw36-image.png)

我们可以使用cmd命令 **reg query "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\Currentversion\\Winlogon" /v DefaultPassword** 进行查询

[![image.png](https://raven-medicine.com/uploads/images/gallery/2023-03/scaled-1680-/sGwW6dAX69vL0rus-image.png)](https://raven-medicine.com/uploads/images/gallery/2023-03/sGwW6dAX69vL0rus-image.png)

也可以借助PowerUp或者WinPEAS等提权工具协助我们发现。枚举自动登陆凭证无须管理员特权。

[![image.png](https://raven-medicine.com/uploads/images/gallery/2023-03/scaled-1680-/urFAaDeBEsnv7JNx-image.png)](https://raven-medicine.com/uploads/images/gallery/2023-03/urFAaDeBEsnv7JNx-image.png)

### **浏览器保存的凭证**

而浏览器也会保存着大量的凭证，尤其是工作站上的浏览器。SharpDPAPI ([https://github.com/GhostPack/SharpDPAPI) ](https://github.com/GhostPack/SharpDPAPI)与 SharpChrome ([https://github.com/djhohnstein/SharpChromium](https://github.com/djhohnstein/SharpChromium)) 这两个工具可以协助我们提取在浏览器上保存的凭证。至于原理会在后续章节详细介绍。

[![image.png](https://raven-medicine.com/uploads/images/gallery/2023-05/scaled-1680-/BflCOJOIt2BhrE6Y-image.png)](https://raven-medicine.com/uploads/images/gallery/2023-05/BflCOJOIt2BhrE6Y-image.png)

如上图所示，我们在 web02 上以 serveradm 的身份读取到了 Chrome 浏览器保存的信息，曾以 macro 登陆 **https://raven-medicine.com**，我们找到了明文密码 **Zx1471984#**。

### **应用里保存的凭证**

一些应用也会保存凭证，例如MSSQL管理工具。

[![image.png](https://raven-medicine.com/uploads/images/gallery/2023-03/scaled-1680-/o3r0XY5lGkm27MZb-image.png)](https://raven-medicine.com/uploads/images/gallery/2023-03/o3r0XY5lGkm27MZb-image.png)

[![image.png](https://raven-medicine.com/uploads/images/gallery/2023-03/scaled-1680-/JBI8mJ9q3kvjM8bx-image.png)](https://raven-medicine.com/uploads/images/gallery/2023-03/JBI8mJ9q3kvjM8bx-image.png)