Difference between revisions of "Bug Classes/Use after free"

From Linux Kernel Security Subsystem
Jump to navigation Jump to search
(Undo revision 3837 by DavidWindsor (talk))
(Add reference counter overflow protection to Mitigations)
 
(One intermediate revision by the same user not shown)
Line 11: Line 11:
* segregating memory used by the kernel and by userspace can stop attacks where this boundary is crossed (e.g. PAX_USERCOPY)
* segregating memory used by the kernel and by userspace can stop attacks where this boundary is crossed (e.g. PAX_USERCOPY)
* randomizing heap allocations can frustrate the reallocation efforts the attack needs to perform (e.g. OpenBSD malloc)
* randomizing heap allocations can frustrate the reallocation efforts the attack needs to perform (e.g. OpenBSD malloc)
* reference counter overflow protection (PAX_REFCOUNT, HARDENED_ATOMIC)
* reference counter overflow protection (e.g. PAX_REFCOUNT, HARDENED_ATOMIC)

Latest revision as of 05:14, 4 February 2017

Details

When a memory allocation gets freed but there are still accidentally users of that memory, it is possible that an attacker could control the new memory allocation that fills the freed area, and then manipulate the contents in a way that the system uses its stale pointer and expects a different structure than is currently present. If there are function pointers contained in the structure, this allows for trivial execution control.

Examples

Mitigations

  • clearing memory on free can stop attacks where there is no reallocation control (e.g. PAX_MEMORY_SANITIZE)
  • segregating memory used by the kernel and by userspace can stop attacks where this boundary is crossed (e.g. PAX_USERCOPY)
  • randomizing heap allocations can frustrate the reallocation efforts the attack needs to perform (e.g. OpenBSD malloc)
  • reference counter overflow protection (e.g. PAX_REFCOUNT, HARDENED_ATOMIC)