Coder Social home page Coder Social logo

Comments (12)

jovanbulck avatar jovanbulck commented on June 22, 2024

Hmm, looks like most probably your CPU has microcode patches that mitigate Foreshadow (or you have a very recent CPU that has Foreshadow-resistant silicon). The easiest way to make sure you're running unpatched microcode, is to reboot with the dis_ucode_ldr Linux kernel option (as documented in the README). You can check the output of "dmesg | grep microcode" and "cat /proc/cpuinfo"

from sgx-step.

barshuker avatar barshuker commented on June 22, 2024

i tried rebooting after adding the 'dis_ucode_ldr' option but the results remain the same.

  • the "dmesg | grep microcode" command doesn't provide any output now (it did before adding the option..)

  • the output of 'cat /proc/cpuinfo' can be seen in the screenshot (it gave about the same information about each core)

foreshadow2

from sgx-step.

barshuker avatar barshuker commented on June 22, 2024

i just checked the CPU package I own and it seems to have an in-silicon mitigation for FORESHADOW.
does that mean that it's not possible to implement the attack on this hardware?

from sgx-step.

jovanbulck avatar jovanbulck commented on June 22, 2024

yes, this CPU is Foreshadow-resistant in silicon :-) See also here for an overview table:

https://en.wikipedia.org/wiki/Whiskey_Lake_(microarchitecture)#Spectre_and_Meltdown_mitigations_in_modern_Intel_CPU_architectures

from sgx-step.

jovanbulck avatar jovanbulck commented on June 22, 2024

If you want to reproduce Foreshadow-SGX, you'll need access to a Skylake or Kaby Lake processor. Since you have a FS-resistant CPU, I'll close this issue.

from sgx-step.

barshuker avatar barshuker commented on June 22, 2024

I understand.
if i wish to run this attack on a computer which doesn't support TSX, is there a code for this option?

from sgx-step.

jovanbulck avatar jovanbulck commented on June 22, 2024

okay, the PoC code does currently only support TSX. But it should be straightforward to modify the code to register an exception handler instead (using for instance the signal function: https://github.com/jovanbulck/sgx-step/blob/master/app/aep-redirect/main.c#L77)

from sgx-step.

barshuker avatar barshuker commented on June 22, 2024

thank you very much for your help,
I will try that.
Bar.

from sgx-step.

barshuker avatar barshuker commented on June 22, 2024

i tried removing the following line
https://github.com/jovanbulck/sgx-step/blob/master/libsgxstep/foreshadow.c#L78

and add the line you suggested, but i see that it already exists in
https://github.com/jovanbulck/sgx-step/blob/master/app/foreshadow/main.c#L92

but the program gets a signal SIGKILL when reaching 'transient_access' (in foreshadow.c), and therefore doesn't reach the exception handler.

from sgx-step.

jovanbulck avatar jovanbulck commented on June 22, 2024

Yes, you will have to manually circumvent PTE inversion mitigations applied in recent Linux kernels. The problem now is that the kernel panics and kills the application since it detects that you manually modified the PTE before. The solution is to first call mprotect (resulting in an inverted PTE) and then manually modify the PTE back, and the other way around when handling the fault.

I just pushed a mwe to illustrate the concept (make sure to set USE_TSX=0 in main.c and foreshadow.c):

c43669f

Be aware: this is a highly unoptimized proof-of-concept, only showcasing the general concept and suffering from a relatively low success rate. However, after running the PoC a few times, you should see leakage.

from sgx-step.

barshuker avatar barshuker commented on June 22, 2024

i replaced the new files and used USE_TSX=0, but the only values i get are 0xFF and 0x00 (i tried to run it many times and increased the number of retries but the results are the same)

from sgx-step.

jovanbulck avatar jovanbulck commented on June 22, 2024

from sgx-step.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.