Trustwave's 2024 Retail Report Series Highlights Alarming E-Commerce Threats and Growing Fraud Against Retailers. Learn More
Get access to immediate incident response assistance.
Get access to immediate incident response assistance.
Trustwave's 2024 Retail Report Series Highlights Alarming E-Commerce Threats and Growing Fraud Against Retailers. Learn More
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.
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.
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.
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.
Dhervesh Singh is Senior Security Consultant for Trustwave’s EMEA team with over 10 years of working in the information security field and has led IT Health Checks (ITHC) for the local government in the UK.
Trustwave is a globally recognized cybersecurity leader that reduces cyber risk and fortifies organizations against disruptive and damaging cyber threats. Our comprehensive offensive and defensive cybersecurity portfolio detects what others cannot, responds with greater speed and effectiveness, optimizes client investment, and improves security resilience. Learn more about us.
Copyright © 2024 Trustwave Holdings, Inc. All rights reserved.