Windows下的渗透测试之提权的基本套路(上)

从t0到t3 - 信息搜集

创新互联一直秉承“诚信做人,踏实做事”的原则,不欺瞒客户,是我们最起码的底线! 以服务为基础,以质量求生存,以技术求发展,成交一个客户多一个朋友!为您提供成都网站设计、网站建设、外贸网站建设、成都网页设计、小程序制作、成都网站开发、成都网站制作、成都软件开发、重庆APP开发公司是成都本地专业的网站建设和网站设计公司,等你一起来见证!

一开始,我们拥有的帐号是一个没有特权的普通账号。假设我们已经在远程或者在本地利用EXP进行了一次攻击并且获得了一个反弹回来的shell。根本上说,在时间t0,我们不知道被攻击的机器是做什么的,它和谁进行连接,我们拥有怎样的权限,甚至它的操作系统是哪个。

因此,开始的时候,我们就需要快速的搜集一些至关重要的信息,这样我们就可以了解一下我们所处环境的情况。

首先,先看看我们连接的什么类型的操作系统

 
 
 
 
  1. C:\Windows\system32> systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
  2. OS Name:                   Microsoft Windows 7 Professional
  3. OS Version:                6.1.7601 Service Pack 1 Build 7601

注:中文环境下,"OS Name"为"OS 名称","OS Version"为"OS 版本"

接着,看下计算机名和我们使用的用户

 
 
 
 
  1. C:\Windows\system32> hostname
  2. b33f
  3. C:\Windows\system32> echo %username%
  4. user1

现在我们有了基本的信息,接下来我们可以列出计算机上的其它用户,并且可以看一下我们当前用户的详细信息。从下面的结果可以看出,user1不是本地用户组Administrators的成员。

 
 
 
 
  1. C:\Windows\system32> net users
  2. User accounts for \\B33F
  3. -------------------------------------------------------------------------------
  4. Administrator            b33f                     Guest
  5. user1
  6. The command completed successfully.
  7. C:\Windows\system32> net user user1
  8. User name                    user1
  9. Full Name
  10. Comment
  11. User's comment
  12. Country code                 000 (System Default)
  13. Account active               Yes
  14. Account expires              Never
  15. Password last set            1/11/2014 7:47:14 PM
  16. Password expires             Never
  17. Password changeable          1/11/2014 7:47:14 PM
  18. Password required            Yes
  19. User may change password     Yes
  20. Workstations allowed         All
  21. Logon script
  22. User profile
  23. Home directory
  24. Last logon                   1/11/2014 8:05:09 PM
  25. Logon hours allowed          All
  26. Local Group Memberships      *Users
  27. Global Group memberships     *None
  28. The command completed successfully.

这是我们暂时需要了解的关于用户的所有信息。接下来我们需要从网络方面搜集信息了。

