Figure 1: Attempting to connect based on normal authentication
Now let's look at another scenario. What happens when manually setting a connection to a host that has the resource we want to access, but instead of providing it with a username and password without privileges, we provide the username provided by Administrator and administrator hash that we have stolen? Remember, all here the host is interested in is receiving a hash that corresponds to what it expects. That means that you don't have to perform a one-way hash on the password, just provide the hash, which is the most basic for this attack.
Figure 2: Pass the hash directly to the destination host
Use Metasploit to Pass the Hash
We have introduced you to the theory behind the attack and now is the time to execute it. In this test, we will pass a stolen hash of an administrator-privileged user to a victim system. To accomplish this task, we need two things. First, we need a hash of the administrator user. There are many different methods to obtain password hash, you can refer to the implementation here. Along with stolen hash, we need a copy of Metasploit, this is a tool that we will use to perform this attack.
Metasploit is a framework for penetration testing (free) developed by HD Moore, now of Rapid7. You can download Metasploit here.
Alternatively, you can download and use Backtrack 4. BT4 is a Linux live-CD distribution designed specifically for hacking and testing penetration that comes with a myriad of pre-installed and compiled tools, including Metasploit. You can download BT4 here. Once downloaded, you will find Metasploit in the / pentest / exploit / framework3 directory. The example images used in the rest of this article are taken from BT4.
With stolen hash and Metasploit in hand, we will start preparing for the attack. To start, you must launch the Metasploit console. In BT4, you can do so by browsing to / pentest / exploit / framework3 and typing ./msfconsole .
Figure 3: Launch the Metasploit interface
Metasploit is a framework, depending on the use of different modules to perform its actions. In this case, we will use the psexec module. Psexec is a very popular tool and is used to execute processes on remote systems and redirect the output of those processes back to the system you are using. To use this module, use windowssmbpsexec and press Enter . The shell will prompt you to change it to correspond to the use of this module.
Figure 4: Using the psexec module
Next we need to set up the distribution load. Metasploit will open a basic connection to our victim so that when the username and hash have provided us with the correct authentication, the payload will detect what is being executed using psexec. In this case, we have all done bad intentions for the victim instead of opening a program. One of the effective methods for implementing is to use an inverted TCP shell. This is the payload that will execute an instance of cmd.exe and move it back through our connection so that we can access it remotely. To use this payload , type set payload windows / shell_reverse_tcp .
Figure 5: Set the load for the reverse TCP shell
To use this module and load, there are several options that we need to configure. To see the options, you can type in some of the options displayed and press Enter .
Figure 6: Configurable options for the current module and load
To set the necessary options for your job, we need to use the syntax ' set [option name] [value] '. Values need to be set:
In most cases, there are only four options that need to be configured, while other options can be defaulted. When configuring all of these options, the output options will be similar to those shown in Figure 7:
Figure 7: Complete options for this attack
Here, all preparations are complete and we can execute the attack. To perform an attack, type the exploit and press Enter . If successful, you will see a screen similar to the output shown in Figure 8, a Windows command shell. Now we can control the computer without knowing the admin user password.
Figure 8: Successfully exploiting us a Windows command shell
Prevention Pass the Hash
Pass the hash is an action that is difficult to detect and prevent because of the nature of how it exploits the authentication process. There are several things you can do:
Conclude
Pass the hash is a very easy and very dangerous technique for victims. As you have seen in this article, all you need to do for this attack is a pair of tools and a little engine, then the attacker has everything he needs to paralyze the facility. your infrastructure. Hopefully with this knowledge of the attack and some of the detection and containment strategies that we have discussed, you will prepare a more thoughtful way to prevent and respond to this type of attack.