{"id":"CVE-2025-39931","state":"PUBLISHED","title":"crypto: af_alg - Set merge to zero early in af_alg_sendmsg","description":"In the Linux kernel, the following vulnerability has been resolved:\n\ncrypto: af_alg - Set merge to zero early in af_alg_sendmsg\n\nIf an error causes af_alg_sendmsg to abort, ctx->merge may contain\na garbage value from the previous loop.  This may then trigger a\ncrash on the next entry into af_alg_sendmsg when it attempts to do\na merge that can't be done.\n\nFix this by setting ctx->merge to zero near the start of the loop.","publishedAt":"2025-10-04T07:30:55.964Z","updatedAt":"2026-10-15T22:02:33.324Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"8ff590903d5fc7f5a0a988c38267a3d08e6393a2","status":"affected","lessThan":"28f6f37abca7c5c9eb3959c66310f1d4d98b8aaf","versionType":"git"},{"version":"8ff590903d5fc7f5a0a988c38267a3d08e6393a2","status":"affected","lessThan":"db2b42425dfbde4983b0c20fb7cfa05f70e6a745","versionType":"git"},{"version":"8ff590903d5fc7f5a0a988c38267a3d08e6393a2","status":"affected","lessThan":"6241b9e2809b12da9130894cf5beddf088dc1b8a","versionType":"git"},{"version":"8ff590903d5fc7f5a0a988c38267a3d08e6393a2","status":"affected","lessThan":"2374c11189ef704a3e4863646369f1b8e6a27d71","versionType":"git"},{"version":"8ff590903d5fc7f5a0a988c38267a3d08e6393a2","status":"affected","lessThan":"24c1106504c625fabd3b7229611af617b4c27ac7","versionType":"git"},{"version":"8ff590903d5fc7f5a0a988c38267a3d08e6393a2","status":"affected","lessThan":"045ee26aa3920a47ec46d7fcb302420bf01fd753","versionType":"git"},{"version":"8ff590903d5fc7f5a0a988c38267a3d08e6393a2","status":"affected","lessThan":"9574b2330dbd2b5459b74d3b5e9619d39299fc6f","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["crypto/af_alg.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.38","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.38","versionType":"semver"},{"version":"5.10.260","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.211","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.154","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.108","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.49","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.16.9","status":"unaffected","lessThanOrEqual":"6.16.*","versionType":"semver"},{"version":"6.17","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["crypto/af_alg.c"]}],"references":["https://git.kernel.org/stable/c/28f6f37abca7c5c9eb3959c66310f1d4d98b8aaf","https://git.kernel.org/stable/c/db2b42425dfbde4983b0c20fb7cfa05f70e6a745","https://git.kernel.org/stable/c/6241b9e2809b12da9130894cf5beddf088dc1b8a","https://git.kernel.org/stable/c/2374c11189ef704a3e4863646369f1b8e6a27d71","https://git.kernel.org/stable/c/24c1106504c625fabd3b7229611af617b4c27ac7","https://git.kernel.org/stable/c/045ee26aa3920a47ec46d7fcb302420bf01fd753","https://git.kernel.org/stable/c/9574b2330dbd2b5459b74d3b5e9619d39299fc6f","https://cert-portal.siemens.com/productcert/html/ssa-082556.html","https://cert-portal.siemens.com/productcert/html/ssa-019113.html","https://cert-portal.siemens.com/productcert/html/ssa-457936.html"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/39xxx/CVE-2025-39931.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-39931","state":"PUBLISHED","datePublished":"2025-10-04T07:30:55.964Z","dateUpdated":"2026-10-15T22:02:33.324Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T07:20:57.147Z"},"containers":{"cna":{"title":"crypto: af_alg - Set merge to zero early in af_alg_sendmsg","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\ncrypto: af_alg - Set merge to zero early in af_alg_sendmsg\n\nIf an error causes af_alg_sendmsg to abort, ctx->merge may contain\na garbage value from the previous loop.  This may then trigger a\ncrash on the next entry into af_alg_sendmsg when it attempts to do\na merge that can't be done.\n\nFix this by setting ctx->merge to zero near the start of the loop."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"8ff590903d5fc7f5a0a988c38267a3d08e6393a2","status":"affected","lessThan":"28f6f37abca7c5c9eb3959c66310f1d4d98b8aaf","versionType":"git"},{"version":"8ff590903d5fc7f5a0a988c38267a3d08e6393a2","status":"affected","lessThan":"db2b42425dfbde4983b0c20fb7cfa05f70e6a745","versionType":"git"},{"version":"8ff590903d5fc7f5a0a988c38267a3d08e6393a2","status":"affected","lessThan":"6241b9e2809b12da9130894cf5beddf088dc1b8a","versionType":"git"},{"version":"8ff590903d5fc7f5a0a988c38267a3d08e6393a2","status":"affected","lessThan":"2374c11189ef704a3e4863646369f1b8e6a27d71","versionType":"git"},{"version":"8ff590903d5fc7f5a0a988c38267a3d08e6393a2","status":"affected","lessThan":"24c1106504c625fabd3b7229611af617b4c27ac7","versionType":"git"},{"version":"8ff590903d5fc7f5a0a988c38267a3d08e6393a2","status":"affected","lessThan":"045ee26aa3920a47ec46d7fcb302420bf01fd753","versionType":"git"},{"version":"8ff590903d5fc7f5a0a988c38267a3d08e6393a2","status":"affected","lessThan":"9574b2330dbd2b5459b74d3b5e9619d39299fc6f","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["crypto/af_alg.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.38","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.38","versionType":"semver"},{"version":"5.10.260","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.211","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.154","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.108","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.49","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.16.9","status":"unaffected","lessThanOrEqual":"6.16.*","versionType":"semver"},{"version":"6.17","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["crypto/af_alg.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/28f6f37abca7c5c9eb3959c66310f1d4d98b8aaf"},{"url":"https://git.kernel.org/stable/c/db2b42425dfbde4983b0c20fb7cfa05f70e6a745"},{"url":"https://git.kernel.org/stable/c/6241b9e2809b12da9130894cf5beddf088dc1b8a"},{"url":"https://git.kernel.org/stable/c/2374c11189ef704a3e4863646369f1b8e6a27d71"},{"url":"https://git.kernel.org/stable/c/24c1106504c625fabd3b7229611af617b4c27ac7"},{"url":"https://git.kernel.org/stable/c/045ee26aa3920a47ec46d7fcb302420bf01fd753"},{"url":"https://git.kernel.org/stable/c/9574b2330dbd2b5459b74d3b5e9619d39299fc6f"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - AF_ALG is a local kernel-crypto socket interface reached via socket()/bind()/sendmsg() syscalls; there is no network exposure. Exploitation requires a local account to issue the syscalls.\nAC:L - The attacker controls both the error-aborting sendmsg (a fault in memcpy_from_msg or a forced allocation error is trivially induced) and the subsequent merge-triggering sendmsg, so the condition is reliably created; heap grooming for full exploitation is also within attacker control.\nPR:L - Creating and driving an AF_ALG socket requires no capabilities and passes no privilege check, so any basic unprivileged local user can reach the vulnerable path.\nUI:N - The entire sequence is performed by the attacker's own process with no victim action required.\nS:U - The corruption stays within the kernel's own security authority (standard local privilege escalation); no VM/IOMMU/sandbox boundary is crossed.\nC:H - The stale merge flag causes an out-of-bounds scatterlist read and a heap write primitive that can be leveraged to disclose kernel memory contents.\nI:H - The merge path performs an attacker-controlled write to an address derived from an out-of-bounds-read scatterlist entry, giving a heap out-of-bounds write suitable for control-flow hijacking/privilege escalation.\nA:H - The inconsistent tsgl state and wild write reliably cause kernel memory corruption and panic/oops."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T12:06:10.490Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.38","versionEndExcluding":"5.10.260"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.38","versionEndExcluding":"5.15.211"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.38","versionEndExcluding":"6.1.154"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.38","versionEndExcluding":"6.6.108"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.38","versionEndExcluding":"6.12.49"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.38","versionEndExcluding":"6.16.9"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.38","versionEndExcluding":"6.17"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"affected":[{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.5","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.6","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.7","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.5","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.6","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.7","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.5","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.6","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.7","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.5","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.6","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.7","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIPLUS S7-1500 CPU 1518-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.5","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIPLUS S7-1500 CPU 1518-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.6","status":"affected","lessThan":"*","versionType":"custom"}]},{"vendor":"Siemens","product":"SIPLUS S7-1500 CPU 1518-4 PN/DP MFP","defaultStatus":"unknown","versions":[{"version":"V3.1.7","status":"affected","lessThan":"*","versionType":"custom"}]}],"references":[{"url":"https://cert-portal.siemens.com/productcert/html/ssa-082556.html"},{"url":"https://cert-portal.siemens.com/productcert/html/ssa-019113.html"},{"url":"https://cert-portal.siemens.com/productcert/html/ssa-457936.html"}],"providerMetadata":{"shortName":"siemens-SADP","orgId":"0b142b55-0307-4c5a-b3c9-f314f3fb7c5e","dateUpdated":"2026-10-15T01:08:37.147Z"},"x_adpType":"supplier"},{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"id":"CVE-2025-39931","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"total"}],"version":"2.0.3","timestamp":"2026-10-15T21:54:45.882341Z"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2026-10-15T22:02:33.324Z"}}]}}}