z3tssu
  • README
  • Cybersecurity Certifications & Notes
    • Cybersecurity Knowledge Base
      • IPPSEC's Video Search for Hacking Methods
      • Finding Someone's Location with Seeker
      • Nishang Project
      • Hacktricks
    • 📜Certifications & Courses
      • 🟢Hackthebox - CPTS
        • Getting Started
          • General
          • Tmux
          • Vim
          • Service Scanning
        • Penetration Testing Process
        • Network Enumeration with Nmap
          • Host Discovery
          • Host and Port Scanning
          • Saving the Nmap Scanning Results
          • Service Enumeration
          • Nmap Scripting Engine
            • Update the Scripting Engine
            • Nmap Script Locations
          • Performance Tags
          • Firewall and IDS/IPS Evasion
        • 👣Footprinting
          • 🔎Host-Based Service Enumeration
            • FTP [21]
              • Basics
                • vsFTPd Detailed Output
                • Hiding IDs - YES
              • Footprinting FTP
                • Nmap FTP Script Scanning
                • Service Interaction
              • FTP Commands
            • SMB [139/445]
              • Basics
                • Default Configuration
                • Create and Manage Samba Share
                • smbstatus
              • Footprinting SMB
                • SMB Nmap Scan
                • Smbclient
                • RPCclient
                  • Useful Commands
                  • Basic Enumeration
                  • Enumerate Users
                  • Group Information
                  • Bruteforcing User RIDs
                • smbmap
                • CrackMapExec
                • Enum4Linux-ng
            • NFS [111,2049]
              • Basics
                • Default Configuration of NFS
                • Creating an NFS Entry
                • Dangerous Settings
              • Footprinting NFS
                • nmap
                  • Basic Scan
                  • NFS Script Scan
                • Mount an NFS Share
                • Unmount NFS
            • DNS [53]
              • Basics
                • DNS Records
                • Default Configuration
                • Dangerous Settings
              • Footprinting DNS
                • DIG - NS QUERY
                • DIG - Version Query
                • DIG - Any Query
                • DIG - AXFR Zone Transfer
                • DIG - AXFR Zone Transfer - Internal
                • Subdomain Bruteforcing (For Loop with Seclists)
                • Subdomain Bruteforce (DNSenum)
            • SMTP (25,587)
              • Telnet SMTP
                • Telnet - HELO/EHLO
                • Telnet - VRFY
                • Telnet - Send an Email
              • Nmap Telnet
              • FTP User Enumeration
            • IMAP/POP3 [110,995,143,993]
              • Default Configuration
            • SNMP[161]
            • MySQL [3306]
            • MSSQL [1433]
            • Oracle TNS [1521]
            • IPMI [623]
            • SSH [22]
            • Rsync [873]
            • R-Services [512, 513, 514]
            • RDP [3389]
            • WinRM [5985, 5986]
            • WMI [135]
          • Introduction
            • Enumeration Principles
            • Enumeration Methodology
          • Infrastructure Enumeration
            • Domain Information
            • Cloud Resource
            • Staff
        • 🕸️Web Information Gathering
          • 🤷‍♂️WHOIS
          • 🧬DNS
            • 🧬DIG
          • 📚Subdomain Enumeration
            • DNS Zone Transfer
            • Sub Domain Bruteforcing
            • Virtual Hosts
              • Gobuster vhosts brutefoce
              • Add Vhosts to /etc/hosts
            • Certificate Transparency Logs
          • 🖐️Fingerprinting
            • Banner Grabbing
            • Web Application Firewall (Wafw00f)
            • Nikto
          • Crawling
            • robots.txt
            • .Well-Known URIs
            • Popular Web-Crawlers
              • Scrapy (ReconSpider)
              • Apache Nutch (Scalable Crawler)
              • Burp Suite Spider
              • OWASP ZAP (ZED Attack Proxy)
          • 🔥Automating Recon
            • FinalRecon
          • 🔍Search Engine Discovery
            • 🔍Google Dorking
            • 🔍Search Operators
          • Web Archives
          • Questions
            • Question 4
            • Question 5
        • Vulnerability Assessment
          • Vulnerability Scanning Tools
            • Nessus
              • Installing and Starting Nessus
              • Nessus Scan Types
              • Nessus Polices
                • Creating a Nessus Policy
              • Nessus Plugins
                • Creating a Plugin Rule
              • Credentialed Scanning
                • HTB Credentials for Nessus
              • Exporting Nessus Scans
              • Scanning Issues
            • OpenVAS
              • Installing OpenVAS
              • OpenVAS Scan
              • Exporting Scans
            • Nexpose
            • Qualys
          • Security Assessments
          • Vulnerability Assessment
          • Assessment Standards
          • Common Vulnerability Scoring System (CVSS)
          • Common Vulnerabilities and Exposures (CVE)
            • Open Vulnerability Assessment Language (OVAL)
          • Reporting
        • 📂File Transfers
          • File Transfer Methods
            • Windows File Transfer Methods
              • ⬇️Download Operations
                • 🪟 PowerShell Base64 Encode & Decode
                • 🌐 PowerShell Web Downloads -
                • 📦 SMB Downloads
                • 🌐 FTP Downloads
              • ↗️Upload Operations
                • 🔐 Encode File Using PowerShell
                • 🌐 PowerShell Web Uploads
                • 🧬 PowerShell Base64 Web Upload
                • 🌐 SMB Uploads with WebDAV Twist
                • 📡 FTP Uploads
            • Linux File Transfer Methods
              • Download Operations
                • 📦 Base64 Encoding / Decoding for File Transfers
                • 🌐 Web Downloads with Wget and cURL
                • 💣 Fileless Attacks in Linux – Execute Directly
                • 🐚 Download with Bash using /dev/tcp
                • 🔐 SSH Downloads with scp
                  • More Usage on SCP
              • Upload Operations
                • 🌐 Web Upload with HTTPS 🚀
                • 🛠️ Quick Web File Transfer Method
                • 🔄 SCP Upload
            • Transferring Files with Code
              • Downloading Files
              • Uploading Files
            • Transfer Files with Netcat, Ncat, RDP
            • Powershell Session File Transfer
            • RDP File Transfer
            • Protected File Transfers
            • Sending Files over HTTP/S
            • Upload and Download with Built in OS Tools
          • Detect or Be Detected
            • Detection
            • Evade Detection
        • 🐚Shells & Payloads
          • The Shell Basics
            • Bind Shell
            • Reverse Shell
          • Creating Payloads
            • Introduction to Payloads
            • Metasploit Payloads
            • Crafting Payloads with MSFvenom
          • Infiltrating Windows
            • 🛠️ MS17-010 EternalBlue
          • Infiltrating Unix/Linux
            • 🐍 Spawning a TTY Shell with Python
            • Spawing Interactive Shells
          • Web Shells
            • 🧪 Laudanum – "One Web Shell to Rule Them All"
            • 🧠 Antak Webshell + ASPX Concepts
            • 🐘 PHP Web Shells
            • Shells & Payloads - The Live Engagement
          • Detection and Prevention
        • 👾Metasploit
          • Introduction
            • 🧰 Introduction to Metasploit Framework (MSF)
            • MSF Engagement Structure
          • MSF Components
            • 🧰 Modules
            • 🎯 Targets
            • 🧠 Payloads
            • 🔧 Encoders?
            • 🗄️ Database
            • 🔌 Plugins
          • MSF Sessions
            • 🔁 Sessions
            • 🛠️ Meterpreter
          • Additional Features
            • 🛠️ Installing & Importing Custom Metasploit Modules
            • 🧠 Porting Scripts into Metasploit Modules
            • 💥 Introduction to MSFVenom
            • 🛡️ Firewall and IDS/IPS Evasion
        • ⚔️Password Attacks
          • Where Credentials are Stored?
          • John The Ripper
          • Remote Password Attacks
            • 🖥️ Network Services
              • WinRM [5985, 5986]
              • SSH [22]
              • RDP [3389]
              • SMB [139,445]
              • Questions
            • 🔐 Password Mutations & Wordlist Generation
            • 🔐 Password Reuse & Default Passwords
          • Windows Local Password Attacks
            • Attacking SAM (Security Account Manager)
            • Attacking LSASS
      • TCM Security - PNPT
      • Cisco Ethical Hacker
      • Introduction to Hacking Methodology
    • Pentesting Services
    • Pentesting Web
      • CBBH
      • TCM Security - Practical Web Hacking
    • Pentesting Wi-Fi
      • OSWP
      • Wireless Penetration Test (WPA2)
    • Pentesting Cloud
    • Network Defense
      • Blue Team Level 1
    • 🐍Scripting with Python
    • ☢️Active Directory Penetration Testing
      • Initial Attack Vectors
      • Post Compromise Enumeration
    • Cybersecurity Job Skills
      • Information Security Officer Guide
    • 🔍IP Address Investigation
      • WHOIS
      • Reverse DNS
      • Geolocation of the IP
      • Check If IP is Active and has Services Running
      • Check the IP Reputation
      • Check Passive DNS History
      • Confirm the Actual Server Location
    • Cybersecurity Projects
      • Wireless Penetration Test (WPA2)
      • AWS Honeypot
      • SOC Analyst Home Lab
      • Threat Management with Wazuh SIEM
    • Cybersecurity Books
    • 🔄SOC
  • IT Certifications & Notes
    • Certifications
      • MS-900 Microsoft 365 Fundamentals
        • Describe Microsoft security and compliance capabilities
          • Describe the functions and identity types of Microsoft Entra ID
          • Describe access management capabilities of Microsoft Entra
            • Introduction
            • Describe Conditional Access
            • Describe Global Secure Access in Microsoft Entra
            • Describe Microsoft Entra roles and role-based access control (RBAC)
      • CISSP
      • ITIL
        • ITIL 4 Foundations
      • CCNA
        • David Bombal - Udemy
        • CCNA Training - Jeremy's IT Lab
          • Resources
          • Cisco Packet Tracer Labs
            • Cisco Packet Tracer Overview
            • Packet Tracer Lab 1
      • MCSE Certification Options
      • AZ-900
    • IT Projects & Training
      • Windows Server 2016 - Active Directory Lab Build
      • Windows Server 2022 Fundamentals
        • Introduction to Server Manager
          • Installing and Configuring Server Manager
          • Creating a VM on Microsoft Azure for Server 2022
        • Introduction to Active Directory
          • Active Directory and Setting up
          • Active Directory Overview
          • Delegation Rights for Active Directory
          • Active Directory Administrative Center
          • Common cmd commands for IT Support
        • Group Policy Management
          • How to apply basic GPO
        • Introduction to Share Folders
          • Creating Share Folders on Server Manager
          • Share Folder Permissions for Users
          • Map a Network Drive (locally)
          • Map a Network Drive through Active Directory
        • Understanding Windows/Common AD Issues
          • Installing RSAT Tools
          • Joining a PC to the Domain
        • Real Life IT Support Issues
          • When a User Gets locked out their accounts
          • Change Password of a User
      • Office 365 For IT Support
        • Office 365 Overview
      • Microsoft Azure Training
        • Getting Started in the Azure Portal
        • Introduction to Microsoft Azure Services
        • Basic Usage of Azure Services
        • Azure Deploy Sql Database Overview
        • Azure AD Connect Overview
        • Azure Microsoft File Share/Map Drives
        • Deploy Windows 11 to Azure
        • Microsoft Azure Basic Fundamentals (Azure Active Directory)
        • Introduction to Vnet (Overview)
        • Microsoft Azure Network/Security
        • Microsoft Azure Tagging (Final Course)
      • Networking Projects with Cisco Packet Tracer
        • Build a Basic Network
        • Webserver Project
      • Setup and Router and Switch
    • IT Knowledge Base
  • CTF/Box WRITEUPS
    • Tryhackme
    • HTB
      • Footprinting Lab - Easy
      • Footprinting Lab - Medium
      • Footprinting Lab - Hard
      • Nessus Skills Assessment
      • OpenVAS Skills Assessment
      • Tier 0
      • Tier 1
  • Cryptocurrency/Blockchain
    • Cryptocurrency Investigation
    • Certifications
      • Certified Blockchain Security Professional
