phonet: pep: do not write beyond optlen in getsockopt
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 02a47617cdce440f60c71a51f3a93f9f5fcc5a7a · < c4487e4d5309de587479ecc2f5173b49586f46f4| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
phonet: pep: do not write beyond optlen in getsockopt
pep_getsockopt() clamps the reported length to the caller's buffer with min_t(), but then stores the value with put_user(val, (int __user *) optval), which always writes sizeof(int) bytes. A getsockopt() call with an optlen smaller than sizeof(int) thus reports the clamped length yet writes a full int, one to three bytes past the user buffer.
Write the value with copy_to_user() bounded by len, so at most optlen bytes are copied, matching the length reported back to userspace.
From the CVE record · Linux
The Linux kernel's phonet PEP getsockopt handler can write beyond a caller-provided user buffer when optlen is smaller than an int. A local caller can trigger a one- to three-byte overrun with a getsockopt() call; the input does not specify authentication requirements or user interaction.
Engineers running Linux kernels with the phonet PEP handler should check whether their kernel includes the fix; affected versions are not specified.