memfd: deny writeable mappings when implying SEAL_WRITE
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
memfd: deny writeable mappings when implying SEAL_WRITE
When SEAL_EXEC is added, SEAL_WRITE is implied to make W^X. But the implied seal is set after the check that makes sure the memfd can not have any writable mappings. This means one can use SEAL_EXEC to apply SEAL_WRITE while having writeable mappings.
This breaks the contract that SEAL_WRITE provides and can be used by an attacker to pass a memfd that appears to be write sealed but can still be modified arbitrarily.
Fix this by adding the implied seals before the call for mapping_deny_writable() is done.
From the CVE record · Linux
The Linux kernel's memfd sealing check can apply an implied SEAL_WRITE seal while a writable mapping still exists. An attacker can add SEAL_EXEC under that condition, then pass a memfd that appears write-sealed but can still be modified. The input does not specify authentication or user-interaction requirements.
Operators running the Linux kernel should check their installed version against the vendor advisory; affected versions are not specified.