Powered by GitBook
On this page
  • Script Categories
  • Defining Scripts in Nmap
  • 1. Default Scripts
  • 2. Specific Scripts Category
  • 3. Defined Scripts (Multiple Specific Scripts)
  • Example: Specifying Scripts on an SMTP Port
  • Aggressive Scan Option (-A)
  • Vulnerability Assessment Using NSE (vuln Category)
  • Additional Resources
  1. Cybersecurity Certifications & Notes
  2. Certifications & Courses
  3. Hackthebox - CPTS
  4. Network Enumeration with Nmap

Nmap Scripting Engine


💡

  • Overview:

    • NSE allows creation and execution of Lua scripts to interact with various services.

    • It is divided into 14 categories based on the type of tasks the scripts perform.


Script Categories

Category

Description

auth

Determination of authentication credentials.

broadcast

Scripts for host discovery via broadcasting; discovered hosts can be added automatically to scans.

brute

Executes scripts that attempt to log in by brute-forcing credentials.

default

Default scripts executed using the -sC option.

discovery

Evaluates accessible services.

dos

Checks services for denial-of-service vulnerabilities (used sparingly as they can harm services).

exploit

Tries to exploit known vulnerabilities on the scanned port.

external

Uses external services for further processing.

fuzzer

Sends varied fields to detect vulnerabilities and unexpected packet handling (can be time-consuming).

