Vulnerability verification code generation method and device based on large language model
By generating vulnerability verification code using a large language model, the problem of time-consuming and manual reliance in traditional vulnerability detection is solved, enabling efficient and automated verification of network security vulnerabilities in power systems and improving the accuracy and efficiency of detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-21
- Publication Date
- 2026-04-10
AI Technical Summary
In the detection of network security vulnerabilities in power systems, traditional vulnerability scanning techniques are time-consuming and rely on manual verification, making it difficult to achieve efficient and accurate vulnerability verification.
A large language model is used to generate vulnerability verification code. By obtaining vulnerability reports and verification codes, key information is extracted, a training dataset is constructed, and prompt words are used to guide the large language model to generate vulnerability verification code. Combined with a local knowledge base and feedback mechanism, automated vulnerability verification is achieved.
It improves the accuracy and timeliness of vulnerability detection, reduces reliance on manual verification, enhances the efficiency and accuracy of vulnerability verification, and provides valuable reference resources.
Smart Images

Figure CN121835674A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method and apparatus for generating vulnerability verification code based on a large language model. Background Technology
[0002] Currently, with the rapid development of network technology and the increasing sophistication of hacker attack methods, network security issues are becoming increasingly prominent. Numerous firmware and protocol vulnerabilities discovered in power system equipment in recent years have placed higher demands on the network security operation and vulnerability detection of power monitoring systems. Traditional vulnerability scanning techniques are time-consuming, and the accurate identification of vulnerabilities largely depends on the professional skills of the vulnerability verifier. Therefore, it is necessary to place greater emphasis on improving network security protection capabilities by introducing advanced security technologies and methods to build a comprehensive, multi-layered network security protection system to ensure the safe and stable operation of the power grid.
[0003] For example, the invention with publication number CN118332557A discloses a source code vulnerability detection method and system based on a large model, including collecting historical source code data and constructing a vulnerability dataset; preprocessing the source code in the vulnerability dataset, converting the preprocessed source code into a token sequence and dividing it into a training dataset and a test dataset; constructing a pre-trained language large model, performing low-rank adaptive processing on each parameter of the pre-trained language large model to obtain pre-training data, and fine-tuning the pre-training data; inputting the prompt text and corresponding vulnerability type labels into the pre-trained language large model for training; and inputting the test dataset into the pre-trained language large model for detection to obtain vulnerability information corresponding to the source code in the test dataset.
[0004] The above-mentioned approach uses a large language model to detect vulnerabilities in source code. However, further vulnerability analysis is still needed for the detected vulnerabilities. Vulnerability analysis tools and technologies in the cybersecurity field have evolved from manual auditing to automation and intelligence, significantly improving the efficiency and accuracy of vulnerability detection and remediation. Therefore, automatically generating vulnerability verification code for vulnerability verification is the most effective method. Summary of the Invention
[0005] The purpose of this invention is to overcome the shortcomings of the existing technology by providing a vulnerability verification code generation method and apparatus based on a large language model, thereby achieving automated generation of vulnerability verification code and improving the accuracy and timeliness of vulnerability detection.
[0006] The objective of this invention can be achieved through the following technical solutions: A vulnerability verification code generation method based on a large language model includes the following steps: Obtain vulnerability reports and verification code, and extract key information; The extracted key information is converted into structured data to build a training dataset; The pre-acquired large language model is trained using the training dataset. During the training process, the large language model is guided by prompt words to generate corresponding vulnerability verification code. The vulnerability verification code includes the input data and logical structure required to trigger the vulnerability. The vulnerability information to be verified is input into the trained large language model to obtain the corresponding vulnerability verification code, and the generated vulnerability verification code is verified and optimized.
[0007] Furthermore, the extracted key information includes the vulnerability number, vulnerability type, and attack payload that triggered the vulnerability.
[0008] Furthermore, the training dataset includes a detailed description of the vulnerability, the input data that triggers the vulnerability, and the expected output results.
[0009] Furthermore, the specific steps involved in guiding the large language model to generate corresponding vulnerability verification code through prompts during training are as follows: Based on the vulnerability requirements, construct common prompt words for similar tasks, build a local knowledge base for user questions, and vectorize and index the local database. Obtain actual user questions, compare them with the content in the local knowledge base, and filter out the top k most similar content items as references; The prompts for the corresponding task type of the user question, the user question itself, and the first k references are combined and input into the large language model to generate the corresponding vulnerability verification code.
[0010] Furthermore, the prompt words include: Environment settings are used to initialize the necessary environment; Input construction is used to construct specific input data based on triggering conditions; The execution logic is used to invoke or simulate user actions to trigger the vulnerability. Result verification is used to check whether the expected results have been achieved.
[0011] Furthermore, the method also includes constructing a prompt template library for storing and managing prompt words; the database table structure of the prompt template library includes: Categories and tags are used to classify and label the vulnerability types and technology stacks to which each hint applies; Version control is used to define the version of the prompt words; Contextual information is used to record background information about the use of prompt words; A feedback mechanism is used to receive user feedback on the effectiveness of the prompt words.
[0012] Furthermore, the large language model generates a template library of standard vulnerability verification code based on the training results, which is used for generating vulnerability verification code; The data structure of the template library for the standard vulnerability verification code includes: Basic information, used to describe the basic information of the vulnerability verification code; Environment configuration, which describes the software environment or hardware conditions required to execute the vulnerability verification code; The vulnerability description explains the nature of the vulnerability, how it is triggered, and the potential harm it may cause. The reproduction steps outline the steps to reproduce the vulnerability using the vulnerability verification code. Code snippets are used to record the code that triggers the vulnerability, and are categorized and stored according to different programming languages or technology stacks; Expected results: This indicates the results that are expected to be observed after executing the vulnerability verification code.
[0013] Furthermore, the basic information includes: unique identifier, CVE number, vulnerability name, vulnerability severity, CVSS score, affected version range, publication date, and last modification date; The environment configuration includes: a unique identifier, an associated vulnerability ID, a required operating system, required software or libraries, software version requirements, and dependencies that need to be installed. The code snippet includes: a unique identifier, an associated vulnerability ID, a programming language, and code; The reproduction steps include: a unique identifier, an associated vulnerability ID, a sequence of steps, and a description of each step.
[0014] Furthermore, the method also includes classifying and labeling the template library of the standard vulnerability verification code by constructing categories and tags, wherein the classification includes classifying the vulnerability verification code according to vulnerability type, affected platform, or severity.
[0015] The present invention also provides a vulnerability verification code generation device based on a large language model, including a memory and a processor. The memory stores a computer program, and the processor calls the computer program to execute the steps of the method described above.
[0016] Compared with the prior art, the present invention has the following advantages: (1) This invention obtains vulnerability reports and verification codes, extracts key information and transforms them into a structured form to build a training dataset for training a large language model. Combined with prompt words, it guides the large language model to generate corresponding vulnerability verification codes. On the one hand, this invention configures and manages the prompt template library in a unified manner by constructing prompt words. On the other hand, it configures the template library of standard vulnerability verification codes obtained from the training of the large language model in a unified data structure. The setting of the prompt template library and the standard vulnerability verification code template library not only improves the efficiency and accuracy of vulnerability verification, but also provides valuable reference resources for security researchers. Overall, this invention introduces Large Language Model (LLM) technology, combined with professional prompt word engineering and a local knowledge base, to achieve automated generation of vulnerability verification code. This technological breakthrough not only solves the problems of manual dependence and low efficiency in traditional vulnerability detection and verification processes, but also greatly improves the accuracy and timeliness of vulnerability detection. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating a vulnerability verification code generation method based on a large language model provided in an embodiment of the present invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0019] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0020] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0021] Example 1 like Figure 1 As shown, this embodiment provides a vulnerability verification code generation method based on a large language model, including the following steps: S1: Obtain vulnerability reports and verification code, and extract key information; The key information extracted includes the vulnerability number, vulnerability type, and the attack payload that triggered the vulnerability.
[0022] In this embodiment, vulnerability reports and verification code are crawled from publicly available vulnerability databases (such as CVE, NVD, etc.). Vulnerability reports typically contain key information such as the vulnerability description, scope of impact, and exploitation method. Natural language processing techniques are used to extract key information such as the vulnerability ID, vulnerability type, and the attack payload that triggered the vulnerability.
[0023] S2: Convert the extracted key information into structured data and build a training dataset; The training dataset includes a detailed description of the vulnerability, the input data that triggers the vulnerability, and the expected output.
[0024] Preferably, existing PoC (Proof of Concept) code also needs to be preprocessed to extract key code snippets and logical structures.
[0025] S3: The pre-acquired large language model is trained using the training dataset. During the training process, the large language model is guided by prompt words to generate corresponding vulnerability verification code. The vulnerability verification code includes the input data and logical structure required to trigger the vulnerability. Large Language Models (LLMs) are a class of natural language processing models based on deep learning, such as the GPT series of models. These models learn and understand language features and semantic relationships by pre-training on large-scale text datasets. LLMs possess powerful language generation capabilities, able to generate coherent and logical text content based on given text prompts.
[0026] In this embodiment, an LLM model is selected. The LLM model is trained using a pre-processed training dataset. By fine-tuning the LLM model, it is made capable of understanding and generating code related to vulnerability verification.
[0027] During training, specific prompts are designed to guide the model to generate specific types of PoC code. Specifically, based on the vulnerability requirements, general prompts for similar tasks are built, a local knowledge base for user questions is constructed, and the local database is vectorized and indexed. Obtain actual user questions, compare them with the content in the local knowledge base, and filter out the top k most similar content as reference. The system combines the prompts for the corresponding task type, the user's question, and the top k references, and inputs them into a large language model to generate the corresponding vulnerability verification code.
[0028] In this embodiment, a combination of prompt word engineering and a local knowledge base is used to generate standard vulnerability Proof-of-Concept (POC). First, standardized basic reference prompt words are constructed based on requirements, serving as general prompt words for similar tasks. Then, the actual task request is input. Next, the local knowledge base is vectorized and indexed, and its similarity is compared with the input request, selecting the top k most similar content as references. Finally, the prompt words, user question, and the top k references are combined and input into an LLM (Local Management Model) to obtain the final output.
[0029] S4: Input the vulnerability information to be verified into the trained large language model, obtain the corresponding vulnerability verification code, and verify and optimize the generated vulnerability verification code.
[0030] In other words, after the model is trained, new vulnerability information is input, and the LLM model can automatically generate corresponding Proof-of-Concept (PoC) code based on this information. The generated code will contain the input data and logical structure required to trigger the vulnerability.
[0031] The generated PoC code needs to be verified and optimized. The verification process includes executing the PoC code to confirm whether it can successfully trigger the vulnerability. The optimization process involves further adjusting the code to improve its execution efficiency and accuracy.
[0032] The preferred design process for prompt words is as follows: 1.1 Analyze the vulnerability description and reproduction steps First, it is necessary to carefully analyze the provided vulnerability description and reproduction steps, including the following key points: Vulnerability types: such as SQL injection, cross-site scripting (XSS), buffer overflow, etc.
[0033] Affected components: Which specific software or service is vulnerable.
[0034] Triggering conditions: What kind of input or operation can trigger this vulnerability?
[0035] Expected results: The specific behaviors that should be observed after execution.
[0036] 1.2 Prompt Word Code Framework Based on the above analysis, a basic code framework can be designed, which typically includes the following parts: Environment setup: Initialize the necessary environment (such as database connection, network requests, etc.).
[0037] Input construction: Construct specific input data based on triggering conditions.
[0038] Execution logic: Invoke or simulate user actions to trigger the vulnerability.
[0039] Result verification: Check whether the expected results have been achieved.
[0040] Vulnerability verification code generation process based on prompt words Leveraging the capabilities of large language models, test code can be automatically generated in the following ways: 1.3.1 Example Process Suppose we have a description and steps to reproduce an SQL injection vulnerability in a web application: Vulnerability Description: The application does not properly filter input when processing user-submitted data, leading to potential SQL injection attacks.
[0041] 1.3.2 Reproduction Steps: 1. Access the login page http: / / example.com / login.
[0042] 2. Enter 'OR '1'='1' in the username field. 3. Leave the password field blank and submit the form.
[0043] 4. If successful, you will be redirected directly to the user's homepage without needing to enter the correct password.
[0044] 1.3.3, Notification Project To obtain accurate test code from a large language model, we need to carefully design prompt words. For example: Please write Python test code for a web application that may have an SQL injection vulnerability, based on the following vulnerability description and reproduction steps: Vulnerability Description: The application does not properly filter input when processing user-submitted data, leading to potential SQL injection attacks.
[0045] Reproduction steps: 1. Access the login page http: / / example.com / login.
[0046] 2. Enter 'OR '1'='1' in the username field. 3. Leave the password field blank and submit the form.
[0047] 4. If successful, you will be redirected directly to the user's homepage without needing to enter the correct password.
[0048] The system requires the use of the requests library for HTTP requests and includes appropriate error handling mechanisms.
[0049] 1.3.4 Automatic code generation Inputting the above prompts into a large language model might generate Python code like the one shown below: Python import requests url = "http: / / example.com / login" payload = { 'username': "' OR '1'='1", 'password': "" } try: response = requests.post(url, data=payload) if response.status_code == 200 and "user home" in response.text: print("SQL Injection vulnerability detected!") else: print("No vulnerability detected.") except Exception as e: print(f"An error occurred: {e}") 1.4 Verification and Optimization Preliminary verification: Run the generated code in a controlled environment to ensure that it can correctly identify the existence of vulnerabilities.
[0050] Optimization and improvement: Adjust the code logic or parameters according to the actual test results to improve the accuracy of detection.
[0051] 1.5 Continuous Iteration As more vulnerability cases are accumulated, the design of templates and hints will be continuously optimized to improve the robustness and adaptability of the automatic code generation function.
[0052] This method not only allows for the rapid generation of test code targeting specific vulnerabilities, but also enables the gradual development of a powerful suite of automated security testing tools.
[0053] Preferably, the method further includes constructing a prompt template library for storing and managing prompt words; the database table structure of the prompt template library includes: Categories and tags are used to classify and label the vulnerability types and technology stacks to which each hint applies; Version control is used to define the version of the prompt words; Contextual information is used to record background information about the use of prompt words; A feedback mechanism is used to receive user feedback on the effectiveness of the prompt words.
[0054] In other words, to combine the aforementioned vulnerability database table structure with the design of automated test code generation based on a large language model, we need to design a dedicated database table structure for storing and managing prompts. This prompts library will help us more systematically manage and optimize the prompts used to generate test code.
[0055] In this embodiment, the table structure design of the prompt template library is as follows: 2.1 Prompts (Prompt vocabulary) id (INT, PRIMARY KEY, AUTO_INCREMENT): Unique identifier vulnerability_id (INT, FOREIGN KEY REFERENCES vulnerabilities(id)): The associated vulnerability ID. prompt_text (TEXT): The prompt text content language (VARCHAR(50)): The expected language of the generated code (e.g., Python, Bash, etc.) version (VARCHAR(20)): Prompt word version number created_at (DATETIME): Creation time updated_at (DATETIME): Last updated time description (TEXT): Prompt description or usage instructions status (ENUM('Draft', 'Active', 'Deprecated')): Status (Draft, Active, Deprecated) 2.2 prompt_feedback (prompt feedback) id (INT, PRIMARY KEY, AUTO_INCREMENT): Unique identifier prompt_id (INT, FOREIGN KEY REFERENCES prompts(id)): The associated prompt word ID user_id (INT): User ID (optional, if user feedback needs to be recorded). feedback_text (TEXT): Feedback content rating (INT): Feedback score (e.g., 1-5 points) created_at (DATETIME): Creation time 2.3. prompt_tags (prompt tag association table) id (INT, PRIMARY KEY, AUTO_INCREMENT): Unique identifier prompt_id (INT, FOREIGN KEY REFERENCES prompts(id)): The associated prompt word ID tag_id (INT, FOREIGN KEY REFERENCES tags(id)): The associated tag ID 2.4 Tags id (INT, PRIMARY KEY, AUTO_INCREMENT): Unique identifier tag_name (VARCHAR(100)): Tag name (e.g., SQL injection, XSS, etc.) Preferably, the large language model generates a template library of standard vulnerability verification code based on the training results, which is used for generating vulnerability verification code; The data structure of the template library for the standard vulnerability verification code includes: Basic information, used to describe the basic information of the vulnerability verification code; Environment configuration, which describes the software environment or hardware conditions required to execute the vulnerability verification code; The vulnerability description explains the nature of the vulnerability, how it is triggered, and the potential harm it may cause. The reproduction steps outline the steps to reproduce the vulnerability using the vulnerability verification code. Code snippets are used to record the code that triggers the vulnerability, and are categorized and stored according to different programming languages or technology stacks; Expected results: This indicates the results that are expected to be observed after executing the vulnerability verification code.
[0056] The basic information includes: unique identifier, CVE number, vulnerability name, vulnerability severity, CVSS score, affected version range, publication date, and last modification date; The environment configuration includes: a unique identifier, an associated vulnerability ID, a required operating system, required software or libraries, software version requirements, and dependencies that need to be installed. The code snippet includes: a unique identifier, an associated vulnerability ID, a programming language, and code; The reproduction steps include: a unique identifier, an associated vulnerability ID, a sequence of steps, and a description of each step.
[0057] Preferably, the method further includes classifying and labeling the template library of the standard vulnerability verification code by constructing categories and tags, wherein the classification includes classifying the vulnerability verification code according to vulnerability type, affected platform, or severity.
[0058] In this embodiment, the data structure of the template library for standard vulnerability verification code specifically includes: Basic Information: Each POC template should include basic information about the vulnerability, such as the CVE number (if applicable), vulnerability name, affected versions, etc.
[0059] Environment configuration: Describes the software environment or hardware requirements for executing this POC, including the operating system, specific software version, etc.
[0060] Vulnerability Description: Briefly describe the nature of the vulnerability, how it is triggered, and the potential harm it may cause.
[0061] Reproduction Steps: This section details the steps to reproduce the vulnerability using this POC, including necessary command-line instructions or operating guidelines.
[0062] Code snippets: The core part, i.e., the code actually used to trigger the vulnerability. This part needs to be categorized and organized according to different programming languages or technology stacks.
[0063] Expected Results: Clearly specifying the results expected to be observed after executing the POC helps verifiers determine whether the vulnerability actually exists.
[0064] The classification and labeling system specifically includes: To facilitate management and retrieval, it is recommended to categorize and label POC templates in detail: Vulnerability types can be categorized as follows: such as SQL injection, cross-site scripting (XSS), and buffer overflow.
[0065] Classified by affected technology / platform: such as web applications, database systems, operating systems, etc.
[0066] Classified by severity: high risk, medium risk, low risk, etc., based on CVSS scores or other assessment criteria.
[0067] The main tables and their fields in the data structure of the template library for the aforementioned standard vulnerability verification code are described below: 3.1 Vulnerabilities (Basic Vulnerability Information) id (INT, PRIMARY KEY, AUTO_INCREMENT): Unique identifier cve_id (VARCHAR(20)): CVE ID (if applicable) name (VARCHAR(255)): Vulnerability Name Description (TEXT): Vulnerability Description severity (ENUM('Low', 'Medium', 'High', 'Critical')): The severity of the vulnerability. cvss_score (FLOAT): CVSS score (if applicable) affected_versions (TEXT): The range of versions affected. published_date (DATE): Publication date last_modified_date (DATE): Last modified date 3.2 Environments (Configuration) id (INT, PRIMARY KEY, AUTO_INCREMENT): Unique identifier vulnerability_id (INT, FOREIGN KEY REFERENCES vulnerabilities(id)): The associated vulnerability ID. os (VARCHAR(100)): Required operating system software (VARCHAR(255)): Required software or library version (VARCHAR(50)): Software version requirement dependencies (TEXT): Required dependencies to be installed. 3.3, poc_templates (POC templates) id (INT, PRIMARY KEY, AUTO_INCREMENT): Unique identifier vulnerability_id (INT, FOREIGN KEY REFERENCES vulnerabilities(id)): The associated vulnerability ID. language (VARCHAR(50)): Programming language (such as Python, Bash, etc.) code (TEXT): POC code expected_result (TEXT): Description of the expected result 3.4 Steps to Reproduce (Steps to Reproduce) id (INT, PRIMARY KEY, AUTO_INCREMENT): Unique identifier vulnerability_id (INT, FOREIGN KEY REFERENCES vulnerabilities(id)): The associated vulnerability ID. step_order (INT): Step order Description (TEXT): Step-by-step description 3.5 Tags id (INT, PRIMARY KEY, AUTO_INCREMENT): Unique identifier tag_name (VARCHAR(100)): Tag name (e.g., SQL injection, XSS, etc.) 6. vulnerability_tags (vulnerability and tag association table) id (INT, PRIMARY KEY, AUTO_INCREMENT): Unique identifier vulnerability_id (INT, FOREIGN KEY REFERENCES vulnerabilities(id)): The associated vulnerability ID. tag_id (INT, FOREIGN KEY REFERENCES tags(id)): The associated tag ID Example 2 This embodiment provides a vulnerability verification code generation device based on a large language model, including a memory and a processor. The memory stores a computer program, and the processor calls the computer program to execute the steps of a vulnerability verification code generation method based on a large language model as described in Embodiment 1.
[0068] The preferred embodiments of the present invention have been described in detail above. It should be understood that those skilled in the art can make numerous modifications and variations based on the concept of the present invention without creative effort. Therefore, all technical solutions that can be obtained by those skilled in the art based on the concept of the present invention through logical analysis, reasoning, or limited experimentation on the basis of existing technology should be within the scope of protection defined by the claims.
Claims
1. A vulnerability verification code generation method based on a large language model, characterized in that, Includes the following steps: Obtain vulnerability reports and verification code, and extract key information; The extracted key information is converted into structured data to build a training dataset; The pre-acquired large language model is trained using the training dataset. During the training process, the large language model is guided by prompt words to generate corresponding vulnerability verification code. The vulnerability verification code includes the input data and logical structure required to trigger the vulnerability. The vulnerability information to be verified is input into the trained large language model to obtain the corresponding vulnerability verification code, and the generated vulnerability verification code is verified and optimized.
2. The vulnerability verification code generation method based on a large language model according to claim 1, characterized in that, The extracted key information includes the vulnerability number, vulnerability type, and attack payload that triggered the vulnerability.
3. The vulnerability verification code generation method based on a large language model according to claim 1, characterized in that, The training dataset includes a detailed description of the vulnerability, the input data that triggers the vulnerability, and the expected output.
4. The vulnerability verification code generation method based on a large language model according to claim 1, characterized in that, The specific steps involved in guiding the large language model to generate corresponding vulnerability verification code through prompts during training are as follows: Based on the vulnerability requirements, construct common prompt words for similar tasks, build a local knowledge base for user questions, and vectorize and index the local database. Obtain actual user questions, compare them with the content in the local knowledge base, and filter out the top k most similar content items as references; The prompts for the corresponding task type of the user question, the user question itself, and the first k references are combined and input into the large language model to generate the corresponding vulnerability verification code.
5. The vulnerability verification code generation method based on a large language model according to claim 4, characterized in that, The prompt words include: Environment settings are used to initialize the necessary environment; Input construction, used to construct input data based on trigger conditions; The execution logic is used to invoke or simulate user actions to trigger the vulnerability. Result verification is used to check whether the expected results have been achieved.
6. The vulnerability verification code generation method based on a large language model according to claim 4, characterized in that, The method further includes constructing a prompt template library for storing and managing prompt words; the database table structure of the prompt template library includes: Categories and tags are used to classify and label the vulnerability types and technology stacks to which each hint applies; Version control is used to define the version of the prompt words; Contextual information is used to record background information about the use of prompt words; A feedback mechanism is used to receive user feedback on the effectiveness of the prompt words.
7. The vulnerability verification code generation method based on a large language model according to claim 1, characterized in that, The large language model generates a template library of standard vulnerability verification code based on the training results, which is used for generating vulnerability verification code; The data structure of the template library for the standard vulnerability verification code includes: Basic information, used to describe the basic information of the vulnerability verification code; Environment configuration, which describes the software environment or hardware conditions required to execute the vulnerability verification code; The vulnerability description explains the nature of the vulnerability, how it is triggered, and the potential harm it may cause. The reproduction steps outline the steps to reproduce the vulnerability using the vulnerability verification code. Code snippets are used to record the code that triggers the vulnerability, and are categorized and stored according to different programming languages or technology stacks; Expected results: This indicates the results that are expected to be observed after executing the vulnerability verification code.
8. The vulnerability verification code generation method based on a large language model according to claim 7, characterized in that, The basic information includes: unique identifier, CVE number, vulnerability name, vulnerability severity, CVSS score, affected version range, publication date, and last modification date; The environment configuration includes: a unique identifier, an associated vulnerability ID, a required operating system, required software or libraries, software version requirements, and dependencies that need to be installed. The code snippet includes: a unique identifier, an associated vulnerability ID, a programming language, and code; The reproduction steps include: a unique identifier, an associated vulnerability ID, a sequence of steps, and a description of each step.
9. The vulnerability verification code generation method based on a large language model according to claim 7, characterized in that, The method also includes classifying and labeling the template library of the standard vulnerability verification code by constructing categories and tags, wherein the classification includes classifying the vulnerability verification code according to vulnerability type, affected platform, or severity.
10. A vulnerability verification code generation device based on a large language model, characterized in that, It includes a memory and a processor, the memory storing a computer program, and the processor calling the computer program to perform the steps of the method as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Source code vulnerability detection method and system based on large model
CN118332557A