
nmap
By default Nmap comes fully bundled with NSE (Nmap Scripting-Engine) a fully integrated scripting engine with many useful libraries.
The http library is very commonly used, however many people dont realise they are using the user-agent Mozilla/5.0 (compatible; Nmap Scripting Engine; http://nmap.org/book/nse.html)
This is obviously a value you wouldn’t like to be used when pen-testing, as it would give your presence away on the battlefield, as they say. Additionally, it is easily detected and blocked (Unique to Nmap’s NSE http library).
Furthermore, Mod Security, and many other WAF’s (Web Application Firewalls) etc will quickly catch on to what you’re up to.
For example a ModSecurity rule that detects and blocks this default user agent is:
SecRule REQUEST_HEADERS:User-Agent "@streq Mozilla/5.0 (compatible; Nmap Scripting Engine; http://nmap.org/book/nse.html)" deny
With a good Sec setup on the server using ModSecurity, fail2ban etc would more than likely kick in, dropping your scanner’s connections.
According to the NMAP development team this value is left by “design” and that if you want to change it you have to use --script-args http.useragent="some ua"
when launching your Nmap scans. The problem is that this is burdensome to add (and remember) everytime you need it.
So how do we get around it? Pretty simple actually, You can find the default value in /usr/share/nmap/nselib/http.lua
(At the beginning of the file, a couple of lines after the comments)
local USER_AGENT = stdnse.get_script_args('http.useragent') or "Mozilla/5.0 (compatible; Nmap Scripting Engine; http://nmap.org/book/nse.html)"
Here’s an example of a user agent that should be used in a default setting
local USER_AGENT = stdnse.get_script_args('http.useragent') or "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
You can set it to what ever you like, stealth is key, change it periodically etc.
Anyway, we shall leave it at that, for now.
Check out more of our guides here
708 total views, 3 views today