Skip to content

Leaking control-flow (Frontal attack) #3394

Closed
@raoulstrackx

Description

Description

  • Type: Bug
  • Priority: Minor

Bug

mbed TLS build:
Version: 2.16.6
OS version: SGX


Discoverers: Ivan Puddu, Moritz Schneider, Miro Haller, Srdjan Capkun, ETH Zurich (i.e., not me)
*Short description: The authors describe in their paper a way to determine control flow in SGX enclaves by precisely timing interrupt latency. This succeeds even in balanced branches such as:

if (secret == 'a') {
  var1 = 1 + var1;
  var2 = 1 + var2;
} else {
  var1 = 2 + var1;
  var2 = 2 + var2;
}

The root cause of this is that the front-end of the processor fetches instructions with a 16 byte well-aligned window. The time to resume an instruction will depend on its location within this fetch window (and thus its virtual address) and instructions near it.
Full description: https://arxiv.org/abs/2005.11516

Solution:

  • Remove the secret dependent branch altogether

*Code locations that require fixes:

  • mpi_montmul (bignum.c: 1924):
    if( mbedtls_mpi_cmp_abs( A, N ) >= 0 )
        mpi_sub_hlp( n, N->p, A->p );
    else
        /* prevent timing attacks */
        mpi_sub_hlp( n, A->p, T->p );

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugcomponent-cryptoCrypto primitives and low-level interfaces

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions