Skip to contentSkip to conversation

LLM enriched CVE entries

PATCH In review Gyorgy Sarvari 3 participants 4 messages Dec 5, 2025 – Dec 12, 2025

lore
Share & tools
lore
#0 lore raw

cover LLM enriched CVE entries

Hello,

tl;dr: This is a proof of concept about using an LLM to enrich CVE feeds. Links are somewhere down below to see the difference. If you think it's useful, please say so. If you think it's not useful, please say so too.

Motivation: the CVE checker associates CVEs with recipes based on the CPE information in the CVE entry. Unfortunately there are quite a few CVE entries missing this information entirely, making it impossible to associate them with any recipes. Looking at this year so far there are over 66000 CVE's opened, of which over 15000 are missing CPEs. Though older entries seem to have better CPE-to-CVE ratio, but for this PoC I'm mostly interested in the latest vulnerabilities.

The idea: in case CPE information is missing, try to derive it from the human language description and the reference links of the CVE, using an LLM. The intuition would be that a good portion of the derived data would be usable, and even though it wouldn't be perfect, it would catch more valid CVEs than without it.

Here I would like to describe my experiments and experiences with the above idea.

The setup: I used a local LLM with ollama, running llama3.1:8b model. The hardware is Ryzen 5950X, 32GB RAM, RTX3060 with 12GB VRAM, running EndeavourOS. The prompt is part of the patch.