首先,看一下网络连接和路由表。

 
 
 
 
  1. C:\Windows\system32> ipconfig /all
  2. Windows IP Configuration
  3.    Host Name . . . . . . . . . . . . : b33f
  4.    Primary Dns Suffix  . . . . . . . :
  5.    Node Type . . . . . . . . . . . . : Hybrid
  6.    IP Routing Enabled. . . . . . . . : No
  7.    WINS Proxy Enabled. . . . . . . . : No
  8. Ethernet adapter Bluetooth Network Connection:
  9.    Media State . . . . . . . . . . . : Media disconnected
  10.    Connection-specific DNS Suffix  . :
  11.    Description . . . . . . . . . . . : Bluetooth Device (Personal Area Network)
  12.    Physical Address. . . . . . . . . : 0C-84-DC-62-60-29
  13.    DHCP Enabled. . . . . . . . . . . : Yes
  14.    Autoconfiguration Enabled . . . . : Yes
  15. Ethernet adapter Local Area Connection:
  16.    Connection-specific DNS Suffix  . :
  17.    Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection
  18.    Physical Address. . . . . . . . . : 00-0C-29-56-79-35
  19.    DHCP Enabled. . . . . . . . . . . : Yes
  20.    Autoconfiguration Enabled . . . . : Yes
  21.    Link-local IPv6 Address . . . . . : fe80::5cd4:9caf:61c0:ba6e%11(Preferred)
  22.    IPv4 Address. . . . . . . . . . . : 192.168.0.104(Preferred)
  23.    Subnet Mask . . . . . . . . . . . : 255.255.255.0
  24.    Lease Obtained. . . . . . . . . . : Saturday, January 11, 2014 3:53:55 PM
  25.    Lease Expires . . . . . . . . . . : Sunday, January 12, 2014 3:53:55 PM
  26.    Default Gateway . . . . . . . . . : 192.168.0.1
  27.    DHCP Server . . . . . . . . . . . : 192.168.0.1
  28.    DHCPv6 IAID . . . . . . . . . . . : 234884137
  29.    DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-18-14-24-1D-00-0C-29-56-79-35
  30.    DNS Servers . . . . . . . . . . . : 192.168.0.1
  31.    NetBIOS over Tcpip. . . . . . . . : Enabled
  32. C:\Windows\system32> route print
  33. ===========================================================================
  34. Interface List
  35.  18...0c 84 dc 62 60 29 ......Bluetooth Device (Personal Area Network)
  36.  13...00 ff 0c 0d 4f ed ......TAP-Windows Adapter V9
  37.  11...00 0c 29 56 79 35 ......Intel(R) PRO/1000 MT Network Connection
  38.   1...........................Software Loopback Interface 1
  39.  16...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter
  40.  15...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter \#2
  41.  19...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter \#3
  42.  14...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo-Interface
  43. ===========================================================================
  44. IPv4 Route Table
  45. ===========================================================================
  46. Active Routes:
  47. Network Destination        Netmask          Gateway       Interface  Metric
  48.           0.0.0.0          0.0.0.0      192.168.0.1    192.168.0.104     10
  49.         127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
  50.         127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  51.   127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  52.       192.168.0.0    255.255.255.0         On-link     192.168.0.104    266
  53.     192.168.0.104  255.255.255.255         On-link     192.168.0.104    266
  54.     192.168.0.255  255.255.255.255         On-link     192.168.0.104    266
  55.         224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
  56.         224.0.0.0        240.0.0.0         On-link     192.168.0.104    266
  57.   255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  58.   255.255.255.255  255.255.255.255         On-link     192.168.0.104    266
  59. ===========================================================================
  60. Persistent Routes:
  61.   None
  62. IPv6 Route Table
  63. ===========================================================================
  64. Active Routes:
  65.  If Metric Network Destination      Gateway
  66.  14     58 ::/0                     On-link
  67.   1    306 ::1/128                  On-link
  68.  14     58 2001::/32                On-link
  69.  14    306 2001:0:5ef5:79fb:8d2:b4e:3f57:ff97/128
  70.                                     On-link
  71.  11    266 fe80::/64                On-link
  72.  14    306 fe80::/64                On-link
  73.  14    306 fe80::8d2:b4e:3f57:ff97/128
  74.                                     On-link
  75.  11    266 fe80::5cd4:9caf:61c0:ba6e/128
  76.                                     On-link
  77.   1    306 ff00::/8                 On-link
  78.  14    306 ff00::/8                 On-link
  79.  11    266 ff00::/8                 On-link
  80. ===========================================================================
  81. Persistent Routes:
  82.   None

arp -A 展示了ARP缓存表.

 
 
 
 
  1. C:\Windows\system32> arp -A
  2. Interface: 192.168.0.104 --- 0xb
  3.   Internet Address      Physical Address      Type
  4.   192.168.0.1           90-94-e4-c5-b0-46     dynamic
  5.   192.168.0.101         ac-22-0b-af-bb-43     dynamic
  6.   192.168.0.255         ff-ff-ff-ff-ff-ff     static
  7.   224.0.0.22            01-00-5e-00-00-16     static
  8.   224.0.0.251           01-00-5e-00-00-fb     static
  9.   224.0.0.252           01-00-5e-00-00-fc     static
  10.   239.255.255.250       01-00-5e-7f-ff-fa     static
  11.   255.255.255.255       ff-ff-ff-ff-ff-ff     static

