Trustwave Rapid Response: CrowdStrike Falcon Outage Update. Learn More

Trustwave Rapid Response: CrowdStrike Falcon Outage Update. Learn More

Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

Database Security

Prevent unauthorized access and exceed compliance requirements.

Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Offensive Security
Solutions to maximize your security ROI
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
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
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 Rapid Response: CrowdStrike Falcon Outage Update

Trustwave is proactively assessing and monitoring our clients who may have been impacted by CrowdStrike’s recently rolled-out update for its Windows users. The critical issue identified with...

Read More

Using AWS Secrets Manager and Lambda Function to Store, Rotate and Secure Keys

When working with Amazon Web Services (AWS), we often find that various AWS services need to store and manage secrets. AWS Secrets Manager is the go-to solution for this. It's a centralized service...

Read More

Facebook Malvertising Epidemic – Unraveling a Persistent Threat: SYS01

The Trustwave SpiderLabs Threat Intelligence team's ongoing study into how threat actors use Facebook for malicious activity has uncovered a new version of the SYS01 stealer. This stealer is designed...

Read More