Trustwave SpiderLabs Uncovers Critical Cybersecurity Vulnerabilities Exposing Manufacturers to Costly Attacks. Learn More

Trustwave SpiderLabs Uncovers Critical Cybersecurity Vulnerabilities Exposing Manufacturers to Costly Attacks. Learn More

Managed Detection & Response

Eradicate cyberthreats with world-class intel and expertise

Managed Security Services

Expand your team’s capabilities and strengthen your security posture

Consulting & Professional Services

Tap into our global team of tenured cybersecurity specialists

Penetration Testing

Subscription- or project-based testing, delivered by global experts

Database Security

Get ahead of database risk, protect data and exceed compliance requirements

Email Security & Management

Catch email threats others miss with layered security & maximum control

Co-Managed SOC (SIEM)

Eliminate alert fatigue, focus your SecOps team, stop threats fast, and reduce cyber risk

Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
The Trustwave Approach
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Platform
SpiderLabs Fusion Center
Security Operations Centers
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

Network Map NMAP Meets ChatGPT

We’ve now seen a number of different use cases for ChatGPT from marketing, sales, software development and others including from the security field. This platform continues to dominate most of the headlines and impress based on how it’s able to handle questions and topics from various backgrounds.

Many security consultants have started using ChatGPT to assist them in identifying security vulnerabilities in code, write scripts, bug bounties and other creative ways to facilitate the use of this A.I. platform. It’s always a plus to have different views and assistance during a project, and ChatGPT has shown that in this context on how its capabilities can be a valuable tool.

Asking it Security-Related Questions

After seeing numerous examples in blog posts on various ways ChatGPT can be used, I tried to query its knowledge on vulnerabilities, specifically missing CVEs. The idea behind this is to assist security consultants in extracting common vulnerabilities associated with varoius software. 

I used the ‘OpenAI’ library in python to achieve this. Using a simple script found online, I modified it to add a parameter ‘-a’ to ask questions.


Figure 1: Added parameter ‘a’ to ask questions

This is interesting as it has some knowledge on commonly exploited vulnerabilities, which I thought it would, but also CVE ID related to the version. It was interesting to note that ChatGPT knowledge bank consists of CVE ID without being connected to the internet, which means at some point it was potentially introduced to the Common Vulnerability Database by its creators.

Automating NMAP Results and Asking CHATGPT

This then gave me an idea to extract information out of NMAP and feed it to ChatGPT in order to get more information on missing CVEs and potentially more information surrounding the outdated version.


Figure 2: Script running through the NMAP xml file

The image above simply shows the script running through the NMAP xml file, extracting information such as port number, state, server, software, and version. The information fed to ChatGPT is the port number, software, and version, and getting it to list the missing patches and security vulnerabilities related to it. The syntax prompt used is as follows:

Based on port NUMBER and the software SOFTWARE + VERSION running, what are the missing patches and vulnerabilities that can be exploited?

Figure 3: ChatGPT syntax prompt

However, looking at some of the CVE IDs, not all of them were related to OpenSSH. For example, CVE-2019-6103 is still in reserve and has no vulnerability report associated with it.  While it has some information on CVE ID related to the software, not all of it was accurate, as seen above where some of the CVE IDs were not related to the specific version and this in turn provides a false positive during a security assessment.  

Getting ChatGPT to Write Scripts Based on the Results

The following step was to get ChatGPT to write a script in an attempt to create a PoC to enumerate the version (if possible) and verify if the version is vulnerable to specific CVE.

However, the outcome was not what I had in mind. While some of the scripts did make sense; the others probably needed a more in-depth prompt to be provided to ChatGPT to get the right scripts out of it. The following is an example of an inaccurate script:


Figure 4: Example of inaccurate script

Although, when it gets the right CVE and writes an accurate script:


Figure 5: Example of accurate script written with correct CVE


ChatGPT is still growing. While some inaccurate information was shown, the ChatGPT platform is still growing, and its knowledge bank is evolving. This is still a great assistance to security consultants to create tools/scripts during an engagement where time is limited or learning about a vulnerability by using ChatGPT to create a script in order to understand how a vulnerability can be found/exploited and also learn about services/protocols which is new to a consultant during an engagement.

Latest SpiderLabs Blogs

Trustwave SpiderLabs Report: LockBit 3.0 Ransomware Vs. the Manufacturing Sector

As the manufacturing sector continues its digital transformation, Operational Technology (OT), Industrial Control Systems (ICS), and Supervisory Control and Data Acquisition (SCADA) are becoming...

Read More

Overview of the Cyberwarfare used in Israel – Hamas War

On October 7, 2023, the Palestinian organization Hamas launched the biggest attack on Israel in years, resulting in numerous casualties and hostages taken. Israel responded with a large-scale ground...

Read More

The 2023 Retail Services Sector Threat Landscape: A Trustwave Threat Intelligence Briefing

The annual holiday shopping season is poised for a surge in spending, a fact well-known to retailers, consumers, and cybercriminals alike. The latter group, however, is poised to exploit any...

Read More