banner
 .::Exploit::. Re: Bản Lược dịch Hacking Expose 4th PHẦN I Go to original post Author: Stuart McClure (Author), Joel Scambray (Author), George Kurtz (Author) - Translator: phuchn71 - Entry Date: 14/02/2009 01:14:44

Network Mapper (nmap)

Chúng ta hãy quay lại và thảo luận về công cụ quét cơ bản đó là nmap. Công cụ này, như đã đề cập ở phía trên, được viết bởi Fyodor (http:/ /www.insecure.org/nmap). Nmap cung cấp các công cụ quét TCP và UDP. Chúng ta hãy thăm dò một số đặc tính hữu ích của nó.

[tsunami] # rmlaP -h
nmap V. 2.53 Usage: nmap [Scan Type(s)] [Options]
Some Common Scan Types ('*' options require root privileges)
-sT TCP connect() port scan (default)
* -sS TCP SYN stealth port scan (best all-around TCP scan)
* -sU UDP port scan
-sP ping scan (Find any reachable machines)
* -sF,-sX,-sN Stealth FIN, xmas, or Null scan (experts only)
-sR/-I RPC/Identd scan (use with other scan types)
Some Common Options (none are required, most can be combined) :
* -0 Use TCP/IP fingerprinting to guess remote operating system
-p ports to scan. Example range: '1-1024,1080,6666,31337'
-F only scans ports listed' in nmap-services
-v Verbose. Its use is recommended. Use twice for greater effect.
-PO Don't ping hosts (needed to scan www.microsoft.com and others)
* -Ddecoy_host1,decoy2[, ...] Hide scan using many decoys
-T Gen~ral timing policy.
: -n/-R Never do DNS resolution/Always resolve [defaul: sometimes resolve]
-oN/ -oM Output normal/machine parsable scan logs to
-iL Get targets from file; Use '-' for stdin
* -S /-e Specify source address or network interface 


--interactive Go into interactive mode (then press h for help)

[tsunami] IDap -sS 192.168.1.1 --
Starting nmap V. 2.53 by fyodor@insecure.org
Interesting ports on (192.168.1.11):
(The 1504 ports scanned but not shown below are in state: closed)
Port State Protocol Service
21 open tcp ftp
25 open tcp smtp
42 open tcp nameserver
53 open tcp domain
79 open tcp finger
80 open tcp http
81 open tcp hosts2-ns
106 open tcp pop3pw
110 open tcp pop-3
135 open tcp loc-srv
139 open tcp netbios-ssn
443 open tcp https 