intrusive

Intrusive scripts that might negatively affect the target system.

malware

Checks if the target system is infected with malware.

safe

Defensive scripts that do not perform intrusive or destructive actions.

version

Extensions for service detection.

vuln

Identifies specific vulnerabilities.


Defining Scripts in Nmap

1. Default Scripts

  • Command Example:

    sudo nmap <target> -sC
    

2. Specific Scripts Category

  • Command Example:

    sudo nmap <target> --script <category>
    

3. Defined Scripts (Multiple Specific Scripts)

  • Command Example:

    sudo nmap <target> --script <script-name>,<script-name>,...
    

Example: Specifying Scripts on an SMTP Port

  • Scenario: Use two defined scripts (banner and smtp-commands) against the SMTP port (25).

  • Command:

    sudo nmap 10.129.2.28 -p 25 --script banner,smtp-commands
    
  • Sample Output:

    Starting Nmap 7.80 ( https://nmap.org ) at 2020-06-16 23:21 CEST
    Nmap scan report for 10.129.2.28
    Host is up (0.050s latency).
    
    PORT   STATE SERVICE
    25/tcp open  smtp
    |_banner: 220 inlane ESMTP Postfix (Ubuntu)
    |_smtp-commands: inlane, PIPELINING, SIZE 10240000, VRFY, ETRN, STARTTLS, ENHANCEDSTATUSCODES, 8BITMIME, DSN, SMTPUTF8,
    MAC Address: DE:AD:00:00:BE:EF (Intel Corporate)
    
  • Scanning Options Explanation:

    • 10.129.2.28: Target IP.

    • p 25: Scan only port 25.

    • -script banner,smtp-commands: Run the specified NSE scripts.

  • Key Observations:

    • The banner script reveals the SMTP server banner (shows Ubuntu distribution).

    • The smtp-commands script displays available SMTP commands, which can help identify existing users on the target.


Aggressive Scan Option (-A)

  • Purpose: Combines multiple scanning options:

    • Service detection (sV)

    • OS detection (O)

    • Traceroute (-traceroute)

    • Default NSE scripts (sC)

  • Example Command:

    sudo nmap 10.129.2.28 -p 80 -A
    
  • Sample Output (Partial):

    Starting Nmap 7.80 ( https://nmap.org ) at 2020-06-17 01:38 CEST
    Nmap scan report for 10.129.2.28
    Host is up (0.012s latency).
    
    PORT   STATE SERVICE VERSION
    80/tcp open  http    Apache httpd 2.4.29 ((Ubuntu))
    |_http-generator: WordPress 5.3.4
    |_http-server-header: Apache/2.4.29 (Ubuntu)
    |_http-title: blog.inlanefreight.com
    MAC Address: DE:AD:00:00:BE:EF (Intel Corporate)
    Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
    Aggressive OS guesses: Linux 2.6.32 (96%), Linux 3.2 - 4.9 (96%), ...
    No exact OS matches for host (test conditions non-ideal).
    Network Distance: 1 hop
    
    TRACEROUTE
    HOP RTT      ADDRESS
    1   11.91 ms 10.129.2.28
    
    OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
    Nmap done: 1 IP address (1 host up) scanned in 11.36 seconds
    
  • Scanning Options Explanation:

    • 10.129.2.28: Target IP.

    • p 80: Scan only port 80.

    • A: Performs aggressive scan combining multiple options.

  • Key Findings:

    • Identifies the web server (Apache 2.4.29 on Ubuntu).

    • Detects the web application (WordPress 5.3.4) and webpage title.

    • Provides OS detection (likely Linux, 96% confidence).


Vulnerability Assessment Using NSE (vuln Category)

  • Goal: To check the HTTP service (port 80) for known vulnerabilities.

  • Command:

    sudo nmap 10.129.2.28 -p 80 -sV --script vuln
    
  • Sample Output (Partial):

    Nmap scan report for 10.129.2.28
    Host is up (0.036s latency).
    
    PORT   STATE SERVICE VERSION
    80/tcp open  http    Apache httpd 2.4.29 ((Ubuntu))
    | http-enum:
    |   /wp-login.php: Possible admin folder
    |   /readme.html: Wordpress version: 2
    |   /: WordPress version: 5.3.4
    |   /wp-includes/images/rss.png: Wordpress version 2.2 found.
    |   /wp-includes/js/jquery/suggest.js: Wordpress version 2.5 found.
    |   /wp-includes/images/blank.gif: Wordpress version 2.6 found.
    |   /wp-includes/js/comment-reply.js: Wordpress version 2.7 found.
    |   /wp-login.php: Wordpress login page.
    |   /wp-admin/upgrade.php: Wordpress login page.
    |_  /readme.html: Interesting, a readme.
    |_http-server-header: Apache/2.4.29 (Ubuntu)
    |_http-stored-xss: Couldn't find any stored XSS vulnerabilities.
    | http-wordpress-users:
    | Username found: admin
    |_Search stopped at ID #25. Increase the upper limit if necessary with 'http-wordpress-users.limit'
    | vulners:
    |   cpe:/a:apache:http_server:2.4.29:
    |     	CVE-2019-0211	7.2	https://vulners.com/cve/CVE-2019-0211
    |     	CVE-2018-1312	6.8	https://vulners.com/cve/CVE-2018-1312
    |     	CVE-2017-15715	6.8	https://vulners.com/cve/CVE-2017-15715
    <SNIP>
    
  • Scanning Options Explanation:

    • 10.129.2.28: Target IP.

    • p 80: Scan only port 80.

    • sV: Performs service version detection.

    • -script vuln: Runs all vulnerability-related NSE scripts.

  • What the Scripts Do:

    • Interact with the webserver and its application to gather version details.

    • Query vulnerability databases to identify known vulnerabilities.

    • Examples include enumerating web directories (http-enum), checking server headers, and listing potential exploits (via the vulners script).


Additional Resources


PreviousService EnumerationNextUpdate the Scripting Engine

For more details on NSE scripts and categories, visit:

📜
🟢
NSE Documentation