{"id":"CVE-2022-49058","state":"PUBLISHED","title":"cifs: potential buffer overflow in handling symlinks","description":"In the Linux kernel, the following vulnerability has been resolved:\n\ncifs: potential buffer overflow in handling symlinks\n\nSmatch printed a warning:\n\tarch/x86/crypto/poly1305_glue.c:198 poly1305_update_arch() error:\n\t__memcpy() 'dctx->buf' too small (16 vs u32max)\n\nIt's caused because Smatch marks 'link_len' as untrusted since it comes\nfrom sscanf(). Add a check to ensure that 'link_len' is not larger than\nthe size of the 'link_str' buffer.","publishedAt":"2025-02-26T01:54:29.195Z","updatedAt":"2026-08-05T08:53:40.101Z","severity":{"score":9.1,"label":"Critical","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"c69c1b6eaea1b3e1eecf7ad2fba0208ac4a11131","status":"affected","lessThan":"3e582749e742e662a8e9bb37cffac62dccaaa1e2","versionType":"git"},{"version":"c69c1b6eaea1b3e1eecf7ad2fba0208ac4a11131","status":"affected","lessThan":"1316c28569a80ab3596eeab05bf5e01991e7e739","versionType":"git"},{"version":"c69c1b6eaea1b3e1eecf7ad2fba0208ac4a11131","status":"affected","lessThan":"eb5f51756944735ac70cd8bb38637cc202e29c91","versionType":"git"},{"version":"c69c1b6eaea1b3e1eecf7ad2fba0208ac4a11131","status":"affected","lessThan":"22d658c6c5affed10c8907e67160cef0b6c92186","versionType":"git"},{"version":"c69c1b6eaea1b3e1eecf7ad2fba0208ac4a11131","status":"affected","lessThan":"4e166a41180be2f1e66bbb6d46448e80a9a5ec05","versionType":"git"},{"version":"c69c1b6eaea1b3e1eecf7ad2fba0208ac4a11131","status":"affected","lessThan":"9901b07ba42b39266b34a888e48d7306fd707bee","versionType":"git"},{"version":"c69c1b6eaea1b3e1eecf7ad2fba0208ac4a11131","status":"affected","lessThan":"515e7ba11ef043d6febe69389949c8ef5f25e9d0","versionType":"git"},{"version":"c69c1b6eaea1b3e1eecf7ad2fba0208ac4a11131","status":"affected","lessThan":"64c4a37ac04eeb43c42d272f6e6c8c12bfcf4304","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/cifs/link.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.37","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.37","versionType":"semver"},{"version":"4.9.311","status":"unaffected","lessThanOrEqual":"4.9.*","versionType":"semver"},{"version":"4.14.276","status":"unaffected","lessThanOrEqual":"4.14.*","versionType":"semver"},{"version":"4.19.239","status":"unaffected","lessThanOrEqual":"4.19.*","versionType":"semver"},{"version":"5.4.190","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.112","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.35","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"5.17.4","status":"unaffected","lessThanOrEqual":"5.17.*","versionType":"semver"},{"version":"5.18","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/cifs/link.c"]}],"references":["https://git.kernel.org/stable/c/3e582749e742e662a8e9bb37cffac62dccaaa1e2","https://git.kernel.org/stable/c/1316c28569a80ab3596eeab05bf5e01991e7e739","https://git.kernel.org/stable/c/eb5f51756944735ac70cd8bb38637cc202e29c91","https://git.kernel.org/stable/c/22d658c6c5affed10c8907e67160cef0b6c92186","https://git.kernel.org/stable/c/4e166a41180be2f1e66bbb6d46448e80a9a5ec05","https://git.kernel.org/stable/c/9901b07ba42b39266b34a888e48d7306fd707bee","https://git.kernel.org/stable/c/515e7ba11ef043d6febe69389949c8ef5f25e9d0","https://git.kernel.org/stable/c/64c4a37ac04eeb43c42d272f6e6c8c12bfcf4304"],"weaknesses":["CWE-120"],"ingestedAt":"2026-10-29T20:05:26.763Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2022/49xxx/CVE-2022-49058.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2022-49058","state":"PUBLISHED","datePublished":"2025-02-26T01:54:29.195Z","dateUpdated":"2026-08-05T08:53:40.101Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-02-26T01:49:39.243Z"},"containers":{"cna":{"title":"cifs: potential buffer overflow in handling symlinks","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\ncifs: potential buffer overflow in handling symlinks\n\nSmatch printed a warning:\n\tarch/x86/crypto/poly1305_glue.c:198 poly1305_update_arch() error:\n\t__memcpy() 'dctx->buf' too small (16 vs u32max)\n\nIt's caused because Smatch marks 'link_len' as untrusted since it comes\nfrom sscanf(). Add a check to ensure that 'link_len' is not larger than\nthe size of the 'link_str' buffer."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"c69c1b6eaea1b3e1eecf7ad2fba0208ac4a11131","status":"affected","lessThan":"3e582749e742e662a8e9bb37cffac62dccaaa1e2","versionType":"git"},{"version":"c69c1b6eaea1b3e1eecf7ad2fba0208ac4a11131","status":"affected","lessThan":"1316c28569a80ab3596eeab05bf5e01991e7e739","versionType":"git"},{"version":"c69c1b6eaea1b3e1eecf7ad2fba0208ac4a11131","status":"affected","lessThan":"eb5f51756944735ac70cd8bb38637cc202e29c91","versionType":"git"},{"version":"c69c1b6eaea1b3e1eecf7ad2fba0208ac4a11131","status":"affected","lessThan":"22d658c6c5affed10c8907e67160cef0b6c92186","versionType":"git"},{"version":"c69c1b6eaea1b3e1eecf7ad2fba0208ac4a11131","status":"affected","lessThan":"4e166a41180be2f1e66bbb6d46448e80a9a5ec05","versionType":"git"},{"version":"c69c1b6eaea1b3e1eecf7ad2fba0208ac4a11131","status":"affected","lessThan":"9901b07ba42b39266b34a888e48d7306fd707bee","versionType":"git"},{"version":"c69c1b6eaea1b3e1eecf7ad2fba0208ac4a11131","status":"affected","lessThan":"515e7ba11ef043d6febe69389949c8ef5f25e9d0","versionType":"git"},{"version":"c69c1b6eaea1b3e1eecf7ad2fba0208ac4a11131","status":"affected","lessThan":"64c4a37ac04eeb43c42d272f6e6c8c12bfcf4304","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/cifs/link.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.37","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.37","versionType":"semver"},{"version":"4.9.311","status":"unaffected","lessThanOrEqual":"4.9.*","versionType":"semver"},{"version":"4.14.276","status":"unaffected","lessThanOrEqual":"4.14.*","versionType":"semver"},{"version":"4.19.239","status":"unaffected","lessThanOrEqual":"4.19.*","versionType":"semver"},{"version":"5.4.190","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.112","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.35","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"5.17.4","status":"unaffected","lessThanOrEqual":"5.17.*","versionType":"semver"},{"version":"5.18","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/cifs/link.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/3e582749e742e662a8e9bb37cffac62dccaaa1e2"},{"url":"https://git.kernel.org/stable/c/1316c28569a80ab3596eeab05bf5e01991e7e739"},{"url":"https://git.kernel.org/stable/c/eb5f51756944735ac70cd8bb38637cc202e29c91"},{"url":"https://git.kernel.org/stable/c/22d658c6c5affed10c8907e67160cef0b6c92186"},{"url":"https://git.kernel.org/stable/c/4e166a41180be2f1e66bbb6d46448e80a9a5ec05"},{"url":"https://git.kernel.org/stable/c/9901b07ba42b39266b34a888e48d7306fd707bee"},{"url":"https://git.kernel.org/stable/c/515e7ba11ef043d6febe69389949c8ef5f25e9d0"},{"url":"https://git.kernel.org/stable/c/64c4a37ac04eeb43c42d272f6e6c8c12bfcf4304"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","baseScore":9.1,"baseSeverity":"CRITICAL"},"scenarios":[{"lang":"en","value":"AV:N - The attacker-controlled MF symlink payload is delivered over SMB as remote file contents and parsed in the CIFS client (query_mf_symlink/check_mf_symlink → parse_mf_symlink), so a malicious or compromised file server triggers the bug across the network.\nAC:L - A crafted 1067-byte MF symlink with an sscanf-derived link_len above 1024 (up to 9999 via %04u) deterministically drives crypto_shash_update/kstrndup past the in-buffer link_str; no race or layout luck is required.\nPR:N - The attacker only needs to operate or impersonate the SMB endpoint; no credentials or privileges on the victim client are required for the server to return the malicious object.\nUI:N - In the worst reasonable deployment (cifsroot defaults include mfsymlinks; fstab/autofs/container shares), ordinary client lookup/revalidate/get_link activity on an already-mounted share parses the planted object with no exploit-time victim action.\nS:U - The heap over-read and any resulting oops stay within the host kernel CIFS client authority and do not cross a VM, IOMMU, or sandbox boundary.\nC:H - parse_mf_symlink feeds an attacker-chosen link_len into hashing/string duplication over link_str, over-reading up to ~9KB past the kmalloc object; that is a large OOB read and can surface heap bytes via kstrndup if the MD5 check is satisfied.\nI:N - The defect is an out-of-bounds read of server-supplied symlink bytes into MD5/kstrndup paths, not an out-of-bounds write or control-flow corruption primitive, matching other SMB client OOB-read symlink parses.\nA:H - Reading thousands of bytes past a 1067-byte allocation can fault unmapped heap and oops the kernel, and a malicious server can trigger the malformed object repeatedly on path access."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T08:53:40.101Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.37","versionEndExcluding":"4.9.311"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.37","versionEndExcluding":"4.14.276"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.37","versionEndExcluding":"4.19.239"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.37","versionEndExcluding":"5.4.190"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.37","versionEndExcluding":"5.10.112"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.37","versionEndExcluding":"5.15.35"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.37","versionEndExcluding":"5.17.4"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.37","versionEndExcluding":"5.18"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CISA ADP Vulnrichment","metrics":[{"cvssV3_1":{"scope":"UNCHANGED","version":"3.1","baseScore":7.8,"attackVector":"LOCAL","baseSeverity":"HIGH","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","integrityImpact":"HIGH","userInteraction":"NONE","attackComplexity":"LOW","availabilityImpact":"HIGH","privilegesRequired":"LOW","confidentialityImpact":"HIGH"}},{"other":{"type":"ssvc","content":{"id":"CVE-2022-49058","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"total"}],"version":"2.0.3","timestamp":"2025-10-01T19:50:01.997451Z"}}}],"problemTypes":[{"descriptions":[{"cweId":"CWE-120","lang":"en","type":"CWE","description":"CWE-120 Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')"}]}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2025-10-01T19:57:06.701Z"}}]}}}