下面可以看到活动的网络连接和防火墙规则

 
 
 
 
  1. C:\Windows\system32> netstat -ano
  2. Active Connections
  3.   Proto  Local Address          Foreign Address        State           PID
  4.   TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       684
  5.   TCP    0.0.0.0:445            0.0.0.0:0              LISTENING       4
  6.   TCP    0.0.0.0:5357           0.0.0.0:0              LISTENING       4
  7.   TCP    127.0.0.1:5354         0.0.0.0:0              LISTENING       1400
  8.   TCP    192.168.0.104:139      0.0.0.0:0              LISTENING       4
  9.   TCP    [::]:135               [::]:0                 LISTENING       684
  10.   TCP    [::]:445               [::]:0                 LISTENING       4
  11.   TCP    [::]:5357              [::]:0                 LISTENING       4
  12.   UDP    0.0.0.0:5355           *:*                                    1100
  13.   UDP    0.0.0.0:52282          *:*                                    976
  14.   UDP    0.0.0.0:55202          *:*                                    2956
  15.   UDP    0.0.0.0:59797          *:*                                    1400
  16.   UDP    127.0.0.1:1900         *:*                                    2956
  17.   UDP    127.0.0.1:65435        *:*                                    2956
  18.   UDP    192.168.0.104:137      *:*                                    4
  19.   UDP    192.168.0.104:138      *:*                                    4
  20.   UDP    192.168.0.104:1900     *:*                                    2956
  21.   UDP    192.168.0.104:5353     *:*                                    1400
  22.   UDP    192.168.0.104:65434    *:*                                    2956
  23.   UDP    [::]:5355              *:*                                    1100
  24.   UDP    [::]:52281             *:*                                    976
  25.   UDP    [::]:52283             *:*                                    976
  26.   UDP    [::]:55203             *:*                                    2956
  27.   UDP    [::]:59798             *:*                                    1400
  28.   UDP    [::1]:1900             *:*                                    2956
  29.   UDP    [::1]:5353             *:*                                    1400
  30.   UDP    [::1]:65433            *:*                                    2956
  31.   UDP    [fe80::5cd4:9caf:61c0:ba6e%11]:1900  *:*                      2956
  32.   UDP    [fe80::5cd4:9caf:61c0:ba6e%11]:65432  *:*                     2956

接下来的两个netsh命令是不能在所有操作系统都通用的命令的例子,netsh firewall命令只能在XP SP2及其以上版本的操作系统使用。

 
 
 
 
  1. C:\Windows\system32> netsh firewall show state
  2. Firewall status:
  3. -------------------------------------------------------------------
  4. Profile                           = Standard
  5. Operational mode                  = Enable
  6. Exception mode                    = Enable
  7. Multicast/broadcast response mode = Enable
  8. Notification mode                 = Enable
  9. Group policy version              = Windows Firewall
  10. Remote admin mode                 = Disable
  11. Ports currently open on all network interfaces:
  12. Port   Protocol  Version  Program
  13. -------------------------------------------------------------------
  14. No ports are currently open on all network interfaces.
  15. C:\Windows\system32> netsh firewall show config
  16. Domain profile configuration:
  17. -------------------------------------------------------------------
  18. Operational mode                  = Enable
  19. Exception mode                    = Enable
  20. Multicast/broadcast response mode = Enable
  21. Notification mode                 = Enable
  22. Allowed programs configuration for Domain profile:
  23. Mode     Traffic direction    Name / Program
  24. -------------------------------------------------------------------
  25. Port configuration for Domain profile:
  26. Port   Protocol  Mode    Traffic direction     Name
  27. -------------------------------------------------------------------
  28. ICMP configuration for Domain profile:
  29. Mode     Type  Description
  30. -------------------------------------------------------------------
  31. Enable   2     Allow outbound packet too big
  32. Standard profile configuration (current):
  33. -------------------------------------------------------------------
  34. Operational mode                  = Enable
  35. Exception mode                    = Enable
  36. Multicast/broadcast response mode = Enable
  37. Notification mode                 = Enable
  38. Service configuration for Standard profile:
  39. Mode     Customized  Name
  40. -------------------------------------------------------------------
  41. Enable   No          Network Discovery
  42. Allowed programs configuration for Standard profile:
  43. Mode     Traffic direction    Name / Program
  44. -------------------------------------------------------------------
  45. Enable   Inbound              COMRaider / E:\comraider\comraider.exe
  46. Enable   Inbound              nc.exe / C:\users\b33f\desktop\nc.exe
  47. Port configuration for Standard profile:
  48. Port   Protocol  Mode    Traffic direction     Name
  49. -------------------------------------------------------------------
  50. ICMP configuration for Standard profile:
  51. Mode     Type  Description
  52. -------------------------------------------------------------------
  53. Enable   2     Allow outbound packet too big
  54. Log configuration:
  55. -------------------------------------------------------------------
  56. File location   = C:\Windows\system32\LogFiles\Firewall\pfirewall.log
  57. Max file size   = 4096 KB
  58. Dropped packets = Disable
  59. Connections     = Disable

