llama.cpp is an inference of several LLM models in C/C++. Prior to b8146, the gguf_init_from_file_impl() in gguf.cpp is vulnerable to an Integer overflow, leading to an undersized heap allocation. Using the subsequent fread() writes 528+ bytes of attacker-controlled data past the buffer boundary. This is a bypass of a similar bug in the same file - CVE-2025-53630, but the fix overlooked some areas. This vulnerability is fixed in b8146.
{
"cna_assigner": "GitHub_M",
"cwe_ids": [
"CWE-122",
"CWE-190"
],
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/27xxx/CVE-2026-27940.json"
}{
"cpe": "cpe:2.3:a:ggml:llama.cpp:*:*:*:*:*:*:*:*",
"extracted_events": [
{
"introduced": "0"
},
{
"fixed": "b8146"
}
],
"source": [
"AFFECTED_FIELD",
"CPE_RANGE"
]
}
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-27940.json"
[
{
"deprecated": false,
"digest": {
"function_hash": "237165202942983942906497725075148787794",
"length": 77
},
"id": "CVE-2026-27940-02e281b5",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://github.com/ggml-org/llama.cpp/commit/418dea39cea85d3496c8b04a118c3b17f3940ad8",
"target": {
"file": "ggml/src/ggml.c",
"function": "ggml_type_size"
}
},
{
"deprecated": false,
"digest": {
"function_hash": "153160206731029356763590002351126863731",
"length": 152
},
"id": "CVE-2026-27940-14f57f3f",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://github.com/ggml-org/llama.cpp/commit/418dea39cea85d3496c8b04a118c3b17f3940ad8",
"target": {
"file": "ggml/src/ggml.c",
"function": "ggml_row_size"
}
},
{
"deprecated": false,
"digest": {
"function_hash": "105765209256951076871894856843419881722",
"length": 120
},
"id": "CVE-2026-27940-18037e6b",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://github.com/ggml-org/llama.cpp/commit/418dea39cea85d3496c8b04a118c3b17f3940ad8",
"target": {
"file": "ggml/src/ggml.c",
"function": "ggml_type_name"
}
},
{
"deprecated": false,
"digest": {
"line_hashes": [
"235879273727661201733967540613655205724",
"58385882188276219691588462721419164873",
"191446845184780573761418183666990584119",
"73598610256417114486452987720434844674",
"2055265576371160561860084979423106487",
"202844943543802698297271624251820263231"
],
"threshold": 0.9
},
"id": "CVE-2026-27940-308ef6b9",
"signature_type": "Line",
"signature_version": "v1",
"source": "https://github.com/ggml-org/llama.cpp/commit/418dea39cea85d3496c8b04a118c3b17f3940ad8",
"target": {
"file": "ggml/include/ggml.h"
}
},
{
"deprecated": false,
"digest": {
"function_hash": "168006348436972344726150453863256617462",
"length": 3416
},
"id": "CVE-2026-27940-4922c067",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://github.com/ggml-org/llama.cpp/commit/418dea39cea85d3496c8b04a118c3b17f3940ad8",
"target": {
"file": "tests/test-gguf.cpp",
"function": "test_handcrafted_file"
}
},
{
"deprecated": false,
"digest": {
"function_hash": "233596066208819297882737613124850567813",
"length": 6921
},
"id": "CVE-2026-27940-7b9fcb8a",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://github.com/ggml-org/llama.cpp/commit/418dea39cea85d3496c8b04a118c3b17f3940ad8",
"target": {
"file": "tests/test-gguf.cpp",
"function": "get_handcrafted_file"
}
},
{
"deprecated": false,
"digest": {
"function_hash": "60009473843935960773379622346488185336",
"length": 1015
},
"id": "CVE-2026-27940-7bc3a7dd",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://github.com/ggml-org/llama.cpp/commit/418dea39cea85d3496c8b04a118c3b17f3940ad8",
"target": {
"file": "ggml/src/ggml.c",
"function": "ggml_new_object"
}
},
{
"deprecated": false,
"digest": {
"function_hash": "189799790347791289799703545535101174613",
"length": 11753
},
"id": "CVE-2026-27940-7ce1276b",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://github.com/ggml-org/llama.cpp/commit/418dea39cea85d3496c8b04a118c3b17f3940ad8",
"target": {
"file": "ggml/src/gguf.cpp",
"function": "gguf_init_from_file_impl"
}
},
{
"deprecated": false,
"digest": {
"function_hash": "166192981270520862126902465445179310478",
"length": 80
},
"id": "CVE-2026-27940-87fd8438",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://github.com/ggml-org/llama.cpp/commit/418dea39cea85d3496c8b04a118c3b17f3940ad8",
"target": {
"file": "ggml/src/ggml.c",
"function": "ggml_is_quantized"
}
},
{
"deprecated": false,
"digest": {
"function_hash": "260518492887728557740671185218136847360",
"length": 77
},
"id": "CVE-2026-27940-97a7266c",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://github.com/ggml-org/llama.cpp/commit/418dea39cea85d3496c8b04a118c3b17f3940ad8",
"target": {
"file": "ggml/src/ggml.c",
"function": "ggml_blck_size"
}
},
{
"deprecated": false,
"digest": {
"line_hashes": [
"154062123925382003064022396484006757645",
"206816645235802303771312746811264692841",
"260519986329167630872890844051942860501",
"183771080068479098142605011501312384111",
"273899542562406409377465045668019935684",
"3448206542210319336657290427459415743",
"112894012619284045642634501192806193360",
"198795467204335739717315683604345235512",
"236090367864113805495797003213557098943",
"266026466947209202975507498373011613151",
"133234217558091030858422780832366577332",
"269243745153986628825850406221323289204",
"36962994497150639256868328398349782104",
"244067210427460185416922222248726754454",
"278812802975865649876304204395218780016",
"305404991413338492653471504583306179632",
"73673819458200200637172838630279788324",
"32865486599899060937599319934073020361",
"216621403454628720145359746750710614125",
"3067199598446262559449673967884552382",
"155914770819677034537406148509204032073",
"187223949117155214188635126965804692635",
"229449812412919788693457216363438671678"
],
"threshold": 0.9
},
"id": "CVE-2026-27940-a6bbec13",
"signature_type": "Line",
"signature_version": "v1",
"source": "https://github.com/ggml-org/llama.cpp/commit/418dea39cea85d3496c8b04a118c3b17f3940ad8",
"target": {
"file": "tests/test-gguf.cpp"
}
},
{
"deprecated": false,
"digest": {
"function_hash": "150271967966438481298285343475743492710",
"length": 2043
},
"id": "CVE-2026-27940-ae45bcfc",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://github.com/ggml-org/llama.cpp/commit/418dea39cea85d3496c8b04a118c3b17f3940ad8",
"target": {
"file": "tests/test-gguf.cpp",
"function": "handcrafted_file_type_name"
}
},
{
"deprecated": false,
"digest": {
"function_hash": "147421146073917355592611394563655924246",
"length": 1540
},
"id": "CVE-2026-27940-af320a37",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://github.com/ggml-org/llama.cpp/commit/418dea39cea85d3496c8b04a118c3b17f3940ad8",
"target": {
"file": "ggml/src/ggml.c",
"function": "ggml_new_tensor_impl"
}
},
{
"deprecated": false,
"digest": {
"function_hash": "132151183939260549530427058108678959942",
"length": 114
},
"id": "CVE-2026-27940-b3bc0c57",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://github.com/ggml-org/llama.cpp/commit/418dea39cea85d3496c8b04a118c3b17f3940ad8",
"target": {
"file": "ggml/src/ggml.c",
"function": "ggml_get_type_traits"
}
},
{
"deprecated": false,
"digest": {
"line_hashes": [
"215509540780331794221145484366547242004",
"283287230935117545917391389189192223032",
"23616239923852143540555439156359342898",
"151351414289463095665788165934194319603",
"285715362462837977552521538570714272918",
"124026557190465351642102939946554933793",
"265180977647788642149660864575794043074",
"175436406978067935609388183203953444372",
"91253379561410776286006047674074700246",
"76016990635683629151127018587529724366",
"156671419989839971892583897452488277885",
"208348367996407970806289979952140983005",
"7873262586157254938372098401412335605",
"275869175644051842465870268831889322580",
"338639826812145046839291170015472090343",
"157815504937462930412066107177897350467",
"183946349446131878469275412996219653585",
"316564615689674355609870697098719215945",
"232970071372348154822045467089782192165",
"67050119337226017754206469058155815020",
"21084439567528499384239441181998839611",
"196656711485932617344572188593569885193",
"116439714895746575980906751623625197553",
"224657034375715964236400026228999783968",
"277203928778134908645976498553982522641",
"267775350289890834960514772898507519272",
"180730270596891793099901782432219795552",
"91048396625581060455245488304819273516"
],
"threshold": 0.9
},
"id": "CVE-2026-27940-cb871061",
"signature_type": "Line",
"signature_version": "v1",
"source": "https://github.com/ggml-org/llama.cpp/commit/418dea39cea85d3496c8b04a118c3b17f3940ad8",
"target": {
"file": "ggml/src/gguf.cpp"
}
},
{
"deprecated": false,
"digest": {
"function_hash": "223992701511905989670730879231520571193",
"length": 131
},
"id": "CVE-2026-27940-ee8f395b",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://github.com/ggml-org/llama.cpp/commit/418dea39cea85d3496c8b04a118c3b17f3940ad8",
"target": {
"file": "ggml/src/ggml.c",
"function": "ggml_type_sizef"
}
},
{
"deprecated": false,
"digest": {
"line_hashes": [
"93076082661254069015997088205662437989",
"114277931844480135325193988318869595739",
"155724786885240624640520796718773099153",
"297949517331739196934061123119202338869",
"91592398351578158336329706544103376150",
"125558486508905090994967379206702652373",
"50696306196728367872695353076745103770",
"103505283918368967432903544490137423589",
"152836950166057137327185750197262189765",
"128192716652619621786418587913917997110",
"67213837226913146859404883277652659639",
"128974857201338234682871161814196789977",
"50763227672258897774972610938621495534",
"154616532549601576075361541641471311388",
"275006969590311268143062722546322482416",
"159981799779137267534878012723187713181",
"259202238887863422343803753803995978002",
"266021915633269192027888594884886566469",
"5736178922009910266055164626430892600",
"74731363718057126395434950501232471170",
"330733275978021688852011289479914439740",
"26859268593852785021961293684156021472",
"103334812818877418172209807041918768023",
"157210700334483731443998289251363954201",
"115541199760804062859828143461830338157",
"331446010732974294931828828320258767312",
"322366483255555245596712301493335916683",
"212051149171368023336790483254596400735",
"236240928568615604597570436436626254032",
"123469078657843831259258728376687177594",
"109461052962070607433458229484999069470",
"273940874078918157508433892474761551473",
"138416354337581513085603874012407059567"
],
"threshold": 0.9
},
"id": "CVE-2026-27940-eebb7e14",
"signature_type": "Line",
"signature_version": "v1",
"source": "https://github.com/ggml-org/llama.cpp/commit/418dea39cea85d3496c8b04a118c3b17f3940ad8",
"target": {
"file": "ggml/src/ggml.c"
}
}
]
"2026-08-12T15:33:03Z"