CVE analysis and retrieval system and method based on knowledge graph and large language model
By combining knowledge graphs and large language models, a hybrid query engine and a separate data processing workflow are constructed, which solves the shortcomings of existing CVE information retrieval systems in semantic understanding, supply chain analysis, and deep insight generation, and realizes efficient and automated CVE information management and analysis.
Patent Information
- Application Number
- CN202611352986.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2025-09-03
- Filing Date
- 2026-09-02
- Publication Date
- 2026-11-20
AI Technical Summary
Existing CVE information retrieval systems lack semantic understanding capabilities, cannot accurately process natural language query intent, cannot automatically analyze the supply chain impact path of vulnerabilities, cannot automatically generate in-depth insight reports, and their knowledge base updates are not automated or continuous enough.
We employ a method that combines knowledge graphs and large language models to construct a hybrid query engine, integrating relational databases and graph databases to achieve hybrid queries. We utilize large language models for intent recognition and insight generation, and design offline/online separated data processing workflows to achieve automated knowledge base updates.
It improves the accuracy and efficiency of CVE retrieval, enables automated analysis of the impact of supply chain vulnerabilities, can automatically generate in-depth insight reports, and ensures the continuous updating and accuracy of the knowledge base.
Smart Images

Figure CN123138282A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of network security, information retrieval and artificial intelligence application technology, and specifically relates to a method and system for intelligent analysis, deep retrieval and correlation mining of common vulnerability disclosure (CVE) information. Background Technology
[0002] Common Vulnerabilities and Exposures (CVE): Also known as general vulnerability disclosure or common vulnerabilities and disclosures, it is a database related to information security that collects various information security weaknesses and vulnerabilities and assigns them numbers for public access.
[0003] A knowledge graph is a structured semantic knowledge base used to describe concepts and their relationships in the physical world in symbolic form. Its basic building blocks are the "entity-relationship-entity" triple, as well as entities and their associated attribute-value pairs. Entities are interconnected through relations, forming a network-like knowledge structure.
[0004] Large Language Model (LLM): A class of language models consisting of artificial neural networks with a large number of parameters (typically in the billions to trillions, such as GPT-3 with 175 billion parameters), trained on a large amount of unlabeled text using self-supervised or semi-supervised learning.
[0005] Vector Search: A similarity search technique based on vector embedding. It converts unstructured data such as text into high-dimensional vectors and finds semantically similar content by calculating the distance between vectors, thus overcoming the shortcomings of traditional keyword search.
[0006] Hybrid Search combines traditional keyword search (such as the BM25 algorithm) and vector search techniques, aiming to improve the accuracy and relevance of search results by leveraging the precise matching ability of keywords and the semantic understanding ability of vectors.
[0007] Data Pipeline: A series of automated, sequential data processing steps used to move, transform, and load data from a source into a target system. In this invention, it refers to an automated process for continuously acquiring, processing, and enriching CVE-related data.
[0008] Offline knowledge enrichment refers to a data processing workflow that runs independently in the background. It does not directly serve users' real-time query requests, but continuously supplements the core knowledge base with data, builds relationships, and optimizes its quality to ensure that the data used by the online query system is the latest and most comprehensive.
[0009] In the field of cybersecurity, timely acquisition and accurate analysis of CVE vulnerability information are the cornerstones of vulnerability management, risk assessment, and incident response. Current technical solutions mainly revolve around data aggregation, retrieval, and presentation.
[0010] The existing search methods include the following.
[0011] 1. Keyword Search Engine: This is a cornerstone technology of information retrieval, typically based on inverted indexes and relevance ranking algorithms such as TF-IDF or BM25. Users input keywords to match content in a document library containing those words. In the field of CVE retrieval, the search functions provided by official websites such as NVD / CNVD are a typical application of this technology.
[0012] 2. Vector Semantic Search: As a supplement and development to keyword retrieval, semantic search technology uses deep learning models (such as BERT, Sentence-Transformers, etc.) to convert text into high-dimensional vectors. By calculating metrics such as cosine similarity in the vector space, it can find texts that are semantically similar but may not use the same words, thus improving the recall rate and intelligence level of the retrieval.
[0013] 3. Knowledge Graph Technology: This technology uses nodes (Entities) and edges (Relations) to represent and store knowledge. Nodes represent real-world entities (such as a CVE vulnerability or a software product), and edges represent relationships between entities (such as "influence" or "dependency"). Graph databases (such as Neo4j and Apache AGE) can efficiently store and query these relationships, making them suitable for complex association analysis, such as supply chain traceability.
[0014] 4. Applications of Large Language Models (LLM): In recent years, large language models have made groundbreaking progress in natural language understanding (NLU) and natural language generation (NLG). In existing technologies, LLM has been initially applied to tasks such as text summarization and information extraction, capable of extracting key fields from unstructured vulnerability descriptions.
[0015] Currently, the closest existing technical solution to this invention is the search platform provided by official websites such as NVD (National Vulnerability Database) and CNVD (China National Vulnerability Sharing Platform). These platforms are the most authoritative and fundamental channels for obtaining CVE information in the industry, and their core functions typically include: Keyword search box: Provides a main input box that allows users to enter keywords such as product name, vulnerability number, and technical terms to search; Advanced Filters: Provide a range of structured filtering criteria, such as CVSS severity score range, vulnerability type (CWE), vendor name, and the start and end range of release dates; Results list display: Search results are presented in list format, with each item containing core information such as CVE number, summary, CVSS score, and release date, and providing a link to the vulnerability details page.
[0016] However, the search platforms provided by these official websites still have the following serious flaws in terms of technical implementation and application effectiveness.
[0017] Inaccurate keyword matching and lack of semantic understanding: The platform's search engine heavily relies on precise keyword matching and cannot truly understand the complex, context-dependent natural language query intent of users. For example, it cannot accurately process natural language questions containing multiple constraints (time, product, vulnerability type), requiring users to manually break down their intent into combinations of multiple filtering conditions, a cumbersome process prone to errors.
[0018] Information is isolated and fails to reveal deep connections: official platforms merely serve as "display machines" for vulnerability entries, rather than acting as "connectors" of knowledge. While the data is authoritative, the deep relationships between entities (such as software A depending on component B, and component B being affected by vulnerability C) are not explicitly modeled or mined. Therefore, the system cannot automatically perform supply chain impact analysis or attack path reasoning; these complex analytical tasks still require analysts to expend considerable effort manually establishing these connections.
[0019] The analysis process is time-consuming and labor-intensive, heavily reliant on expert experience: extracting valuable insights from massive amounts of fragmented vulnerability information, such as the true risks of vulnerabilities, potential exploitation methods, and the priority of remediation recommendations, is a process that heavily depends on human expert experience. The platform itself does not provide any dynamic or targeted analysis conclusions.
[0020] Unable to provide in-depth, actionable insights: Existing solutions typically only return a raw list of vulnerabilities, rather than automatically generating a comprehensive insight report that includes risk assessment, impact analysis, and remediation recommendations based on the user's specific context (such as "Which affected components are used in the target product?").
[0021] In view of the shortcomings of the prior art, the present invention aims to solve one or more of the following technical problems: 1. How to improve the accuracy and semantic relevance of CVE retrieval; that is, how to enable the system to understand the user's natural language query intent and return the most semantically relevant vulnerability information, rather than just the results of string matching.
[0022] 2. How to automate the analysis of the supply chain impact path of vulnerabilities; that is, how to build dependencies between products so that when a vulnerability is exposed in a low-level component, all affected upper-level applications can be automatically and quickly traced and identified.
[0023] 3. How to automatically generate in-depth insights from massive and fragmented vulnerability information; that is, how to intelligently integrate multi-source information such as vulnerability data, product information, and exploit code, and automatically generate structured and easy-to-understand risk analysis reports.
[0024] 4. The question of how to build a vulnerability knowledge base that can continuously evolve and correct itself; that is, how to design an automated data processing flow to continuously absorb new knowledge from external data sources and ensure the accuracy and completeness of the knowledge base through a quality assurance mechanism. Summary of the Invention
[0025] To address the problems existing in the prior art, the purpose of this invention is to provide an intelligent CVE analysis and retrieval system and method based on knowledge graphs and large language models.
[0026] The technical solution of this invention is as follows: A CVE analysis and retrieval method based on knowledge graphs and large language models includes the following steps: Extract the triples (subject entity, relation or attribute name, object entity or attribute value) and metadata of the security vulnerability from each selected data source to generate candidate knowledge units corresponding to the security vulnerability; Calculate the confidence level of each candidate knowledge unit, and save the candidate knowledge units to the core knowledge base according to their confidence levels. A knowledge graph is constructed based on the information in the core knowledge base; The LLM function generates a structured JSON object based on the user's query text and preset prompts, containing identified entities, constraints, and query intent categories. The query planner generates a hybrid query plan based on the JSON object: It categorizes the query intents in the JSON object and queries a pre-defined intent category-query path combination mapping rule table to determine the query path; it compiles the constraints in the JSON object into parameterized SQL conditions based on a pre-defined field mapping table, distinguishing between hard constraints and soft preferences; it generates a query vector based on the query text and constructs a top-K vector nearest neighbor retrieval task; and it generates a hybrid query plan based on the top-K vector nearest neighbor retrieval task and the query path. The query subtasks in the hybrid query plan are executed concurrently through the query pathways, and the candidate sets returned by each query pathway are merged, weighted, and sorted before being output.
[0027] Preferably, the core knowledge base includes a core table, an independent vector table, and an attribute graph; The core tables include a `products` table for storing product information, a `product_versions` table for storing product versions, a `cves` table for storing vulnerability information, a `cve_products` table for storing vulnerability-product relationships, a `supply_chain_graph` table for storing product dependencies, and a `vulnerability_impact_paths` table for storing vulnerability impact paths. The `products` table uses the product identifier `id` as its primary key and records the product name and manufacturer. The `product_versions` table uses the foreign key `product_...` The `id` field is associated with the primary key of the `products` table. Version numbers are stored using the semantic versioning (`semver`) extended type, supporting version range queries. The `cves` table uses the CVE number as the primary key and records description, CVSS score, severity, and CWE type. The `cve_products` table is a many-to-many relationship table between vulnerabilities and products, with each row identified by an immutable proxy primary key. Foreign keys `cve_id` and `product_id` are associated with the primary keys of the `cves` and `products` tables, respectively. An affected version range field records the applicable scope, and a unique constraint is applied to (`cve_id`, `product_id`, version range`)—open boundaries are stored as sentinel values. Non-null values; the supply_chain_graph table and the vulnerability_impact_paths table are associated with the core table via foreign keys; the supply_chain_graph table identifies each row with an immutable surrogate primary key, including foreign keys upstream_product_id and downstream_product_id pointing to the primary key of the products table, the relationship_type field records the relationship type, version_constraint records the version constraint, and confidence records the confidence level, and applies a unique constraint to (upstream_product_id, downstream_product_id, relationship_type, version_constraint) -- incorporating version constraints allows the same product pair to store multiple dependencies according to different version ranges; the foreign key cve_id in the vulnerability_impact_paths table points to the primary key of the cves table, and the foreign keys source_product_id and target_product_id point to the primary key of the products table, used to record the product identification sequence, propagation hops, and computation time; The independent vector table includes an embeddings table, which stores text embedding vectors for CVE descriptions and product information. The embeddings table is associated with the core table via entity type (entity_type) and entity identifier (entity_id). When entity_type is cve, entity_id stores the CVE number (primary key) from the cves table; when entity_type is product, entity_id stores the product table (primary key ID). A unique composite index (entity_type, entity_id) ensures retrieval efficiency and prevents duplicate storage. The attribute graph was generated using the Apache AGE graph database extension plugin for PostgreSQL.
[0028] Preferably, the method for constructing a knowledge graph based on the information in the core knowledge base is as follows: Iterate through the products table and create a Product type node for each product. Iterate through the cves table and create a CVE type node for each vulnerability. Create corresponding method type nodes, language type nodes, and tool type nodes for the extended entities in the entities table. Traverse the cve_products table to create an AFFECTS edge from the CVE to the Product node for each association. The edge attributes include the affected version range, confidence level, and source row identifier. Traverse the supply_chain_graph table to create a DEPENDS_ON edge from the downstream product to the upstream product for each dependency. The edge attributes include version constraints, confidence level, and source row identifier. Create edges of the corresponding type for extended relationships that have been verified by confidence level.
[0029] Preferably, the candidate knowledge units and their confidence scores are stored in a candidate knowledge table; then, the candidate knowledge units in the candidate knowledge table are hierarchically saved to the core knowledge base; the candidate knowledge table records the triple content of the candidate knowledge unit, as well as the source identifier, original evidence fragment, confidence score, application target, review status, application status, reviewer, and review time of the candidate knowledge unit.
[0030] Preferably, the method by which the graph builder saves candidate knowledge units to the core knowledge base according to confidence level is as follows: The graph builder saves candidate knowledge units with confidence levels not lower than the high threshold to the core knowledge base, wherein the structured fields in the candidate knowledge units are written into the core table of the core knowledge base, and the entity relationships and confidence levels in the candidate knowledge units are written into the corresponding relationship table of the core knowledge base; Candidate knowledge units with confidence levels between the low and high thresholds are saved to the core knowledge base, their review status is kept pending and they enter the manual review queue, the corresponding target record is marked as pending review, and their use is reduced in online query; The review status of candidate knowledge units with confidence levels lower than the low threshold is set to pending and they enter the manual review queue for review.
[0031] Preferably, each query path is set with an independent timeout threshold, and the query path is downgraded when a query path times out or fails to execute a query subtask.
[0032] Preferably, the method for merging and weighting the candidate sets returned by each query path is as follows: First, apply the hard constraints uniformly to the candidate sets returned by the query paths and delete candidate vulnerability entries that do not meet the hard constraints; then, merge the candidate vulnerability entries that have passed the screening according to their CVE numbers, calculate the normalized score of each candidate vulnerability entry under each query path, and perform a weighted calculation on the normalized scores of each query path to obtain the fusion score of each candidate vulnerability entry; then, determine the ranking of the candidate vulnerability entries based on their fusion score, source weight score, severity score, time recentity score, and information integrity score.
[0033] Preferably, the query pathway includes an SQL pathway, a vector pathway, and a graph pathway; the normalized score of the SQL pathway includes the comprehensive normalized full-text relevance and the soft preference satisfaction ratio; the normalized score of the vector pathway is the semantic similarity score that monotonically maps the vector distance to the [0,1] interval; and the normalized score of the graph pathway is the graph association score calculated based on the length of the associated path.
[0034] Preferably, the confidence level = w1 × data source authority + w2 × extractor reliability + w3 × multi-source consistency + w4 × timeliness, and the weights w1, w2, w3, and w4 are non-negative and their sum is 1.
[0035] A CVE analysis and retrieval system based on knowledge graph and large language model is characterized by comprising a candidate knowledge unit generation module, a hierarchical storage module, a graph builder, an intent recognition module, a query planner, and an asynchronous parallel execution and result fusion module. The candidate knowledge unit generation module is used to extract the triples (subject entity, relation or attribute name, object entity or attribute value) and metadata of security vulnerabilities from each selected data source, and generate candidate knowledge units corresponding to the security vulnerabilities. The hierarchical storage module is used to calculate the confidence level of each candidate knowledge unit and save the candidate knowledge units to the core knowledge base in hierarchical order according to the confidence level. The graph builder is used to construct a knowledge graph based on the information in the core knowledge base; The intent recognition module is used to call LLM to generate a structured JSON object based on the user's query text and preset prompts, which includes the identified entities, constraints, and query intent classification. The query planner is used to generate a hybrid query plan based on the JSON object: it categorizes the query intents in the JSON object and queries a pre-defined intent category-query path combination mapping rule table to determine the query path; it compiles the constraints in the JSON object into parameterized SQL conditions based on a pre-defined field mapping table, distinguishing between hard constraints and soft preferences; it generates a query vector based on the query text and constructs a top-K vector nearest neighbor retrieval task; and it generates a hybrid query plan based on the top-K vector nearest neighbor retrieval task and the query path. The asynchronous parallel execution and result fusion module is used to concurrently execute each query subtask in the hybrid query plan through the query path, and then merge, weight, and sort the candidate sets returned by each query path before outputting them.
[0036] The core innovations of this invention are summarized as follows: 1. Deep Integration Architecture of Knowledge Graph and Relational Database: This invention innovatively combines a traditional relational database (PostgreSQL) with a graph database (Apache AGE extension). The relational database leverages its mature transaction processing capabilities and semver (Semantic Versioning) extension to efficiently manage structured product, version, and vulnerability data; the graph database is specifically designed for modeling and querying complex, multi-hop relationships, such as software supply chain dependencies and vulnerability attack paths. This architecture enables efficient modeling and complex querying of vulnerability knowledge, solving the problem of information silos in traditional solutions.
[0037] 2. Hybrid Query Engine: This invention designs a hybrid query engine that, based on the background technology of "hybrid search" (fusion of keyword and vector results), further incorporates a knowledge graph-based graph query pathway, forming a three-pronged query system of full-text search (based on tsvector), vector semantic search, and graph query. This system is uniformly planned, executed in parallel, and fused by an intelligent query planning module. The results from multiple paths are merged and sorted according to a configurable weighted formula (e.g., when merging two paths, score = 0.6 × normalized full-text relevance + 0.4 × vector semantic similarity; full-text relevance can be calculated using ts_rank or BM25-type algorithms; when introducing the graph query pathway, this is expanded to a three-factor weighting, see specific implementation details), thereby helping to improve retrieval accuracy and recall.
[0038] 3. Large Language Model-Driven Intent Analysis and Insight Generation System: This invention utilizes a Large Language Model (LLM) to construct two core intelligent modules. First, there is an intent recognition system that can parse a user's natural language query (such as "unpatched vulnerabilities discovered through fuzzing in the past week") into structured query instructions (such as time range, patching status, vulnerability discovery methods, etc.). Second, there is a deep insight generation system that automatically performs multi-dimensional data analysis based on the query results (such as severity distribution, time trends, component risks, etc.) and generates a natural language report containing an execution summary, risk assessment, and key findings.
[0039] 4. Separate Offline / Online Processing Flow: This invention clearly divides the system architecture into an "online query processing flow" and an "offline knowledge enrichment flow." The online flow focuses on responding to user queries with low latency and high concurrency; the offline flow, through an automated data pipeline, continuously acquires new information from multiple data sources (such as NVD, GitHub, ExploitDB, etc.) in the background. Through knowledge extraction, cross-validation, relationship building, and other steps, it continuously enriches and optimizes the core knowledge base, ensuring high performance and data freshness for online queries.
[0040] 5. A robust knowledge base quality assurance system: To ensure the accuracy of the knowledge base data, this invention designs a multi-dimensional quality assurance mechanism. This mechanism includes a confidence scoring system based on multi-source cross-validation, a priority strategy based on the authority of the data source, and an automated manual review queue for low-confidence information. This system ensures that the knowledge base can self-correct during continuous evolution, maintaining high credibility.
[0041] The advantages of this invention are as follows: 1. Significantly improves retrieval accuracy and efficiency, solving the problems of "inaccurate or unfindable results": The hybrid query engine of this invention combines the precision of keywords with the semantic understanding capabilities of vectors, improving the accuracy of complex queries by an order of magnitude compared to traditional keyword retrieval. Simultaneously, the intent analysis capabilities driven by a large language model liberate security analysts from tedious keyword probing, reducing information acquisition time from tens of minutes to mere seconds.
[0042] 2. Automated analysis of supply chain vulnerability impact: Through an integrated knowledge graph, this invention can model complex software supply chains. When an upstream component is found to have a vulnerability, the system can respond within seconds and automatically trace all affected downstream products. Its analytical performance is 5-10 times better than traditional manual investigation methods, providing a key capability for rapid emergency response.
[0043] 3. Automated Generation of In-Depth Insight Reports: The large language model-driven insight generation system of this invention can automatically transform raw vulnerability data into well-structured and clearly presented analysis reports. This greatly reduces reliance on the experience of security experts, shortening the time for security analysts to write preliminary assessment reports from hours to minutes, significantly improving the work efficiency of security teams.
[0044] 4. A sustainably evolving knowledge system has been constructed: Through a separate offline / online architecture and automated data pipelines, this invention builds a "living" knowledge base that can continuously absorb new knowledge and self-optimize. A robust quality assurance system ensures the accuracy of the knowledge, making it a reliable and trustworthy decision support platform, rather than a static and outdated data warehouse. Attached Figure Description
[0045] Figure 1 This is the overall system architecture diagram.
[0046] Figure 2 This is a flowchart of the online query processing procedure. Detailed Implementation
[0047] The present invention will now be described in further detail with reference to the accompanying drawings. The examples given are only for explaining the present invention and are not intended to limit the scope of the present invention.
[0048] like Figure 1 As shown, the overall system architecture of this invention includes a data source layer, a data processing and knowledge extraction layer, a knowledge graph construction layer, an intelligent query layer, and an intelligent output layer; the system operation includes an online query processing flow and an offline knowledge enrichment flow, as detailed below: 1. Online Query Processing Flow (Real-time Pipeline): This flow is responsible for handling users' real-time query requests. When a user submits a natural language query through a webpage, the request first passes through the asynchronous request processing layer for verification and concurrency control.
[0049] In the online query processing flow, the intent analysis module uses LLM to parse user intent and generate a structured query. The intelligent query planning module then generates a hybrid query plan (including SQL queries, vector queries, and graph queries) targeting the core knowledge base based on this structured query. The query plan is executed asynchronously in parallel, and the results are returned to the deep insight generation module. Finally, the deep insight generation module again calls LLM to synthesize the structured query results into a natural language insight report, which is then streamed back to the user. The specific methods used by the intelligent query planning module to generate the hybrid query plan, as well as the methods for executing and fusing the hybrid query plan's results, will be discussed later in conjunction with... Figure 2 Detailed description.
[0050] 2. Offline Knowledge Enrichment: This process is an automated data processing system that runs continuously in the background. It uses a plugin-based scheduler to periodically pull the latest vulnerability and product information from multiple external data sources, such as NVD, GitHub, and vendor announcements. After processing by a knowledge extraction plugin (utilizing LLM and rule extractors), a validation plugin (performing cross-validation and confidence scoring), and a graph builder, the data is updated in the core knowledge base. Update operations are lightweightly notified to the online system via PostgreSQL's NOTIFY mechanism to invalidate cache or update vectors.
[0051] The specific processing methods for the three core components in the offline knowledge enrichment process are as follows.
[0052] (1) Knowledge Extraction Plugin: The input consists of raw data from various data sources: JSON format vulnerability records from NVD; repository metadata and commit records from code hosting platforms (such as GitHub) (obtained through repository link extraction, platform interface calls, and content structure analysis, including the composition of major programming languages); vulnerability exploitation database (such as ExploitDB) entries (obtained through exploit tag identification, technical report acquisition, and proof-of-concept (PoC) extraction); and vendor security announcement texts. The rule extractor extracts deterministic structured fields (CVE number, CVSS vector and score, CWE vulnerability type, CPE affected products and their version boundaries, reference links, etc.); the LLM extractor extracts fields such as vulnerability type, discovery method, affected components and functions, exploitation prerequisites, and remediation status from unstructured text based on preset prompts. The output constraint is a predefined JSON pattern, and the parsing fails, so the process is downgraded step by step (extracting code blocks, cleaning and retrying, and rule fallback). The output of both types of extractors is uniformly represented as candidate knowledge units: with the (subject entity, relation or attribute name, object entity or attribute value) triple as the core, and with metadata such as source identifier, extractor type, original evidence fragment and extraction timestamp.
[0053] (2) Verification plugin: Calculate the confidence score for each candidate knowledge unit: Confidence = w1 × data source authority + w2 × extractor reliability + w3 × multi-source consistency + w4 × timeliness. Each weight is non-negative and the sum is 1. The values can be configured (e.g., w1 = 0.35, w2 = 0.20, w3 = 0.30, w4 = 0.15). Data source authority is assigned a value according to a preset priority (e.g., official NVD source is 1.0, vendor announcement is 0.9, vulnerability exploitation library is 0.7, GitHub is 0.6); extractor reliability is differentiated by extraction method (e.g., rule extraction is 0.95, LLM extraction is 0.7); the multi-source consistency is calculated as follows: first, entity names, relation or attribute names and version representations are normalized and aligned; after alignment, comparison groups are formed with the same subject and the same relation or attribute name; let the total number of independent sources reporting the comparison group be n, of which the number of independent sources supporting the current candidate object entity or attribute value is k, when n≥2 the multi-source consistency of the candidate knowledge unit is k / n, when n=1 a preset neutral value is taken (e.g., 0.5); for multi-valued relations that can legally correspond to multiple objects for the same subject, different objects are calculated as independent candidate knowledge units, and are not considered to be in conflict because of different objects; timeliness decays according to information timestamp (e.g., 1.0 for within one year, 0.7 for one to three years, and 0.4 for more than three years).
[0054] (3) Graph Builder: The graph builder is responsible for two processes: candidate knowledge unit storage and attribute graph projection. First, the candidate knowledge units are applied to the structured data table that serves as the source of facts according to their confidence level. Then, according to the mapping rules and synchronization mechanism in the Apache AGE integration section, the corresponding data is projected into nodes and edges in the attribute graph. The scored candidate knowledge units are temporarily stored in the candidate knowledge table. This table uses the candidate identifier as the primary key and records the triple content, source identifier, original evidence fragment, confidence score, application target (referring to the structured data table to be written and its target record or field), review status (pending, approved, rejected), application status (not applied, applied, withdrawn), reviewer, and review time. Candidate knowledge units with a confidence level not lower than the high threshold (e.g., 0.8) are automatically written into the corresponding structured data table, their application status is recorded as "applied," and their review status is recorded as "approved" by the system. Candidate knowledge units with a confidence level not lower than the low threshold (e.g., 0.5) but lower than the high threshold are also written into the corresponding structured data table, their application status is recorded as "applied," but their review status remains "pending review" and they enter the manual review queue. Their corresponding target records are marked as "pending review," and their weight is reduced according to a preset coefficient during online queries. Candidate knowledge units with a confidence level lower than the low threshold are not written into the core knowledge base for the time being, their application status is recorded as "not applied," their review status is recorded as "pending review," and they enter the manual review queue. When a candidate knowledge unit passes manual review, its review status is changed to "approved." Among these, unapplied candidate knowledge units are written into the corresponding structured data table, their application status is changed to "applied," and applied candidate knowledge units continue to be retained. Unapplication candidate knowledge units rejected by manual review are discarded; application candidate knowledge units rejected by manual review are withdrawn from the target data by the graph builder, their application status is changed to withdrawn, and the value and confidence of the target data are re-determined based on other valid sources. If there are no other valid sources to support the data, the target data is deleted. When relational data changes, a path recalculation task is generated. When a target record no longer has any valid support candidates with a pending review status, the pending review mark of the target record is cleared. The confidence of the target record in the core knowledge base is taken as the highest confidence score among the currently supporting valid candidate knowledge units, and is recalculated as the support sources are added or removed. When the value claimed by a new candidate knowledge unit conflicts with the existing value of the target record, it is decided according to the data source priority and timeliness weight, and the replaced old value is archived. For multi-valued relations where the same subject can have multiple objects at the same time, different objects are entered into the database separately and their consistency and confidence are calculated independently, and they are not treated as conflicting values.
[0055] In addition, to support the above process, the system also includes the following three basic support components: 1. Enhanced Core KB (Core Knowledge Base): This is the intelligent cornerstone of the system, implemented using a PostgreSQL database and deeply integrated with vector storage and Apache AGE graph database extensions. It is not a ready-made database product, but rather constructed from raw vulnerability intelligence data from multiple sources (NVD data packets, CPE dictionaries, code repository information, etc.) through three processing lines: the structured parsing line parses and normalizes deterministic fields before writing them into the core table; the vectorization line generates semantic vectors from CVEs and product description text through an embedding model and writes them into an independent vector table; the graphization line extracts knowledge and verifies confidence levels between entities before writing them into a relation table, and then projects them into a graph of nodes and edges using a synchronization mechanism to form an attribute graph (see the AGE integration section below). These three elements are stored in the same database and linked by a unified entity primary key, forming a three-in-one knowledge base of "structured data tables (including core tables, relation tables, and derived tables) + independent vector tables + attribute graph," the specific construction methods of which will be detailed later.
[0056] 2. Cache Optimization Layer: Primarily relies on PostgreSQL's native cache, supplemented by lightweight application-layer caching (such as caching frequently accessed intent analysis results) to improve response speed.
[0057] 3. Asynchronous Request Processing Layer: Built on the FastAPI framework, it utilizes its asynchronous features and mechanisms such as connection pools and concurrent semaphores to ensure the stability and high performance of the system in high-concurrency scenarios.
[0058] The core knowledge base is built into the PostgreSQL main database, which includes structured tables (including core tables, relational tables, and derived tables), independent vector tables, and an attribute graph maintained by Apache AGE.
[0059] The data in each table is obtained as follows: The cves table is derived from the parsing of NVD annual and incremental data packets (JSON): fields such as CVE number, description, CVSS score and severity, CWE type, and release time are mapped and written. The products and product_versions tables are derived from the parsing of CPE (Common Platform Enumeration) configuration items: vendor and product names are normalized and deduplicated before being written to the products table, and versions are written to the product_versions table—those that can be normalized are converted to semver (semantic versioning) type for storage; otherwise, the original string is retained and the version scheme type is recorded. When comparing, the scheme is assigned: date forms are compared by date, pure numbers are compared segment by segment, and those with vendor suffixes are compared by major version segment. In CPE, any value (asterisk) is not limited to interval boundaries, and those indicating inapplicability (hyphen) are only compared with the same type; the rest are matched exactly by string. The `cve_products` table is derived from the mapping between vulnerabilities and affected product configurations in NVD. Version boundary fields (such as `versionStartIncluding`) are converted to version ranges represented by upper and lower bounds of the `semver` type and open / closed flags (boundaries that cannot be normalized are retained as raw strings for fallback). The `supply_chain_graph` table is derived from the offline knowledge enrichment process: deterministic dependencies are obtained by parsing the dependency manifest file, and the LLM extractor extracts embedded and dependency statements from announcements and reports. All are scored and categorized before being stored in the database. The `embeddings` table is generated by vectorized lines: CVE descriptions and product information text are used to generate vectors through an embedding model (such as bge-m3, 1024 dimensions), and then written after L2 normalization. The `vulnerability_impact_paths` table is generated by a graph builder that performs dependency closure traversal on high-risk vulnerabilities and materializes the propagation path of materialized impact based on the graph (graph query methods are described later), accelerating online queries.
[0060] Structured data table design: including tables such as `products` (product information), `product_versions` (product versions), `cves` (vulnerability information), and `cve_products` (vulnerability-product association), etc., with each table linked by primary and foreign keys: the `products` table uses the product identifier (id) as the primary key, recording product name, manufacturer, etc.; the `product_versions` table is linked to the primary key of the `products` table via the foreign key `product_id`; normalizable version numbers are stored in a `semver` type field, while non-normalizable version numbers are stored in a raw version string field, recording the version scheme type, and comparisons are performed based on the version scheme type. The corresponding comparison rules are applied; the cves table uses the CVE number as the primary key and records descriptions, CVSS scores, severity, CWE types, etc.; the cve_products table is a many-to-many association table between vulnerabilities and products, with an immutable proxy primary key identifying each row. The foreign keys cve_id and product_id are associated with the primary keys of the cves and products tables, respectively. The applicable scope is recorded using the affected version range field (semver upper and lower bounds and open / close flags), and the confidence field records the confidence level; a unique constraint is applied to (cve_id, product_id, version range)—open boundaries are stored as sentinel values rather than null values (or NULLS NOT DISTINCT) to prevent bypassing the constraint; the proxy primary key provides a stable row identifier for the graph edge synchronization described later. The structured data tables also include the supply_chain_graph (product dependency) table, the entities (extended entities) table, the entity_relationships (extended relationships) table, and the vulnerability_impact_paths (vulnerability impact paths) table. The supply_chain_graph table identifies each row with an immutable proxy primary key. The upstream_product_id and downstream_product_id are foreign keys pointing to the primary key of the products table, recording the upstream product that is depended on and the downstream product that initiates the dependency, respectively. The relationship_type field records the relationship type, the version_constraint field records the version constraint of the downstream product on the upstream product, and the confidence field records the confidence level assessed by the verification plugin. A unique constraint is imposed on (upstream_product_id, downstream_product_id, relationship_type, version_constraint) - the inclusion of version constraints allows the same product pair to save multiple dependencies according to different version ranges. When there is no value, it is handled in the manner of the aforementioned sentinel value.The `cve_id` foreign key in the `vulnerability_impact_paths` table points to the primary key of the `cves` table, and the `source_product_id` and `target_product_id` foreign keys point to the primary key of the `products` table. It also includes fields for the product sequence, propagation hop count, and computation time, recording the product identifier sequence, dependency propagation hop count, and materialization computation time, respectively. This table is a derived table, not graph edges. The graph builder pre-computes materialization based on the attribute graph (see the graph query section below for the method). When the underlying relationships change, the relevant path markers become invalid and are recalculated (see the synchronization mechanism below).
[0061] Independent Vector Table: To avoid bloating the main table, a separate `embeddings` table is designed to specifically store text embedding vectors for CVE descriptions and product information. This table is associated with the core table via the `entity_type` (entity type) and `entity_id` (entity identifier) fields: when `entity_type` is `cve`, `entity_id` stores the primary key (CVE number) of the `cves` table; when `entity_type` is `product`, it stores the primary key of the `products` table. `entity_id` exists only in the `embeddings` table to record the primary key value of the entity to which the vector belongs in its main table; each entity's main table does not need an additional `entity_id` field. Because the primary key types of each entity are different, `entity_id` is stored uniformly as a string and is a logical reference maintained by the application layer. A unique composite index (`entity_type`, `entity_id`) ensures retrieval efficiency and prevents duplicate storage; declarative foreign keys are not used.
[0062] Apache AGE Graph Database Integration: Apache AGE is a graph database extension plugin for PostgreSQL. After loading, the same database instance will have the ability to store and query attribute graphs. This invention utilizes Apache AGE to create an attribute graph named `vulnerability_graph`. Then, using the `products`, `cves`, `cve_products`, `supply_chain_graph`, `entities`, and `entity_relationships` tables as fact sources, nodes and edges are generated by projection according to the following mapping rules. The `product_versions` table is used to provide version information, the `embeddings` table is used for vector retrieval, and the `vulnerability_impact_paths` table is a derived table based on pre-computed attribute graphs. These three tables are not directly projected as nodes or edges. The core knowledge base consists of structured data tables (including core tables, relation tables, and derived tables), independent vector tables, and this attribute graph.
[0063] The vulnerability graph is constructed based on information from the tables in the core knowledge base according to the following mapping rules.
[0064] (1) Node construction: Traverse the products table and create a Product type node for each product (attributes include product identifier, product name, and manufacturer); traverse the cves table and create a CVE type node for each vulnerability (attributes include CVE number, severity, CVSS score, and vulnerability type); traverse the entities table and create corresponding Method, Language, Tool, and other type nodes for the extended entities obtained from knowledge extraction.
[0065] (2) Edge construction: Traverse the cve_products table to create an AFFECTS edge for each association, pointing from the CVE to the Product node. The edge attributes include the affected version range, confidence level and source row identifier (source table name + row proxy primary key, globally unique across tables); Traverse the supply_chain_graph table to create a DEPENDS_ON edge for each dependency, pointing from the downstream product to the upstream product. The edge attributes include version constraint, confidence level and source row identifier; Multiple edges of the same type may exist between the same endpoints due to different version ranges, etc. Incremental synchronization and deletion are both accurately located by the source row identifier. Extended relationships verified by confidence (such as DISCOVERED_BY (discovery method), WRITTEN_IN (writing language), USES_TOOL (tool used)) are similarly created as edges of the corresponding types. Extended entities and relationships also use structured data tables as their fact source: extended entities are stored in the `entities` table, with a unique constraint applied using (entity type, normalized name); extended relationships are stored in the `entity_relationships` table, which records the two ends of the relationship using source type and source identifier, and target type and target identifier. When the endpoint is an extended entity, the source identifier or target identifier is taken from the primary key of the `entities` table; when the endpoint is a product or vulnerability, the primary key of the corresponding structured data table is taken. The validity of the references is verified by the graph builder. This table also records the relationship type and confidence level, with a unique constraint applied using (source type, source identifier, target type, target identifier, relationship type), and each row is identified by an immutable surrogate primary key. Graph attributes such as the `type` attribute of the `Method` are taken from the corresponding fields of the `entities` table. The above entities and relationships are projected onto the attribute graph through the same change log mechanism.
[0066] (3) Synchronization Mechanism: The system is fully constructed during the initial deployment (blown creation of nodes and edges in each table, idempotent writing). Daily operation adopts incremental synchronization with persistent change logs and notification wake-up: the insertion, update and deletion of core tables and relational tables are captured by database triggers and written to the persistent change log table (auto-incrementing sequence primary key, recording entity type, row identifier, operation type and timestamp), and a low-latency wake-up notification is sent to the graph builder through the NOTIFY mechanism of PostgreSQL. After the builder is woken up (supplemented by periodic polling as a fallback), it scans and consumes unprocessed records: reads back the current state of the source table by row identifier, and idempotently aligns the corresponding objects in the graph -- if the source row has been deleted, delete its graph object, otherwise delete the mismatched old edge, create or update the corresponding object, and out-of-order and duplicate processing converge to the current state of the source table (alignment of the same row is executed serially and mutually exclusively). Thanks to the same database storage, the graph side update and change record completion mark is atomically committed in the same database transaction. Success marks completion, failure retains retry, and there is no cross-system partial failure. When changes involve the source table of AFFECTS and DEPENDS_ON edges, a path recalculation task is generated in conjunction with the changes. The recalculation scope is the set of affected vulnerability numbers (for dependency changes, reachable vulnerabilities are looked up along the dependency and impact relationships; for changes that delete old edges, the union of the old and new scopes is used to avoid old path remnants). The task is merged and deduplicated by vulnerability number, and executed mutually exclusively. The recalculated old and new records replace those in the same database and transaction. Before completion, the old records are marked as invalid for use in downgrades. Change logs are persisted, progress is trackable, and failures are retried to ensure that all changes are eventually applied to the property graph (eventual consistency).
[0067] Cypher query language enables efficient execution of complex, multi-hop graph queries. This graph query is the execution form of the graph query subtask in the aforementioned hybrid query plan at the knowledge base layer. Under the AGE extension, Cypher graph queries are executed as embedded SQL functions (the session needs to pre-load the AGE extension and set the retrieval path, which can be done automatically through configuration): the cypher() function is called, passing in the graph name vulnerability_graph and the Cypher statement, and returns an agtype with AGE as the column. After type conversion to SQL scalar (identifier to integer, name to text), it can be directly connected to relational tables within the same SQL statement (such as completing entity details with the products and cves tables), without the need for cross-system data transfer, which is a key advantage of the single-database fusion architecture of this invention; when multiple paths run in parallel, each path is executed through different connections in the same database, and score fusion is completed at the application layer. The synchronization latency of graph projection is described in the aforementioned synchronization mechanism.
[0068] Taking the example of finding products affected by vulnerabilities through the supply chain: Starting from the target CVE node, traverse along the AFFECTS edge to reach directly affected products, then traverse backwards along the DEPENDS_ON edge from zero to N hops (N is the maximum tracing depth; if set to 5, the traversal range is limited to avoid loop combination explosion; the lower bound is zero so that directly affected products are also returned), matching candidate affected products reachable by dependencies within the depth; the same product can be reached via multiple paths, grouped by product, and the shortest path is used to calculate the hop count (the path contains one affecting edge, and the length minus one is the dependency hop count). The query statement is in the form of: PREPARE cve_impact_query(agtype) AS SELECT FROM cypher('vulnerability_graph', $$ MATCH p = (c:CVE {cve_id: $cve_id})-[:AFFECTS]->(:Product)<-[:DEPENDS_ON 0..5]-(d:Product) RETURN d.product_id, d.name, p, length(p) - 1 $$, $1) AS (product_id agtype, name agtype, path agtype, hopsagtype); EXECUTE cve_impact_query('{"cve_id": "CVE-2024-1234"}'); Where length(p)-1 is the dependency propagation hop count of the current path (the dependency propagation hop count of directly affected products is zero); queries return results path by path, without aggregation by product within the graph. Queries are defined and executed using SQL pre-defined statements: key-value mappings are passed in via the third parameter of cypher(), referenced in the statement body by $cve_id, and entity parameters are bound throughout; the upper bound of the variable-length path depth (5 in the above formula) is a syntactic structure and cannot be parameterized, and is replaced into the depth slot after integer verification as described in the intelligent query planning section later. Variable-length paths are traversed by relation type, without checking version compatibility edge by edge within the graph; graph queries return topology candidates path by path, and the system reads the source row identifier of each edge from the returned paths, and performs version constraint verification by back-checking the cve_products table and supply_chain_graph table at the SQL layer. Paths that are clearly incompatible are filtered out; paths that cannot be determined due to insufficient downstream product version information are retained using a conservative strategy and marked as pending confirmation. Finally, the minimum dependency propagation hop count is taken for the retained paths according to the target product, and the verified result is used as the impact analysis output.
[0069] After the graph query results are returned to the SQL layer, they can be used in two ways depending on the intent. First, when the query target is a vulnerability entry (e.g., finding all vulnerabilities related to a product and its upstream dependencies), the query template is symmetrical to the previous example: starting from the product node, it traverses forward along DEPENDS_ON from zero to N, jumping to upstream products, and then matches CVE nodes in reverse via AFFECTS, returning the CVE number and the shortest hop count. The preparatory statement packaging, parameter binding, and deep validation are the same as in the previous example. The graph path results are aligned with the CVE numbers and participate in the weighted fusion sorting of the mixed query results described later. The graph association score is calculated based on the hop count (taken as 1 / (1+hop count): direct impact is 1.0, 1-hop dependency is 0.5, consistent with the definition of graph association score in the fusion formula later). Second, when the query target is a list of affected products (supply chain impact analysis in this example), the graph query results are the main body of the results: they are joined with the products and cves tables to complete the details, directly merged with the affected products, and sorted in ascending order of hop count and descending order of severity, forming a deep, version-compatible supply chain impact analysis result.
[0070] The template library can also contain composite query templates that combine multiple types of extended relationships, such as combining the three types of relationships DISCOVERED_BY, AFFECTS, and WRITTEN_IN and overlaying vulnerability attribute conditions to search for "memory security vulnerabilities discovered through fuzzing that affect C++ products". The pattern is as follows: MATCH (c:CVE {vulnerability_type: 'memory_safety'})-[:DISCOVERED_BY]->(:Method {type: 'fuzzing'}), (c)-[:AFFECTS]->(:Product)-[:WRITTEN_IN]->(:Language {name: 'C++'}) RETURN c.cve_id (comma-separated multiple patterns are associated through the variable c, and node attributes express entity constraints). Parameter binding and whitelist verification are the same as the basic template.
[0071] When graph queries are used to influence the materialization generation and recalculation of paths (written to the vulnerability_impact_paths table, see the aforementioned synchronization mechanism), no aggregation is applied, and the path is returned together (in the form of RETURN d.product_id, p, length(p)). The graph builder parses the nodes and edges in the path at the SQL layer, extracts the product identifiers along the way, and reads the source row identifiers of each edge. After version constraint verification, the shortest path is taken according to (vulnerability number, target product) and written to the materialization table. The shortest path of equal length is taken by default according to the lexicographical order of the path sequence, or all paths can be saved.
[0072] The data pipeline of this invention is carefully designed into two independent, configuration-driven modes to address different data loading needs and enrich offline knowledge.
[0073] One-time bootstrap flow: Triggering method: Manually triggered via a separate command-line script, suitable for full data filling during the initial deployment of the system.
[0074] Configuration check: After the script starts, it first checks whether the environment variable UPDATE_HISTORICAL_DATA is True.
[0075] Full Data Acquisition: If configured as True, the system will call the data source service to download all NVD annual data packets from the starting year (e.g., 2002) to the present.
[0076] Batch import: Parse and transform all downloaded data, and then batch import it into a PostgreSQL database.
[0077] Full vector construction: After the SQL data is fully entered into the database, a task is started to traverse all CVE records, generate text embedding vectors, and store them in the embeddings table.
[0078] Scheduled Flow: Triggering method: Automatically triggered by a background scheduler service (based on the apscheduler library) according to a preset CRON expression (e.g., 3 AM daily).
[0079] Security check: Before the task is executed, the UPDATE_HISTORICAL_DATA flag must be checked to be False to prevent accidental full download from being triggered.
[0080] Incremental Data Acquisition: In this mode, the data source service only downloads two incremental data sources, "modified" and "recent", which contain CVEs that have been recently changed or added.
[0081] Incremental Update: The data processing service compares incremental data with existing data in the database, updates existing CVEs, and creates newly appearing CVEs.
[0082] Vector synchronization: Only for CVE records that have changed in this operation, the vector in the embeddings table is updated synchronously.
[0083] Online query processing flow as follows Figure 2 As shown, a typical user query will be processed in the following steps: Intent Recognition: The user's natural language query (such as "find high-risk remote code execution vulnerabilities affecting the Spring framework") is sent to the LLM. The LLM returns a structured JSON object based on a predefined prompt, which contains the identified entity (such as product: Spring), constraints (such as severity: HIGH, type: RCE), and query intent classification (such as PRODUCT_SEARCH).
[0084] Intelligent Query Planning: After receiving a structured intent, the query planner generates a hybrid query plan by following these steps.
[0085] (1) Query path selection: The planner has a built-in intent category-query path combination mapping rule table. For example: Product vulnerability retrieval uses both SQL query and vector search; semantic descriptive retrieval uses vector search as the main method and SQL query as a filter supplement; supply chain impact analysis uses graph query path and is supplemented by SQL query to complete entity details; statistical trend analysis uses SQL aggregation query path; composite intent takes the union of the paths involved.
[0086] (2) Constraint compilation: The constraints in the structured query object are compiled into parameterized query conditions according to the preset field mapping table, and are divided into hard constraints that must be met and soft preferences that affect the sorting; when the SQL query path is enabled, the SQL query task is constructed according to the parameterized query conditions.
[0087] (3) Semantic query construction: When the vector query path is enabled, the user query text is input into the text embedding model to generate a query vector with the same dimension as the knowledge base vector, and a top-K vector nearest neighbor retrieval task is constructed; pushdown hard constraints are executed as pre-filtering conditions; when the vector query path is not enabled, this task is not constructed.
[0088] (4) Graph query construction: When the graph query path is enabled, a matching template is selected from the preset Cypher query template library. The entity and attribute value parameters are bound parameters. The maximum traceability depth is written into the depth slot of the template after being validated by an integer range. The template library only allows predefined node labels, relationship types and depth ranges. When the graph query path is not enabled, this task is not constructed.
[0089] (5) Plan generation: The query subtasks constructed for each enabled query path are associated with the corresponding query path and assembled with the post-result processing steps into a hybrid query plan; SQL query tasks are executed on structured data tables, vector nearest neighbor retrieval tasks are executed on independent vector tables, and graph query tasks are executed on attribute graphs.
[0090] Asynchronous Parallel Execution and Result Fusion: The system utilizes asyncio to concurrently execute all query subtasks in the hybrid query plan. Each path has an independent timeout threshold, and automatic degradation occurs upon timeout or failure, without blocking the overall response. Result fusion uses vulnerability entries as a unified object (when graph queries are used for supply chain impact analysis and return a product list, the output is organized as described in the Cypher query execution section above, without three-way fusion). The fusion steps are as follows: First, apply the intended structured hard constraints to the union of the three candidate paths: the SQL path results naturally satisfy these constraints, and the structured fields of each candidate recalled by the vector or graph path are verified. Candidate vulnerability entries that do not satisfy any hard constraint (including those with no values in the constrained fields) are eliminated. Then, the candidates that pass the screening are aligned and merged according to CVE numbers, and the normalized score of each candidate vulnerability entry under each query path is calculated. In one implementation, the SQL path segment S_sql = b1 × r + b2 × u; when full-text search is included, r is the normalized full-text relevance obtained by dividing the candidate's full-text search ranking value by the maximum ranking value in the current SQL result, and r is zero when the maximum ranking value is zero; when full-text search is not included, r is 1; u = m / M, where m is the number of soft preference conditions satisfied by the candidate, and M is the total number of soft preference conditions; b1 and b2 are non-negative and b1 + b2 = 1, and when M = 0, b2 = 0 and b1 = 1. The vector path segment S_vec = (1 + cos(q,v)) / 2, where q is the query vector and v is the candidate vector. The graph path segment S_graph = 1 / (1 + h), where h is the minimum dependency propagation hops in the retained path after version constraint verification corresponding to the candidate. Then, the scores are weighted and fused according to configurable weights. For example, the three components are allocated in the same proportion as the two-way formula (0.6 / 0.4): score = 0.48 × SQL pathway score + 0.32 × semantic similarity score + 0.20 × graph association score. When a pathway is not planned to be used or has been downgraded, its weight is renormalized among the other pathways according to the original proportion (as shown in the figure, when a pathway is not used, it is restored to the aforementioned two-way fusion formula 0.6 / 0.4), ensuring that the scores under different pathway combinations are comparable; when a candidate is only not hit by an activated pathway, the score of that pathway is recorded as 0, and the weight is not renormalized. The fused candidate set is ranked by weighted multi-dimensional factors: the final ranking is a weighted sum of the fusion score, source weight score (1.0 for hitting two or more paths, 0.8 for SQL path only, and 0.6 for vector or graph path only), severity score (CVSS base score normalized), time relevance score (decayed by publication time), and information completeness score (scored by the completeness of information elements). Each coefficient is configurable and the sum is 1 (e.g., 0.40, 0.10, 0.25, 0.15, 0.10). The results are output in descending order of the final ranking score.
[0091] Deep insight generation: Input the processed query results and the original user query into the large language model, generate a natural language insight report containing risk assessment, key findings and supporting data according to preset prompts, and return it to the user.
[0092] Monitoring and quality assurance are as follows: 1) Multi-dimensional health scoring system: The system has a built-in health monitor that periodically scores the knowledge base from three dimensions: "data quality," "system performance," and "business value." For example, the "data quality" dimension includes sub-indicators such as coverage, accuracy, freshness, and completeness.
[0093] 2) Confidence and Conflict Resolution: Each piece of information extracted from external data sources is assigned a confidence score. When data from different sources conflict, the system will automatically resolve the conflict based on preset priorities (e.g., official NVD source > vendor announcement > GitHub) and timeliness weights. Conflict information with low confidence will be sent to a manual review queue.
[0094] 3) Real-time monitoring and alerting: The system monitors key performance indicators (such as query latency, LLM availability, and cache hit rate) and business indicators (such as query success rate) in real time, and sets up hierarchical alerting rules to ensure that any anomalies can be detected and handled in a timely manner.
[0095] In addition to using the Apache AGE extension in PostgreSQL, graph databases can also be implemented using standalone graph database systems such as Neo4j, NebulaGraph, or JanusGraph. These systems also enable the modeling and querying of complex relationships.
[0096] Vector databases / storage: In addition to using pgvector extensions or standalone tables in PostgreSQL, dedicated vector databases such as Milvus, Weaviate, or Pinecone can be used to handle larger-scale vector retrieval needs.
[0097] Data synchronization mechanism: In addition to using PostgreSQL's built-in LISTEN / NOTIFY mechanism for lightweight synchronization, for more complex, cross-system distributed data synchronization needs, more professional message queue middleware such as RabbitMQ, Apache Kafka, or Pulsar can also be used.
[0098] Background scheduler: In addition to apscheduler, more powerful distributed task scheduling frameworks such as Celery and Airflow can also be used to manage and monitor the execution of offline data pipelines.
[0099] Although specific embodiments of the invention have been disclosed for illustrative purposes to aid in understanding and implementing the invention, those skilled in the art will understand that various substitutions, variations, and modifications are possible without departing from the spirit and scope of the invention and the appended claims. Therefore, the invention should not be limited to the content disclosed in the preferred embodiments, and the scope of protection claimed by the invention is defined by the claims.
Claims
1. A CVE analysis and retrieval method based on knowledge graphs and large language models, comprising the following steps: Extract the triples (subject entity, relation or attribute name, object entity or attribute value) and metadata of the security vulnerability from each selected data source to generate candidate knowledge units corresponding to the security vulnerability; Calculate the confidence level of each candidate knowledge unit, and save the candidate knowledge units to the core knowledge base according to their confidence levels. A knowledge graph is constructed based on the information in the core knowledge base; The LLM function generates a structured JSON object based on the user's query text and preset prompts, containing identified entities, constraints, and query intent categories. The query planner generates a hybrid query plan based on the JSON object: it categorizes the query intents in the JSON object and queries a pre-defined intent category-query path combination mapping rule table to determine the query path; The constraints in the JSON object are compiled into parameterized SQL conditions based on the pre-defined field mapping table, and are distinguished into hard constraints and soft preferences; a query vector is generated based on the query text, and a top-K vector nearest neighbor retrieval task is constructed; a hybrid query plan is generated based on the top-K vector nearest neighbor retrieval task and the query path. The query subtasks in the hybrid query plan are executed concurrently through the query pathways, and the candidate sets returned by each query pathway are merged, weighted, and sorted before being output.
2. The method according to claim 1, characterized in that, The core knowledge base includes a core table, an independent vector table, and an attribute graph. The core tables include a `products` table for storing product information, a `product_versions` table for storing product versions, a `cves` table for storing vulnerability information, a `cve_products` table for storing vulnerability-product relationships, a `supply_chain_graph` table for storing product dependencies, and a `vulnerability_impact_paths` table for storing vulnerability impact paths. The `products` table uses the product identifier `id` as its primary key and records the product name and manufacturer. The `product_versions` table uses the foreign key `product_...` The `id` field is associated with the primary key of the `products` table. Version numbers are stored using the semantic versioning (`semver`) extended type, supporting version range queries. The `cves` table uses the CVE number as the primary key and records description, CVSS score, severity, and CWE type. The `cve_products` table is a many-to-many relationship table between vulnerabilities and products, with each row identified by an immutable proxy primary key. Foreign keys `cve_id` and `product_id` are associated with the primary keys of the `cves` and `products` tables, respectively. An affected version range field records the applicable scope, and a unique constraint is applied to (`cve_id`, `product_id`, version range`)—open boundaries are stored as sentinel values. Non-null values; the supply_chain_graph table and the vulnerability_impact_paths table are associated with the core table via foreign keys; the supply_chain_graph table identifies each row with an immutable surrogate primary key, including foreign keys upstream_product_id and downstream_product_id pointing to the primary key of the products table, the relationship_type field records the relationship type, version_constraint records the version constraint, and confidence records the confidence level, and applies a unique constraint to (upstream_product_id, downstream_product_id, relationship_type, version_constraint) -- incorporating version constraints allows the same product pair to store multiple dependencies according to different version ranges; the foreign key cve_id in the vulnerability_impact_paths table points to the primary key of the cves table, and the foreign keys source_product_id and target_product_id point to the primary key of the products table, used to record the product identification sequence, propagation hops, and computation time; The independent vector table includes an embeddings table, which stores text embedding vectors for CVE descriptions and product information. The embeddings table is associated with the core table via entity type (entity_type) and entity identifier (entity_id). When entity_type is cve, entity_id stores the CVE number (primary key) from the cves table; when entity_type is product, entity_id stores the product table (primary key ID). A unique composite index (entity_type, entity_id) ensures retrieval efficiency and prevents duplicate storage. The attribute graph was generated using the Apache AGE graph database extension plugin for PostgreSQL.
3. The method according to claim 2, characterized in that, The method for constructing a knowledge graph based on the information in the core knowledge base is as follows: Iterate through the products table and create a Product type node for each product. Iterate through the cves table and create a CVE type node for each vulnerability. Create corresponding method type nodes, language type nodes, and tool type nodes for the extended entities in the entities table. Traverse the cve_products table to create an AFFECTS edge from the CVE to the Product node for each association. The edge attributes include the affected version range, confidence level, and source row identifier. Traverse the supply_chain_graph table to create a DEPENDS_ON edge from the downstream product to the upstream product for each dependency. The edge attributes include version constraints, confidence level, and source row identifier. Create edges of the corresponding type for extended relationships that have been verified by confidence level.
4. The method according to claim 2, characterized in that, The candidate knowledge units and their confidence scores are stored in a candidate knowledge table; then, the candidate knowledge units in the candidate knowledge table are hierarchically saved to the core knowledge base; the candidate knowledge table records the triple content of the candidate knowledge unit, as well as the source identifier, original evidence fragment, confidence score, application target, review status, application status, reviewer, and review time of the candidate knowledge unit.
5. The method according to claim 4, characterized in that, The graph builder classifies and saves candidate knowledge units to the core knowledge base according to confidence level as follows: The graph builder saves candidate knowledge units with confidence level not lower than the high threshold to the core knowledge base. The structured fields in the candidate knowledge units are written into the core table of the core knowledge base, and the entity relationships and confidence levels in the candidate knowledge units are written into the corresponding relationship table of the core knowledge base. Candidate knowledge units with confidence levels between the low and high thresholds are saved to the core knowledge base. Their review status remains pending and they enter the manual review queue. The corresponding target record is marked as pending review, and their use is reduced in online queries. Candidate knowledge units with confidence levels below the low threshold are set to pending review status and enter the manual review queue for review.
6. The method according to claim 1, 2, or 3, characterized in that, Each query path is set with an independent timeout threshold. When a query path times out or fails to execute a query subtask, the query path is downgraded.
7. The method according to claim 1, 2, or 3, characterized in that, The method for merging and weighting the candidate sets returned by each query path is as follows: First, apply the hard constraints uniformly to the candidate sets returned by the query paths and delete candidate vulnerability entries that do not meet the hard constraints; then, merge the candidate vulnerability entries that have passed the screening according to their CVE numbers, calculate the normalized score of each candidate vulnerability entry under each query path, and perform a weighted calculation on the normalized scores of each query path to obtain the fusion score of each candidate vulnerability entry; then, determine the ranking of the candidate vulnerability entries based on their fusion score, source weight score, severity score, time recentity score, and information integrity score.
8. The method according to claim 7, characterized in that, The query pathways include SQL pathways, vector pathways, and graph pathways; the normalized score of the SQL pathway includes the comprehensive normalized full-text relevance and the soft preference satisfaction ratio; the normalized score of the vector pathway is the semantic similarity score that monotonically maps the vector distance to the [0,1] interval; and the normalized score of the graph pathway is the graph association score calculated based on the length of the associated path.
9. The method according to claim 1, 2, or 3, characterized in that, The confidence level is calculated as follows: w1 × data source authority + w2 × extractor reliability + w3 × multi-source consistency + w4 × timeliness. The weights w1, w2, w3, and w4 are non-negative and their sum is 1.
10. A CVE analysis and retrieval system based on knowledge graphs and large language models, characterized in that, It includes a candidate knowledge unit generation module, a hierarchical storage module, a graph builder, an intent recognition module, a query planner, and an asynchronous parallel execution and result fusion module; The candidate knowledge unit generation module is used to extract the triples (subject entity, relation or attribute name, object entity or attribute value) and metadata of security vulnerabilities from each selected data source, and generate candidate knowledge units corresponding to the security vulnerabilities. The hierarchical storage module is used to calculate the confidence level of each candidate knowledge unit and save the candidate knowledge units to the core knowledge base in hierarchical order according to the confidence level. The graph builder is used to construct a knowledge graph based on the information in the core knowledge base; The intent recognition module is used to call LLM to generate a structured JSON object based on the user's query text and preset prompts, which includes the identified entities, constraints, and query intent classification. The query planner is used to generate a hybrid query plan based on the JSON object: it determines the query path by querying a pre-defined intent category-query path combination mapping rule table according to the query intent in the JSON object. The constraints in the JSON object are compiled into parameterized SQL conditions based on the pre-defined field mapping table, and are distinguished into hard constraints and soft preferences; a query vector is generated based on the query text, and a top-K vector nearest neighbor retrieval task is constructed; a hybrid query plan is generated based on the top-K vector nearest neighbor retrieval task and the query path. The asynchronous parallel execution and result fusion module is used to concurrently execute each query subtask in the hybrid query plan through the query path, and then merge, weight, and sort the candidate sets returned by each query path before outputting them.