最后,我们大概的看一下计算机上的:计划任务,正在运行的进程,启动的服务,安装的驱动程序。

这条命令将详细的展示出所有的计划任务:

 
 
 
 
  1. C:\Windows\system32> schtasks /query /fo LIST /v
  2. Folder: \Microsoft\Windows Defender
  3. HostName:                             B33F
  4. TaskName:                             \Microsoft\Windows Defender\MP Scheduled Scan
  5. Next Run Time:                        1/22/2014 5:11:13 AM
  6. Status:                               Ready
  7. Logon Mode:                           Interactive/Background
  8. Last Run Time:                        N/A
  9. Last Result:                          1
  10. Author:                               N/A
  11. Task To Run:                          c:\program files\windows defender\MpCmdRun.exe Scan -ScheduleJob
  12.                                       -WinTask -RestrictPrivilegesScan
  13. Start In:                             N/A
  14. Comment:                              Scheduled Scan
  15. Scheduled Task State:                 Enabled
  16. Idle Time:                            Only Start If Idle for 1 minutes, If Not Idle Retry For 240 minutes
  17. Power Management:                     No Start On Batteries
  18. Run As User:                          SYSTEM
  19. Delete Task If Not Rescheduled:       Enabled
  20. Stop Task If Runs X Hours and X Mins: 72:00:00
  21. Schedule:                             Scheduling data is not available in this format.
  22. Schedule Type:                        Daily
  23. Start Time:                           5:11:13 AM
  24. Start Date:                           1/1/2000
  25. End Date:                             1/1/2100
  26. Days:                                 Every 1 day(s)
  27. Months:                               N/A
  28. Repeat: Every:                        Disabled
  29. Repeat: Until: Time:                  Disabled
  30. Repeat: Until: Duration:              Disabled
  31. Repeat: Stop If Still Running:        Disabled
  32. [..Snip..]

