OpenSC before 0.27.0, fixed in commit 0358817, contains a stack and heap buffer overrun vulnerability in the do_key_value() function in src/pkcs15init/profile.c that allows attackers to corrupt memory by supplying a crafted profile configuration file. During pkcs15-init invocation, a key value entry beginning with '=' followed by more than sizeof(keybuf) characters is copied into keybuf via memcpy without a length check, causing both stack and heap buffer overruns.
PUBLISHED5.2CWE-121x_open-source
OpenSC < 0.27.0 Buffer Overrun in do_key_value() via profile.c
Problem type
Affected products
OpenSC
OpenSC
< 0.27.0 - AFFECTED
< 0358817ec74aeca654f83e7709c7720b14c5db59 - AFFECTED
References
github.com
https://github.com/OpenSC/OpenSC/commit/0358817ec74aeca654f83e7709c7720b14c5db59
vulncheck.com
https://www.vulncheck.com/advisories/opensc-buffer-overrun-in-do-key-value-via-profile-c
JSON source
https://cveawg.mitre.org/api/cve/CVE-2026-40528Click to expand
{
"dataType": "CVE_RECORD",
"dataVersion": "5.2",
"cveMetadata": {
"cveId": "CVE-2026-40528",
"assignerOrgId": "83251b91-4cc7-4094-a5c7-464a1b83ea10",
"assignerShortName": "VulnCheck",
"dateUpdated": "2026-05-29T13:58:18.086Z",
"dateReserved": "2026-04-13T20:29:02.810Z",
"datePublished": "2026-05-29T13:38:11.831Z",
"state": "PUBLISHED"
},
"containers": {
"cna": {
"providerMetadata": {
"orgId": "83251b91-4cc7-4094-a5c7-464a1b83ea10",
"shortName": "VulnCheck",
"dateUpdated": "2026-05-29T13:38:11.831Z"
},
"datePublic": "2026-03-30T00:00:00.000Z",
"title": "OpenSC < 0.27.0 Buffer Overrun in do_key_value() via profile.c",
"descriptions": [
{
"lang": "en",
"value": "OpenSC before 0.27.0, fixed in commit 0358817, contains a stack and heap buffer overrun vulnerability in the do_key_value() function in src/pkcs15init/profile.c that allows attackers to corrupt memory by supplying a crafted profile configuration file. During pkcs15-init invocation, a key value entry beginning with '=' followed by more than sizeof(keybuf) characters is copied into keybuf via memcpy without a length check, causing both stack and heap buffer overruns."
}
],
"affected": [
{
"vendor": "OpenSC",
"product": "OpenSC",
"repo": "https://github.com/OpenSC/OpenSC",
"defaultStatus": "affected",
"versions": [
{
"version": "0",
"status": "affected",
"versionType": "semver",
"lessThan": "0.27.0"
},
{
"version": "0",
"status": "affected",
"versionType": "git",
"lessThan": "0358817ec74aeca654f83e7709c7720b14c5db59"
}
]
}
],
"problemTypes": [
{
"descriptions": [
{
"lang": "en",
"description": "Stack-based Buffer Overflow",
"cweId": "CWE-121",
"type": "CWE"
},
{
"lang": "en",
"description": "Heap-based Buffer Overflow",
"cweId": "CWE-122",
"type": "CWE"
}
]
}
],
"references": [
{
"url": "https://github.com/OpenSC/OpenSC/commit/0358817ec74aeca654f83e7709c7720b14c5db59",
"tags": [
"patch"
]
},
{
"url": "https://www.vulncheck.com/advisories/opensc-buffer-overrun-in-do-key-value-via-profile-c",
"tags": [
"third-party-advisory"
]
}
],
"metrics": [
{
"format": "CVSS",
"scenarios": [
{
"lang": "en",
"value": "GENERAL"
}
]
},
{
"format": "CVSS",
"scenarios": [
{
"lang": "en",
"value": "GENERAL"
}
],
"cvssV3_1": {
"version": "3.1",
"vectorString": "CVSS:3.1/AV:P/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L",
"attackVector": "PHYSICAL",
"attackComplexity": "HIGH",
"privilegesRequired": "NONE",
"userInteraction": "REQUIRED",
"scope": "UNCHANGED",
"confidentialityImpact": "LOW",
"integrityImpact": "LOW",
"availabilityImpact": "LOW",
"baseScore": 3.8,
"baseSeverity": "LOW"
}
}
],
"credits": [
{
"lang": "en",
"value": "Nicholas Carlini of Anthropic",
"type": "finder"
}
],
"tags": [
"x_open-source"
]
},
"adp": [
{
"providerMetadata": {
"orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
"shortName": "CISA-ADP",
"dateUpdated": "2026-05-29T13:58:18.086Z"
},
"title": "CISA ADP Vulnrichment",
"metrics": [
{}
]
}
]
}
}