Ptr Auth

References:

Pointer Authentication (PA)

Added in ARMv8-A.

Purpose is to detect pointers created by an external entity.

PA uses cryptographic message authentication codes (MACs) to protect the integrity of pointers.

  • It attaches a cryptographic signature to pointer values;
    • unused uppermost bits [62:48/42/39] of the address, could be used to hold auth code.
    • Calculated from three values:
    • the pointer itself,
    • a secret key hidden in the process context,
    • a third value (e.g., the current stack pointer).
    • PAC instruction can be used to calculate the auth code and insert into a pointer value.
  • Those signatures can be verified before a pointer is used.
    • signed pointers cannot be directly dereferenced. (without the sign-extension bits, no longer recognized as valid address)
    • AUT instruction need to be used.
    • auth recalculated and compared.
    • if auth match, auth code will be removed;
    • if does not match, invalid pointer, will crash/exceptions.
  • An attacker lacking the key used to create the signatures, is unlikely to be able to create valid pointers for use in an exploit.

ARM address space layout

Reference: lwn.net: documentation/arm64/memory.txt

ARM64 Linux, up to three level page tables for 64KB page size; up to 4 levels for 4KB page size;

  • 4KB page size:
    • 4 levels: only bottom 48 bits (256TB) + bit[63] of the virtual address are used
    • 3 levels: only bottom 39 bits (512GB) + bit[63]
  • 64KB page size:

    • 3 levels: 48 bits (256TB) + bit[63]
    • 2 levels: 42 bits (4TB) + bit[63]
  • bit [63] is always used to determine the choice between TTBR0 and TTBR1.

    • TTBR: Translation Table Base Register.

Pointer Reuse Attacks

Reference:

PA is vulnerable to pointer reuse attacks where an authenticated pointer is substituted with another.

More

Created Oct 12, 2019 // Last Updated Feb 8, 2023

If you could revise
the fundmental principles of
computer system design
to improve security...

... what would you change?