Exploiting SMB vulnerabilities
NSE allows quick prototyping of proof-of-concept code to exploit a vulnerability due to the robust libraries available for protocols and applications. SMB has been heavily attacked in the past due to the amount of public critical vulnerabilities that surfaced. Since Nmap has a library for SMB, we can use it for crafting special packets and writing exploits easily.
This recipe will teach you how to write a vulnerability detection script for the infamous SMB vulnerability known as EternalBlue (MS17-010).
How to do it...
- Start by writing the mandatory fields such as description, author, license, and categories, and loading the required libraries for SMB and other common tasks:
local nmap = require 'nmap' local smb = require 'smb' local vulns = require 'vulns' local stdnse = require 'stdnse' local string = require 'string'
- Create a function to encapsulate the code related to checking the vulnerability...