The initial load takes a very long time (that's why I restricted the amount for this PoC). Deriving a missing CPE ID takes about a second. My initial approach was to work on all post-2020 CVEs. It took about an hour to process up to the start of 2024, but it failed during a test run (due to a processing bug in my code, the performance remained unchanged). After fixing my code I rectricted the CVEs to process only the entries from 2025 - I wanted to see finally some results to see if it makes any difference. Processing the current year ultimately took 280 minutes. (I have also skipped the CVEs associated with the linux kernel to speed up the process.).

It was using 2 CPU cores completely, indicating that it could be parallelized, but looking further it turned out that my GPU is the bottleneck, it was showing 96-98% utilization with nvidia-smi, and ollama was using ~5.5GB VRAM. (Another idea would be to group the CVEs before sending them to the LLM, but it's untested.)

During processing the entries I noticed that the model produced some strange hallucinations - I did expect incorrect vendor/product details, but strangely it also produced incorrect data structures in its response, like instead of "CPE_ID" key, it returns "OVP_ID" sometimes. This seems to be a problem with a very small portion, and currently I drop these. It tends to miss some asterisks also from the final CPE id. This seems to happen quite frequently, around 20% of the cases. I've heard that intimidating the LLM with some F-bombs in the prompt helps, but haven't tried that yet - for now I try to salvage the ones that only miss 1 asterisk.

This also means that this CPE-derivation is not 100% reproducible - but the idea is still that only a small portion is not reproducible, and we are also only interested in a small portion. And in the code you might also notice that I do some postprocessing of the response... well, LLMs are like that today, I guess. There is no free lunch.

There are some links with the actual results, executed on a few days old oe-core. Only CVE-2025-* entries were processed with LLM:

Without LLM, cve-summary.json (~30MB uncompressed): https://sarvari.me/yocto/llm/without_llm.json.tar.gz
Without LLM, human readable unpatched extract: https://sarvari.me/yocto/llm/no-llm.txt
With LLM, cve-summary.json (~30MB uncompressed): https://sarvari.me/yocto/llm/with_llm.json.tar.gz
With LLM, human readable unpatched extract: https://sarvari.me/yocto/llm/llm.txt
With LLM + commentary about each LLM-guessed entry (LibreOffice Calc, I recommend this): https://sarvari.me/yocto/llm/llm_cves_with_comments.ods

This patch is just a proof of concept.
I'm not sure if/how it could be integrated in the project's
infra - especially the initial load is very heavy, and the patch requires GPU(s).

As a personal opinion, the final result turned out to be better than I initially expected. But I can't deny that it also brings noise, especially due to missing/incorrectly extracted version info. And of course it doesn't make the CVE info complete - it just extends what we have now.

If you would like to try it out, I recommend to delete/backup the downloads/CVE_CHECK2/nvdfkie_1-1.db file before trying. (Delete it after trying also, because the patch changes the schema a bit)

What do you think? If you are not completely averse to LLMs and this idea, I could spend more time on this, and submit something that's more than a PoC.

Looking forward to all kind of feedback, opinion and recommendations, be it positive or negative.

Thank you for coming to my TED talk.

---

Gyorgy Sarvari (1):
cve-update-db: bolt LLM on top of it

 meta/classes/cve-check.bbclass                |   6 +-
 .../recipes-core/meta/cve-update-db-native.bb | 138 ++++++++++++++++--
 2 files changed, 131 insertions(+), 13 deletions(-)
#1 lore raw

PATCH 1/1 cve-update-db: bolt LLM on top of it

[Do not run this on autobuilder, it changes the CVE database]

This patch adds some LLM calls on top of the cve-update-db recipe, to derive missing CPE identifiers. It also extends the cve database with a column to indicate if a given CVE-product association was derived with or without LLM, and includes this information in the final cve json also.

---
 meta/classes/cve-check.bbclass                |   6 +-
 .../recipes-core/meta/cve-update-db-native.bb | 138 ++++++++++++++++--
 2 files changed, 131 insertions(+), 13 deletions(-)
meta/classes/cve-check.bbclass +4 -2
index c63ebd56e1..d9a3636cb4 100644
@@ -360,7 +360,7 @@ def check_cves(d, cve_data):
 
             product_cursor = conn.execute("SELECT * FROM PRODUCTS WHERE ID IS ? AND PRODUCT IS ? AND VENDOR LIKE ?", (cve, product, vendor))
             for row in product_cursor:
-                (_, _, _, version_start, operator_start, version_end, operator_end) = row
+                (_, _, _, version_start, operator_start, version_end, operator_end, llm_guess) = row
                 #bb.debug(2, "Evaluating row " + str(row))
                 if cve_is_ignored(d, cve_data, cve):
                     ignored = True
@@ -440,7 +440,7 @@ def get_cve_info(d, cve_data):
     conn = sqlite3.connect(db_file, uri=True)
 
     for cve in cve_data:
-        cursor = conn.execute("SELECT * FROM NVD WHERE ID IS ?", (cve,))
+        cursor = conn.execute("SELECT NVD.*, PRODUCTS.llm_guess FROM NVD, products WHERE NVD.ID IS ? and NVD.id=PRODUCTS.id", (cve,))
         for row in cursor:
             # The CVE itdelf has been added already
             if row[0] not in cve_data:
@@ -454,6 +454,7 @@ def get_cve_info(d, cve_data):
             cve_data[row[0]]["NVD-modified"] = row[5]
             cve_data[row[0]]["NVD-vector"] = row[6]
             cve_data[row[0]]["NVD-vectorString"] = row[7]
+            cve_data[row[0]]['PRODUCTS-llmGuess'] = row[8]
         cursor.close()
     conn.close()
 
@@ -544,6 +545,7 @@ def cve_write_data_json(d, cve_data, cve_status):
             cve_item["modified"] = cve_data[cve]["NVD-modified"]
             cve_item["vector"] = cve_data[cve]["NVD-vector"]
             cve_item["vectorString"] = cve_data[cve]["NVD-vectorString"]
+            cve_item["llmGuess"] = cve_data[cve]["PRODUCTS-llmGuess"]
         if 'status' in cve_data[cve]:
             cve_item["detail"] = cve_data[cve]["status"]
         if 'justification' in cve_data[cve]:
meta/recipes-core/meta/cve-update-db-native.bb +127 -11

196 lines not on this page · raw message

#2 lore raw
In reply to Gyorgy Sarvari

Hi Gyorgy,

Quoted 20 lines · Gyorgy Sarvari via lists.openembedded.org

Hello,

tl;dr: This is a proof of concept about using an LLM to enrich CVE feeds. Links are somewhere down below to see the difference. If you think it's useful, please say so. If you think it's not useful, please say so too.

Motivation: the CVE checker associates CVEs with recipes based on the CPE information in the CVE entry. Unfortunately there are quite a few CVE entries missing this information entirely, making it impossible to associate them with any recipes. Looking at this year so far there are over 66000 CVE's opened, of which over 15000 are missing CPEs. Though older entries seem to have better CPE-to-CVE ratio, but for this PoC I'm mostly interested in the latest vulnerabilities.

The idea: in case CPE information is missing, try to derive it from the human language description and the reference links of the CVE, using an LLM. The intuition would be that a good portion of the derived data would be usable, and even though it wouldn't be perfect, it would catch more valid CVEs than without it.

[...]

Quoted 4 lines

This patch is just a proof of concept.
I'm not sure if/how it could be integrated in the project's
infra - especially the initial load is very heavy, and the patch requires GPU(s).

I've no interest in the technical implementation of this, just commenting on the reason for this to exist in the first place.

This all comes from "CVEs without CPE exist". This is not a Yocto problem, and it doesn't seem right for Yocto to be the one fixing it. Someone should fix the database everyone is using. This suggested approach may be a way to fix the current content of the database, though I don't know if *we* want this in Yocto for helping and maintain it to some degree, or if living outside of it in a fork or something is better suited.

I don't know what will be the stance of NIST, MITRE or whatever entity is responsible for the database(s) wrt using LLMs to identify CPE for CVEs. I don't understand how they can even accept CVEs without a CPE: "here's a vuln, figure out which piece of software in the world this applies to" is madness to me.

I'm Cc'ing the security folks as that would probably be the people with the most to say about this and with some idea on how to fix processes or bring up issues with the impacted entities.

Cheers,
Quentin

#3 lore raw
Quoted 46 lines · Quentin Schulz via lists.openembedded.org

Hi Gyorgy,

Quoted 20 lines · Gyorgy Sarvari via lists.openembedded.org

Hello,

tl;dr: This is a proof of concept about using an LLM to enrich CVE feeds. Links are somewhere down below to see the difference. If you think it's useful, please say so. If you think it's not useful, please say so too.

Motivation: the CVE checker associates CVEs with recipes based on the CPE information in the CVE entry. Unfortunately there are quite a few CVE entries missing this information entirely, making it impossible to associate them with any recipes. Looking at this year so far there are over 66000 CVE's opened, of which over 15000 are missing CPEs. Though older entries seem to have better CPE-to-CVE ratio, but for this PoC I'm mostly interested in the latest vulnerabilities.

The idea: in case CPE information is missing, try to derive it from the human language description and the reference links of the CVE, using an LLM. The intuition would be that a good portion of the derived data would be usable, and even though it wouldn't be perfect, it would catch more valid CVEs than without it.

[...]

Quoted 4 lines

This patch is just a proof of concept.
I'm not sure if/how it could be integrated in the project's
infra - especially the initial load is very heavy, and the patch requires GPU(s).

I've no interest in the technical implementation of this, just commenting on the reason for this to exist in the first place.

This all comes from "CVEs without CPE exist". This is not a Yocto problem, and it doesn't seem right for Yocto to be the one fixing it. Someone should fix the database everyone is using. This suggested approach may be a way to fix the current content of the database, though I don't know if *we* want this in Yocto for helping and maintain it to some degree, or if living outside of it in a fork or something is better suited.

I don't know what will be the stance of NIST, MITRE or whatever entity is responsible for the database(s) wrt using LLMs to identify CPE for CVEs. I don't understand how they can even accept CVEs without a CPE:
"here's a vuln, figure out which piece of software in the world this applies to" is madness to me.

Quoted 3 lines

I'm Cc'ing the security folks as that would probably be the people with the most to say about this and with some idea on how to fix processes or bring up issues with the impacted entities.

To give another idea here: When I was looking at bug #15932 [1] where we wanted the CPE to be added for CVE-2025-26519, the CPE information was available via the MITRE API [2] but not in the NVD entry [3].

So, before we consult a stochastic parrot, we may want to automate the process of collecting data from other available sources. We may want to cache that additional data within our metadata layers as well as sending it to NIST to get the NVD updated.

Over time we need to move away from relying on the NVD as a single point of failure.

[1]: https://bugzilla.yoctoproject.org/show_bug.cgi?id=15932
[2]: https://cveawg.mitre.org/api/cve/CVE-2025-26519
[3]: https://nvd.nist.gov/vuln/detail/CVE-2025-26519

Best regards,

Signature · 1 line
Paul Barker