下面的这条命令将正在运行的进程和该进程启动的服务列了出来:

 
 
 
 
  1. C:\Windows\system32> tasklist /SVC
  2. Image Name                     PID Services
  3. ========================= ======== ============================================
  4. System Idle Process              0 N/A
  5. System                           4 N/A
  6. smss.exe                       244 N/A
  7. csrss.exe                      332 N/A
  8. csrss.exe                      372 N/A
  9. wininit.exe                    380 N/A
  10. winlogon.exe                   428 N/A
  11. services.exe                   476 N/A
  12. lsass.exe                      484 SamSs
  13. lsm.exe                        496 N/A
  14. svchost.exe                    588 DcomLaunch, PlugPlay, Power
  15. svchost.exe                    668 RpcEptMapper, RpcSs
  16. svchost.exe                    760 Audiosrv, Dhcp, eventlog,
  17.                                    HomeGroupProvider, lmhosts, wscsvc
  18. svchost.exe                    800 AudioEndpointBuilder, CscService, Netman,
  19.                                    SysMain, TrkWks, UxSms, WdiSystemHost,
  20.                                    wudfsvc
  21. svchost.exe                    836 AeLookupSvc, BITS, gpsvc, iphlpsvc,
  22.                                    LanmanServer, MMCSS, ProfSvc, Schedule,
  23.                                    seclogon, SENS, ShellHWDetection, Themes,
  24.                                    Winmgmt, wuauserv
  25. audiodg.exe                    916 N/A
  26. svchost.exe                    992 EventSystem, fdPHost, netprofm, nsi,
  27.                                    WdiServiceHost, WinHttpAutoProxySvc
  28. svchost.exe                   1104 CryptSvc, Dnscache, LanmanWorkstation,
  29.                                    NlaSvc
  30. spoolsv.exe                   1244 Spooler
  31. svchost.exe                   1272 BFE, DPS, MpsSvc
  32. mDNSResponder.exe             1400 Bonjour Service
  33. taskhost.exe                  1504 N/A
  34. taskeng.exe                   1556 N/A
  35. vmtoolsd.exe                  1580 VMTools
  36. dwm.exe                       1660 N/A
  37. explorer.exe                  1668 N/A
  38. vmware-usbarbitrator.exe      1768 VMUSBArbService
  39. TPAutoConnSvc.exe             1712 TPAutoConnSvc
  40. [..Snip..]
 
 
 
 
  1. C:\Windows\system32> net start
  2. These Windows services are started:
  3.    Application Experience
  4.    Application Information
  5.    Background Intelligent Transfer Service
  6.    Base Filtering Engine
  7.    Bluetooth Support Service
  8.    Bonjour Service
  9.    COM+ Event System
  10.    COM+ System Application
  11.    Cryptographic Services
  12.    DCOM Server Process Launcher
  13.    Desktop Window Manager Session Manager
  14.    DHCP Client
  15.    Diagnostic Policy Service
  16.    Diagnostic Service Host
  17.    Diagnostic System Host
  18.    Distributed Link Tracking Client
  19.    Distributed Transaction Coordinator
  20.    DNS Client
  21.    Function Discovery Provider Host
  22.    Function Discovery Resource Publication
  23.    Group Policy Client
  24. [..Snip..]

这有时是有用的,一些第三方驱动程序,即使是有信誉的公司,也可能有比瑞士奶酪上的孔还多的的漏洞。这仅仅是有可能的,因为对ring0攻击在大多数人专业技能之外。

 
 
 
 
  1. C:\Windows\system32> DRIVERQUERY
  2. Module Name  Display Name           Driver Type   Link Date
  3. ============ ====================== ============= ======================
  4. 1394ohci     1394 OHCI Compliant Ho Kernel        11/20/2010 6:01:11 PM
  5. ACPI         Microsoft ACPI Driver  Kernel        11/20/2010 4:37:52 PM
  6. AcpiPmi      ACPI Power Meter Drive Kernel        11/20/2010 4:47:55 PM
  7. adp94xx      adp94xx                Kernel        12/6/2008 7:59:55 AM
  8. adpahci      adpahci                Kernel        5/2/2007 1:29:26 AM
  9. adpu320      adpu320                Kernel        2/28/2007 8:03:08 AM
  10. AFD          Ancillary Function Dri Kernel        11/20/2010 4:40:00 PM
  11. agp440       Intel AGP Bus Filter   Kernel        7/14/2009 7:25:36 AM
  12. aic78xx      aic78xx                Kernel        4/12/2006 8:20:11 AM
  13. aliide       aliide                 Kernel        7/14/2009 7:11:17 AM
  14. amdagp       AMD AGP Bus Filter Dri Kernel        7/14/2009 7:25:36 AM
  15. amdide       amdide                 Kernel        7/14/2009 7:11:19 AM
  16. AmdK8        AMD K8 Processor Drive Kernel        7/14/2009 7:11:03 AM
  17. AmdPPM       AMD Processor Driver   Kernel        7/14/2009 7:11:03 AM
  18. amdsata      amdsata                Kernel        3/19/2010 9:08:27 AM
  19. amdsbs       amdsbs                 Kernel        3/21/2009&nbs

    文章名称:Windows下的渗透测试之提权的基本套路(上)
    文章地址:http://www.shufengxianlan.com/qtweb/news9/514209.html

    网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

    广告

    声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联