Nmap có một vài đặc tính khác mà chúng ta cần phải khám phá. Như trên chúng ta đã tham khảo một số cư pháp được sử dụng để quét một hệ thống. Tuy nhiên, nmap còn cho phép chúng ta quét toàn bộ mạng một cách rất dễ dàng. Như các bạn đã thấy, nmap cho phép chúng ta nhập hàng dãy CIDR (Classless Inter-Domain Routing), các ghi chú (see RFC 1519-http://www.ietf.org/rfc/ rfc1519.txt), một thuận tiện cho phép chúng ta liệt kê dải IP từ 192.168.1.1-192.168.1.254. Nó cũng cho phép chúng ta sử dụng dấu tuỳ chọn –o để tách các file, Tuỳ chọn –oN cho phép ghi lại các kết quả dưới khuôn dạng đọc được.

[tsunami]# nmap -sF" 192.168.1.0/24 -oN outfile
Nếu bạn muốn ghi lại kết quả của bạn dưới dạng bảng hồ sơ và phân tích các kết quả về sau thì sử dụng cú pháp –oM. Khi mà chúng ta nhận được quá nhiều các thông tin từ quá trình quét này thì chúng ta ghi lại các kết quả đó theo từng file từng khuôn dạng, trường hợp này cũng cho phép bạn kết hợp cả cú pháp lệnh –oN và –oM trên cả hai khuôn dạng
Hãy suy nghĩ rằng sau khi thu thập thông tin mục thiêu của tổ chức nào đó, chúng ta phát hiện ra rằng họ đã sử dụng một bộ lọc gói tin đơn giống như là một thiết bị firewall của họ. Trong trường hợp này chúng ta có thể sử dụng tuỳ chọn –f của nmap để bẻ gãy gói tin. Đặc biệt hơn, tuỳ chọn này có thể chia gói tiêu đề TCP ra nhiều gói khác nhau, nó chắc chắn là tạo nên các khó khăn khi chúng ta thâm nhập và điều khiển các thiết bị hoặc hệ thống IDS phát hiện ra quá trình quét.. Phần lớn các trường hợp các thiết bị lọc gói tin hiện đại và các ứng dụng cơ bản của tường lửa sẽ xếp hàng tất cả các phân mảnh IP trước khi ước lượng chúng. Có khả năng là các thiết bị điều khiển cũ hoặc cần được nâng cấp sẽ không phân mảnh gói tin trước khi chuyển chúng qua.
Dựa vào độ phức tạp của mạng mục tiêu và host, quét càng lâu thì càng dễ bị phát hiện. Nmap cung cấp thêm bẫy có khả năng thiết kế để áp đảo site mục tiêu với các thông tin không cần thiết bằng cách sử dụng tuỳ chọn –D. Giả thuyết cơ bản là phía sau tuỳ chọn này có một bẫy quét scan khi mà chương trình quét chính đang thực hiện.Kết quả này có được chính là do sự giả mạo (spoofing) địa chỉ nguồn của server xác thực và sự hoà trộn giữa quá trình quét không có thật với quá trình quét cổng có thật. Hệ thống mục tiêu sau đó sẽ có phản hồi với địa chỉ giả mạo cũng như vậy với cổgn thực tế bạn quét. Tuy nhiên, site mục tiêu sẽ chịu một gánh nặng khi mà phải cố gắng theo dõi mọi thứ từ quét đến xác định rằng cái nào là xác định, cái nào là không có thật. Một đièu quan trọng cần phải nhớ đó là địa chỉ bẫy cần luôn phải tồn tại, hoặc nếu không thì việc scan của bạn có thể làm lụt các gói SYN tho hệ thống mục tiêu và dẫn đến tình trạng từ chối dịch vụ.( denial of service condition).

[tsunami] nmap -sS 192.168.1.1 -D 10.1.1.1
www.target_web.com,ME -p25,139,443

Starting nmap V. 2.53 by fyodor@insecure. org
Interesting ports on (192.168.1.1):
Port State Protocol Service
25 open tcp smtp
443 open tcp https
Nmap run completed --1 IP address (1 host up) scanned in 1 second  


Trong ví dụ trên, nmap cung cấp các khả năng cho bẫy quét, nó làm khó hơn cho việc nhận thức quét các cổng xác thực từ một cái không có thật nào đó.
Một công cụ scanning hiệu quả được thể hiện bởi ident scanning . Ident (see RFC 1413-http://www.ietf.org/rfc/rfc1413.txt). Nó được sử dụng để xác định nhận dạng (identity) của người dùng bằng cách qua một kết nối đặc biệt TCP qua cổng 113. Rất nhiều các phiên bản trước của Ident sẽ phản hồi lại với người sở hữu nó qua quá trình đó bắt buộc phải qua các cổng đặc biệt.

[tsunami] nmap -1 192.168.1.10
Starting nmap V. 2.53 by fyodor@insecure.org
Port State Protocol Service Owner
22 open tcp ssh root
25 open tcp smtp root
80 open tcp http root
110 open tcp pop-3 root
113 open tcp auth root
6000 open tcp  
X11 root

Notice that in the preceding we can actually determine the owner of each process. The astute reader may have noticed that the web server is running as "root" instead of as an unprivileged user such as "nobody." This is a very poor security practice. Thus, by performing an ident scan, we know that if the H1TP service were to be compromised by allowing an unauthorized user to execute commands, attackers would be rewarded with instant root access.
The final scanning technique discussed is FTP bounce scanning. The FfP bounce attack was thrust into the spotlight by Hobbit. In his posting to Bugtraq in 1995 http://www.securi tyfocus.com/templates/archive. pike ?list= 1 &msg= 199507120620. CAA 1817 6@narq.avian.org), he outlines some of the inherent flaws in the FfP protocol (RFC 959-http://www.ietf.org/rfc/rfc0959.txt). While dreadfully arcane and virtually unusable on the Internet today, the FTP bounce attack is an insidious method of laundering connections through an FTP server by abusing the support for "proxy" FTP connections. As Hobbit pointed out in the aforementioned post, FfP bounce attacks "can be used to post virtually untraceable mail and news, hammer on servers at various sites, fill up disks, try to hop firewalls, and generally be annoying and hard to track down at the same time." Moreover, you can bounce port scans off the FTP server to hide your identity, or better yet, bypass access control mechanisms.
Of course, nmap supports this type of scan with the -b option; however, a few conditions must be present. First, the FTP server must have a writable and readable directory such as / incoming. Second, the FfP server must allow nmap to feed bogus port information to it via the PORT command. While this technique is very effective in bypassing access control devices as well as hiding one's identity, it can be a very slow process.
Additionally, many new versions of the FfP server do not allow this type of nefarious activity to take place.
Now that we have demonstrated the requisite tools to perform port scanning, it is necessary to understand how to analyze the data that is received from each tool. Regardless of the tool used, we are trying to identify open ports that provide telltale signs of the operating system. For example, when ports 139 and 135 are open, a high probability exists that the target operating system is Windows NT. Windows NT normally listens on port 135 and port 139. This differs from Windows 95/98, which only listen on port 139.
Reviewingthe strobe output further (seeearlier), we can see many services running on this system. If we were to make an educated guess, this system seems to be running some flavor of UNIX. We arrived at this conclusion because the portmapper (111), Berkeley R services ports (512-514), NFS (2049), and high number ports 3277)( and above were all listening. The existence of such ports normally indicates that this system is running UNIX. Moreover, if we had to guess the flavor of UNIX, we would have guessed Solaris.
We know in advance that Solaris normally runs its RPC services in this range of 3277X.
Just remember that we are making assumptions and that the type could potentially be something other than Solaris.
By performing a simple TCP and UDP port scan, we can make quick assumptions on the exposure o( the systems we are targeting. For example, if port 139 is open on a Windows NT server, it may be exposed to a great deal of risk. Chapter 5 discusses the inherent
[digg] [delicious] [google] [yahoo] [technorati] [reddit] [stumbleupon]
Other posts in the same group:

Re: Bản Lược dịch Hacking Expose 4th PHẦN I
Go to top Go to original post  

Powered by JForum - Extended by HVAOnline
 hvaonline.net  |  hvaforum.net  |  hvazone.net  |  hvanews.net  |  vnhacker.org
1999 - 2013 © v2012|0504|218|