Return to Video

#rC3 - Attacking CPUs with Power Side Channels from Software: Warum leaked hier Strom? (en)

  • 0:05 - 0:13
    rc3 preroll music
  • 0:13 - 0:17
    Herald: In the world of bad puns, everyone
    knows and loves the famous line from the
  • 0:17 - 0:23
    cinematic masterpiece, where the IT
    security specialists ask the CPU architect
  • 0:23 - 0:30
    "Warum leakt hier Strom?" or in English,
    "why is power leaking here?". In this talk
  • 0:30 - 0:36
    our four speakers demonstrate how they can
    attack modern processors purely in
  • 0:36 - 0:43
    software, relying on technical, techniques
    from classical power side channel attacks.
  • 0:43 - 0:47
    They'll explain how to use these
    unprivileged access to energy monitoring
  • 0:47 - 0:54
    features and modern Intel and AMD CPU's.
    Please welcome with a round of digital
  • 0:54 - 0:58
    applause. Moritz Lipp, Michael Schwarz,
    Daniel Gruss and Andreas Kogler.
  • 1:08 - 1:11
    Moritz: Warum leaked hier Strom?
    laugh track
  • 1:11 - 1:14
    Andreas: Und warum wendest du
    kein Masking an?
  • 1:14 - 1:17
    laugh track
  • 1:17 - 1:21
    Daniel: But to understand how we got here,
    we have to go back to San Diego in May
  • 1:21 - 1:23
    2017.
    A: This is a great, Moritz, this is
  • 1:23 - 1:26
    a great talk title. We have to use this.
    laugh track
  • 1:26 - 1:30
    M: Yeah, but actually, before we can
    do a talk, we should do some interesting
  • 1:30 - 1:32
    research that we can present, right?
    laugh track
  • 1:32 - 1:36
    A: Of course. Of course. But we have
    to remember this talk title, it's great.
  • 1:36 - 1:37
    laugh track
    M: Yes.
  • 1:37 - 1:48
    music
  • 1:48 - 1:51
    Michael: Hey Moritz. Today I have found
    something really cool.
  • 1:51 - 1:55
    Moritz: OK, what is it?
    Michael: Our computers, they give
  • 1:55 - 1:59
    us the current energy consumption in
    microjoule and you can access that
  • 1:59 - 2:01
    from userspace.
    laugh track
  • 2:01 - 2:05
    Moritz: What? Are you for real?
    Michael: That, that basically means we
  • 2:05 - 2:09
    could mount something like software based
    power side channels.
  • 2:09 - 2:13
    Moritz: Nice. We should try that out.
    Michael: Yes, I already did, because I
  • 2:13 - 2:16
    thought you might not believe me.
    Moritz: OK.
  • 2:16 - 2:21
    Michael: So this is one of the experiments
    I did. Here you can already see that. I
  • 2:21 - 2:24
    measured the power consumption using that
    interface.
  • 2:24 - 2:26
    Moritz: yeah
    Michael: First while doing nothing, idling
  • 2:26 - 2:28
    around sleeping
    Moritz: like always
  • 2:28 - 2:35
    Michael: and then I increased the CPU
    load, I just did an endless loop which
  • 2:35 - 2:38
    accessed a bit of memory. It's nothing
    interesting but you can already see the
  • 2:38 - 2:42
    difference for that. So you can see that
    there's a difference in doing nothing and
  • 2:42 - 2:47
    doing a lot. That's pretty nice.
    Moritz: We should look take a closer look
  • 2:47 - 2:50
    at that, I think.
    Michael: Definitely.
  • 2:50 - 2:54
    music
  • 2:54 - 2:57
    Moritz: sings You can create
    my power trace
  • 2:57 - 2:59
    Andreas: Oh, this is great. We already
  • 2:59 - 3:05
    have a song for this paper now. Okay.
    Well, this is a great song that we can use
  • 3:05 - 3:07
    for the paper...
  • 3:07 - 3:13
    music
  • 3:13 - 3:17
    Michael: Powertrace,
    like power analysis attacks?
  • 3:17 - 3:21
    Moritz: Yeah, but that would be
    an attack with physical access.
  • 3:21 - 3:23
    Daniel: Software-only would be great
  • 3:23 - 3:26
    Michael: Yes, I told you already,
    I found one can measure energy
  • 3:26 - 3:28
    consumption in micro joules
  • 3:28 - 3:33
    Moritz: Like attacking all server,
    desktop and laptop CPUs
  • 3:33 - 3:36
    Daniel: Ideally with unprivileged access
  • 3:36 - 3:39
    Michael: Imagine if you could
    distinguish different instructions
  • 3:39 - 3:42
    or even observe the Hamming weights of
    operands and memory loads
  • 3:42 - 3:44
    Daniel: Control flow monitoring
  • 3:44 - 3:48
    Moritz: In physical attacks they often go
    for cryptographic keys.
  • 3:48 - 3:53
    That would be great.
    Attacking AES-NI and RSA
  • 3:53 - 3:56
    Daniel: There's just one problem:
    there is no such channel
  • 3:56 - 4:00
    Michael: As I said,
    don't you listen, Daniel?
  • 4:00 - 4:05
    It's like always, there is this RAPL
    register. This interface is already there
  • 4:05 - 4:07
    and you can measure power consumption
  • 4:07 - 4:12
    Daniel: Yes, but only on a
    very coarse granularity
  • 4:15 - 4:17
    Moritz: But first, we need to get a bit
  • 4:17 - 4:21
    more understanding of the CPU power
    management. The thermal design power, the
  • 4:21 - 4:27
    TDP, is the power consumption under the
    maximum theoretical load of the processor.
  • 4:27 - 4:32
    And you probably know that number from the
    CPU specification. And this gives
  • 4:32 - 4:38
    integrators a target to find the proper
    thermal solution when you integrate CPU in
  • 4:38 - 4:46
    a computer so that it doesn't run too hot.
    But for short periods of time, the CPU can
  • 4:46 - 4:53
    consume more power than that. And this we
    can see in this graphic. So here for this
  • 4:53 - 4:59
    Tau moment, the power consumption is much
    higher than for the rest of the CPU.
  • 4:59 - 5:06
    Because usually a CPU is not instantly hot
    and thermal properties propagate over a
  • 5:06 - 5:12
    bit of time. So on the other hand, you
    should also be able to save power. And you
  • 5:12 - 5:16
    can do this in different ways. For
    instance, you could just shut down
  • 5:16 - 5:22
    resources completely that you do not need
    at the moment, or you can reduce the
  • 5:22 - 5:27
    voltage of the processor or those
    components and then it also consumes less
  • 5:27 - 5:33
    power. And on top of that, you could also
    reduce the frequency of the processor and
  • 5:33 - 5:40
    then it also consumes less power. And you
    need this for different scenarios. For
  • 5:40 - 5:45
    instance, with your laptop, you need to
    budget the power consumption because you
  • 5:45 - 5:50
    want to have a long run time. And you also
    know these options that you can change,
  • 5:50 - 5:54
    like the performance level if it should
    run on high performance or to save
  • 5:54 - 5:57
    battery. And you need this in different
    scenarios.
  • 5:57 - 6:02
    Michael: Yes, Moritz, that's exactly what
    I showed you before. Do you remember? I
  • 6:02 - 6:07
    showed you this intel running average
    power limit, short RAPL, that provides
  • 6:07 - 6:13
    exactly that functionality. So with this
    Intel RAPL, you have the power limiting
  • 6:13 - 6:20
    features so you can do exactly what you
    just described, reduce the power usage for
  • 6:20 - 6:26
    your system or for parts of your system.
    And additionally, you also have the energy
  • 6:26 - 6:31
    readings. So you know exactly how much
    power is currently used on a system which
  • 6:31 - 6:36
    helps you do exactly the things you just
    mentioned before, like getting a better
  • 6:36 - 6:40
    power performance balance. So this is
    already there.
  • 6:40 - 6:44
    Moritz: Because the CPU needs to know in a
    way how much power it consumes, right?
  • 6:44 - 6:50
    Michael: Exactly and the scheduler also
    uses that feature to ensure that you get a
  • 6:50 - 6:55
    better battery runtime on your laptop, for
    example. And because this is an important
  • 6:55 - 7:00
    feature you can directly get that from the
    operating system as well. On Linux, you
  • 7:00 - 7:04
    can even get that as an unprivileged
    application. There's the powercap
  • 7:04 - 7:11
    framework that you can directly access in
    this pseudo file system where you get the
  • 7:11 - 7:16
    current power readings, you can directly
    see how much power your CPU currently
  • 7:16 - 7:18
    consumes.
    Moritz: How convenient!
  • 7:18 - 7:23
    Michael: On MacOS and on Windows you have
    a similar thing, but for that you first
  • 7:23 - 7:27
    need to install a driver because usually
    you don't need that as a userspace
  • 7:27 - 7:32
    application. But some drivers might want
    to have that and some drivers even expose
  • 7:32 - 7:37
    that to you and you can use that. So there
    are some drivers that are even
  • 7:37 - 7:41
    preinstalled on some of the motherboards
    that expose that information to
  • 7:41 - 7:47
    applications as well on Windows.
    Moritz: Interesting, but what can we do
  • 7:47 - 7:53
    with this? So I ran some experiments
    because I wanted to know how good this
  • 7:53 - 7:59
    energy consumption monitoring works. And
    in a first run we tried to distinguish
  • 7:59 - 8:04
    instructions from each other. So we
    implemented a small program just running
  • 8:04 - 8:08
    the same instructions all the time, and we
    measured its power consumption. And as we
  • 8:08 - 8:13
    can see easily in this plot, different
    instructions need a different amount of
  • 8:13 - 8:19
    power. So we can distinguish instructions
    from each other. In addition, what I
  • 8:19 - 8:24
    tried, I changed the operands that
    different instructions used. For instance,
  • 8:24 - 8:29
    for a multiplication, you can multiply
    different numbers with each other. And
  • 8:29 - 8:34
    also here we see, depending on the bits
    that are set in the operand a different
  • 8:34 - 8:39
    power consumption of the same instruction,
    but just depending on the operand so we
  • 8:39 - 8:45
    can also distinguish them from each other.
    This could also come in handy later on.
  • 8:45 - 8:51
    But I also tried to load data with an
    instruction and I wanted to know if I
  • 8:51 - 8:55
    could see differences in the power
    consumption, depending on the data that
  • 8:55 - 9:01
    has been loaded by the processor. And as
    you can see in this plot, the more bits
  • 9:01 - 9:08
    that are set in the data that is loaded,
    the more power the CPU consumes. But let's
  • 9:08 - 9:14
    be honest here, to record these
    measurements, it took more than 23 days,
  • 9:14 - 9:20
    so it took quite some time to get to this
    granularity to see those differences, but
  • 9:20 - 9:23
    in other cases, if you just...
    Michael: still a fascinating result.
  • 9:23 - 9:27
    Moritz: Yes, it's a very interesting
    result. And in other cases, Michael, you
  • 9:27 - 9:34
    only want to know if one operand or one
    value is a zero or if it's not a zero. And
  • 9:34 - 9:40
    to come to this result, you don't need
    that many measurements. And the last
  • 9:40 - 9:46
    experiments that we did was we wanted to
    know if we would see a difference in the
  • 9:46 - 9:51
    energy consumption, depending where data
    has been loaded from. For instance, as
  • 9:51 - 9:56
    we've seen also at CCC in many different
    talks over the past years, they are like
  • 9:56 - 10:00
    cache attacks. And here in this
    experiment, we also were able to see a
  • 10:00 - 10:04
    difference in the power consumption if
    your value has been loadad from the cache
  • 10:04 - 10:10
    or if it has to be loaded from the main
    memory, because, of course, then DRAM is
  • 10:10 - 10:16
    activated and it consumes more power. But
    these results are very nice.
  • 10:16 - 10:21
    Michael: Yes, these are really fascinating
    results. So we should actually exploit
  • 10:21 - 10:26
    them and build attacks from that. I mean,
    it's fascinating to see that all these
  • 10:26 - 10:30
    measurements are possible, but we also
    want to do something security related.
  • 10:30 - 10:32
    Moritz: Do you have any idea what we
    could do?
  • 10:32 - 10:37
    Michael: Yes, I have that idea I already
    showed you something from before. If you
  • 10:37 - 10:41
    remember from the office, this one
    measurement. And I extended that
  • 10:41 - 10:42
    measurement.
    Moritz: Yes.
  • 10:42 - 10:48
    Michael: Into a covert channel. So a
    covert channel is a communication channel
  • 10:48 - 10:52
    between two parties that are usually not
    allowed to communicate with each other. So
  • 10:52 - 10:56
    there might be different reasons for that.
    Maybe ther's no interface, maybe there's a
  • 10:56 - 11:02
    policy or a firewall or something that
    prevents them from communicating. And
  • 11:02 - 11:07
    still, in this scenario, I want to
    communicate. So for that, I'm using
  • 11:07 - 11:12
    exactly these power side channels and all
    this analysis you have done to actually
  • 11:12 - 11:18
    communicate. And that's is very simple to
    do, actually. I have two processes, a
  • 11:18 - 11:24
    sender and a receiver, and the sender
    tries to send single bits, zeros and ones.
  • 11:24 - 11:31
    And to send a one bit. I do something that
    uses a lot of energy, like accessing main
  • 11:31 - 11:37
    memory. And if I want to send a zero bit,
    then I don't do anything. And now as a
  • 11:37 - 11:42
    receiver, I just have to measure the power
    consumption and I see if the power
  • 11:42 - 11:48
    consumption has a spike. Then I know the
    sender is sending a one. If there's
  • 11:48 - 11:54
    nothing the sender is apparently sending a
    zero and from that I can get this
  • 11:54 - 11:58
    information a Sender wants to send me.
    Moritz: But did you try that out?
  • 11:58 - 12:02
    laugh track
    Michael: Yes, I also tried that and we can
  • 12:02 - 12:07
    see that here in this graph. So this is
    the energy measurement.
  • 12:07 - 12:11
    Moritz: That's a very clean signal.
    Michael: Yes, it's the energy measurement
  • 12:11 - 12:16
    on the receiver side. And we see exactly
    what I told you before. If there are one
  • 12:16 - 12:20
    bits, then the energy consumption is
    higher. If there are zero bits, it's
  • 12:20 - 12:26
    lower. And from that we can deduce the
    information that I wanted to send on the
  • 12:26 - 12:31
    sender side. Pretty neat, huh?
    Moritz: Yeah, but this is just from one
  • 12:31 - 12:37
    process to another process. Actually, I
    took your idea and used this in a
  • 12:37 - 12:43
    hypervisor scenario where we attack the
    Xen hypervisor. So it's not limited to two
  • 12:43 - 12:50
    processes. I installed the Xen hypervisor
    with two virtual machines. And what Xen
  • 12:50 - 12:56
    does is it also exposes those RAPL
    registers to the virtual machine. So now
  • 12:56 - 13:01
    as a virtual machine, I can have direct
    access to that and then I can establish a
  • 13:01 - 13:04
    covert channel between two virtual
    machines in the cloud.
  • 13:04 - 13:08
    Michael: That's even better.
    Moritz: And this is really working, as you
  • 13:08 - 13:13
    can see here. I mean, here I'm just
    sending ones and zeros, but the signal is
  • 13:13 - 13:16
    pretty clear.
    Michael: That's nice.
  • 13:16 - 13:21
    Moritz: But it's the more that we can do?
    Michael: Yes. I mean, covert channels are
  • 13:21 - 13:26
    great to demonstrate something, that it
    actually works, across VM, really great. I
  • 13:26 - 13:32
    like that. That gives you a different
    threat model here, but still they are a
  • 13:32 - 13:38
    bit boring. So I decided to have something
    more interesting as another example of
  • 13:38 - 13:43
    what we can do. I always like to break
    kernel address space layout randomization,
  • 13:43 - 13:49
    KASLR. With this kernel address space
    layout randomization, the kernel is mapped
  • 13:49 - 13:54
    to different virtual locations every time
    I boot my computer to make it difficult to
  • 13:54 - 13:58
    actually exploit something in the kernel
    because it's not predictable where the
  • 13:58 - 14:06
    kernel is located. And I again use the
    energy consumption to figure out where
  • 14:06 - 14:13
    this kernel is located. So how does that
    work? In this address space I have the
  • 14:13 - 14:18
    kernel which is actually mapped using
    physical pages and I have a lot of nothing
  • 14:18 - 14:24
    where no physical page is mapped. And if I
    try to access these addresses, I can't, of
  • 14:24 - 14:29
    course, because I don't have the
    privileges for that. But I will still see
  • 14:29 - 14:34
    differences when doing that because the
    CPU has to do different things depending
  • 14:34 - 14:38
    on whether there's actually a page or not,
    whether this page can be cached, this
  • 14:38 - 14:43
    translation, or whether this translation
    is always invalid because there's nothing
  • 14:43 - 14:48
    there and it can't be cached. We can see
    that here in an illustration, if you're
  • 14:48 - 14:54
    wondering how that really works. So it
    turns out the kernel can only be mapped to
  • 14:54 - 15:00
    a limited number of places because it has
    to be aligned by two megabytes, so I only
  • 15:00 - 15:06
    need to check the spots there where the
    kernel could be located. And for all these
  • 15:06 - 15:11
    places in the address space, I just try to
    access it and measure how much energy that
  • 15:11 - 15:18
    consumes. And if there's nothing mapped,
    it consumes quite a lot of energy because
  • 15:18 - 15:22
    the CPU has to figure out that there's
    nothing mapped. It goes through the page
  • 15:22 - 15:27
    tables, the page table walk, and at the
    end figures out, oh, there's nothing here,
  • 15:27 - 15:32
    so I can't do anything, and aborts that.
    And that uses quite some energy. But if
  • 15:32 - 15:39
    there's actually the kernel here, then
    this translation is valid. It works. There
  • 15:39 - 15:44
    is something there. It will likely be
    already in the translation caches in the
  • 15:44 - 15:50
    TLB, so the CPU has less work. It just
    needs to check the cache, sees: "Oh it's
  • 15:50 - 15:55
    there. I know that. But wait a moment, you
    can't access it" and can immediately abort
  • 15:55 - 16:02
    and that uses less energy. So just from
    the energy consumption, I can see if
  • 16:02 - 16:06
    there's something mapped and with that see
    where the kernel is actually mapped.
  • 16:06 - 16:11
    Moritz: And this is really working? Did
    you try it out or is this just some
  • 16:11 - 16:13
    theoretical thing?
    Michael: You're always so skeptical. Of
  • 16:13 - 16:19
    course I tried that and I brought the demo
    with me. So here you can see the demo
  • 16:19 - 16:24
    running. This is on a real system. And you
    see it's super fast measuring the energy
  • 16:24 - 16:28
    consumption going over the address space
    and finding the kernel.
  • 16:28 - 16:32
    applause
    Moritz: But these attacks are boring,
  • 16:32 - 16:37
    Michael. We want to attack something real,
    we want to be like real attackers, we want
  • 16:37 - 16:41
    to attack crypto, we want to get keys.
    Michael: Crypto is complicated. That's …
  • 16:41 - 16:43
    laugh track
    Moritz: No, no, no, just listen. So, for
  • 16:43 - 16:48
    instance, with RSA, this is a widely used
    public-key cryptosystem. This is really
  • 16:48 - 16:54
    easy because to encrypt some data, you
    have a public key. To decrypt the data you
  • 16:54 - 17:00
    have a private key. And if we get the
    private key: profit, easy as that. What do
  • 17:00 - 17:03
    you say?
    Michael: Yeah, I know how that works. So
  • 17:03 - 17:09
    the theory is easy, that I have the two
    keys and I have a private key. But then
  • 17:09 - 17:13
    the complicated part starts where you
    really have to understand the crypto to
  • 17:13 - 17:18
    actually attack it. And that's really
    complicated. And I don't really want to do
  • 17:18 - 17:23
    that. Maybe we can a student who tries
    that but I'm out of here. laughter
  • 17:23 - 17:26
    Andreas: Hi guys, I'm a student and I want
    a master thesis.
  • 17:26 - 17:29
    Moritz: This is perfect. Your name is
    Andreas, right?
  • 17:29 - 17:33
    Andreas: Yeah, sure, I'm Andreas.
    laughter
  • 17:33 - 17:37
    M: OK, I don't know if you have heard
    the last bits, but we want to attack some
  • 17:37 - 17:40
    crypto with power side channel attacks.
    A: OK
  • 17:40 - 17:44
    Moritz: And for instance, with RSA, we
    have the private key and the public key.
  • 17:44 - 17:51
    Here we have M the message and C the
    ciphertext and d the private exponent. And
  • 17:51 - 17:56
    of course, it's a computer. It consists of
    ones and zeros. And depending on the key
  • 17:56 - 18:02
    bit if it's a one, for the computation of
    the algorithm, we do a square and the
  • 18:02 - 18:09
    multiply operation. And if it's zero, we
    just do the square operation and we do
  • 18:09 - 18:14
    this for the entire private key.
    A: Now OK, sounds easy enough.
  • 18:14 - 18:22
    M: Yes. And if we can observe that we
    can extract the key. Sounds good. But I
  • 18:22 - 18:28
    did some experiments and it didn't work
    out as well as I've expected it to be. So
  • 18:28 - 18:32
    we need to get a bit more control and
    maybe a better threat model how to do
  • 18:32 - 18:40
    that. And there comes Intel SGX into play.
    And this is an instruction set extension
  • 18:40 - 18:47
    and it provides you with integrity and
    confidentiality of code and data even in
  • 18:47 - 18:56
    untrusted environments. So with Intel SGX,
    you can run programs using protected areas
  • 18:56 - 19:03
    of memory. And even in the case where the
    operating system is compromised and cannot
  • 19:03 - 19:07
    be trusted at all.
    A: So basically we have the full
  • 19:07 - 19:12
    access of all operating system features to
    attack, the enclave.
  • 19:12 - 19:15
    M: Yes, exactly
    A: OK, that sounds quite powerful
  • 19:15 - 19:21
    M: But there's still one issue. It's
    still just executing a program. So we have
  • 19:21 - 19:27
    more power, but we need to make use of
    that. And there is this paper called
  • 19:27 - 19:35
    SGX-Step, which gives you more control of
    enclaves and Jo Van Bulck the author maybe
  • 19:35 - 19:41
    has time to explain this a bit to us so
    maybe we can give him a call.
  • 19:41 - 19:42
    A: Sounds great.
    ringing sound
  • 19:42 - 19:49
    M: Hi Jo, this is Moritz. I've seen
    the paper of yours, this SGX-Step paper.
  • 19:49 - 19:53
    It might be the thing that we need, but
    can you explain a bit what it is about?
  • 19:53 - 20:00
    Jo: Yes, surely Moritz, so SGX-Step I
    think in one sentence it's an enclave
  • 20:00 - 20:05
    execution control framework. What I mean
    with that is that it allows you to
  • 20:05 - 20:09
    precisely control the execution of the
    enclave so that you can interleave it with
  • 20:09 - 20:14
    attacker code, as the name implies, you
    would do one step of the enclave, one step
  • 20:14 - 20:17
    of the attacker again one step of the
    enclave, one step of the attacker, etc.
  • 20:17 - 20:20
    M: That's perfect.
    J: That's the high level.
  • 20:20 - 20:24
    Moritz: Can you expand it a bit on the
    technical point of view? How do you do
  • 20:24 - 20:26
    that?
    J: Yes, I'm very excited about the
  • 20:26 - 20:32
    technical details, Moritz. So let me walk
    you through. The first thing you should
  • 20:32 - 20:36
    know about SGX-Step: it's completely open
    source and we build it on top of stock
  • 20:36 - 20:38
    Linux environments.
    M: Nice
  • 20:38 - 20:43
    J: So what you should start with always
    is to load a malicious kernel driver. And
  • 20:43 - 20:48
    this is called the /dev/sgx-step driver.
    And from that moment on we kind of export
  • 20:48 - 20:55
    all of the powers of the Linux kernel into
    the userspace. And the second component of
  • 20:55 - 20:59
    SGX-step that's important is this small
    library operating system that we wrote.
  • 20:59 - 21:04
    It's called libsgxstep and it sits just
    alongside of the library alongside in the
  • 21:04 - 21:09
    userspace application. And libsgxstep
    allows you to do a number of cool things.
  • 21:09 - 21:14
    I think the most important thing being
    that you have direct access to the APIC
  • 21:14 - 21:20
    x86 high resolution timing device. So that
    sounds interesting for you, right Moriz?.
  • 21:20 - 21:22
    M: Yeah, but what do you
    do with the timer?
  • 21:22 - 21:26
    J: Well, what you can do with the timer
    is essentially you can arm it just before
  • 21:26 - 21:30
    you enter the enclave. And what would
    happen then is, let's have a look. You arm
  • 21:30 - 21:34
    the timer, you start executing the
    enclave, then after a while and interrupt
  • 21:34 - 21:40
    fires and you exit the enclave again.
    M: Hmm, so it's like a debugger like
  • 21:40 - 21:45
    GDB, but for enclaves?
    J: Yes, it's a... it's exactly that
  • 21:45 - 21:49
    Moritz. It's like an attacker controlled
    debugger without using any of the debug
  • 21:49 - 21:54
    features, just using the raw x86
    primitives and operating system files. And
  • 21:54 - 21:59
    just as in a debugger, it allows you to do
    single stepping. So every instruction will
  • 21:59 - 22:03
    be executed one at a time. At most one at
    a time I should say.
  • 22:03 - 22:09
    M: But what happens if I, like,
    configure the timer a bit lower? Does it
  • 22:09 - 22:13
    then like start executing an instruction?
    J: That's a very good question. And
  • 22:13 - 22:18
    configuring the timer is the tricky thing
    about SGX-step. So it will indeed happen
  • 22:18 - 22:24
    sometimes what we call a zero step event.
    So you will fire the timer before the
  • 22:24 - 22:28
    enclave even had time to execute an
    instruction. And those are a kind of event
  • 22:28 - 22:33
    that you can also detect with SGX-step.
    There is a trick to detect whether you had
  • 22:33 - 22:37
    a single step or a zero step.
    M: Jo, this is perfect. This is
  • 22:37 - 22:40
    exactly what we are looking for. Thank you
    so much for explaining that.
  • 22:40 - 22:43
    J: I'm very happy to hear that.
    M: I'm looking forward to try it out
  • 22:43 - 22:45
    now.
    J: Go.
  • 22:45 - 22:47
    M: See you hopefully soon.
    J: Bye bye.
  • 22:47 - 22:49
    M: Bye!
  • 22:49 - 22:55
    M: So SGX-step to sum it up,
    it's an open source Linux kernel
  • 22:55 - 23:00
    framework, and it allows us to configure
    the APIC timer interrupts so that we can
  • 23:00 - 23:06
    interrupt the enclave execution to single
    and zero step it. And this is perfect
  • 23:06 - 23:12
    because now we can combine it with the
    power measurements of Intel RAPL, and this
  • 23:12 - 23:17
    gives us the possibility to measure the
    energy consumption of single instructions.
  • 23:17 - 23:22
    Can you try it out Andi?
    A: OK, let me dig deeper into that.
  • 23:22 - 23:26
    We have this really slow RAPL interface
    here and if you want to visualize it, we
  • 23:26 - 23:30
    could imagine that it's like we have slots
    where we can fill the slots with
  • 23:30 - 23:35
    instructions and the RAPL interface gives
    us the average power consumption over the
  • 23:35 - 23:40
    slots. So in the default case, when we
    execute our target instruction, we have
  • 23:40 - 23:44
    basically one slot filled with the target
    instruction and the remaining slots filled
  • 23:44 - 23:50
    with other instructions we don't know. So
    basically noise. The best case for us
  • 23:50 - 23:54
    would be if we repeat the target
    instruction indefinitely and fill every
  • 23:54 - 23:58
    slot with the target instruction.
    M: This is exactly what I did
  • 23:58 - 24:02
    in the experiments in the beginning.
    A: Yeah, exactly. That's the reason
  • 24:02 - 24:08
    why we got so good measurements there.
    Another trick would be if we only used the
  • 24:08 - 24:12
    target instruction in one slot and fill
    the remaining slots with instructions
  • 24:12 - 24:16
    where we know the energy consumption of or
    we know the instruction of. Then it could
  • 24:16 - 24:21
    do tricks to calculate the energy
    consumption of the target instruction.
  • 24:21 - 24:27
    With SGX-step now we can use a hybrid
    solution here, where we use SGX-step the
  • 24:27 - 24:32
    zero stepping mechanism to reissue this
    instruction and we can fill multiple slots
  • 24:32 - 24:37
    with the same target instruction. Only
    drawback here is that we have a noise
  • 24:37 - 24:43
    overhead of SGX-step itself, but this is
    probably the best solution we can go with.
  • 24:44 - 24:48
    M: This sounds pretty good, so we
    should actually try that out. So we
  • 24:48 - 24:53
    implement a toy cipher, which imitates
    square and multiply basically. So we can
  • 24:53 - 24:58
    leave out all the rest, the overhead of a
    library that would be used otherwise. And
  • 24:58 - 25:03
    we then just single step every instruction
    and measure its energy consumption and
  • 25:03 - 25:08
    then we could plot this. Can you do that?
    A: I got already some results here
  • 25:08 - 25:13
    for us. Basically here we use, as you
    explained, a toy example for square and
  • 25:13 - 25:19
    multiply. And in both cases the square and
    the multiply, they execute exactly six
  • 25:19 - 25:24
    instructions. And so basically we have a
    period of six here. And if you look at the
  • 25:24 - 25:30
    results of the measurement here, we can
    see that we have patterns that repeat with
  • 25:30 - 25:34
    a period of six and we can see that these
    different patterns correspond to either a
  • 25:34 - 25:40
    square or a multiply instruction here.
    M: Nice, perfect, but this is just a
  • 25:40 - 25:42
    toy cipher, right? laughter
    A: Yeah.
  • 25:42 - 25:44
    M: Can we do like real crypto?
    laughter
  • 25:44 - 25:50
    A: We can try. So the plan now is
    that we want to attack a real RSA
  • 25:50 - 25:54
    implementation and the real implementation
    is not like a toy square and multiply
  • 25:54 - 25:59
    algorithm. The real implementation needs
    to handle these huge numbers. So basically
  • 25:59 - 26:03
    there's much more code involved and it's
    not feasible to single step every
  • 26:03 - 26:10
    instruction there. So we must do a more
    clever approach here. If we observe the
  • 26:10 - 26:17
    square multiply part here, we see that the
    square and the multiply function uses the
  • 26:17 - 26:25
    AVX optimized memset function. So the
    energy consumption should also be more if
  • 26:25 - 26:31
    we execute an AVX instruction because AVX
    instructions use much larger registers. So
  • 26:31 - 26:33
    basically we should be able to observe
    that.
  • 26:33 - 26:36
    M: Interesting.
    A: The only drawback here is that we
  • 26:36 - 26:43
    cannot use the same approach as with the
    toy cipher because the square has a
  • 26:43 - 26:49
    different number of instructions as the
    square and multiply function. So we need
  • 26:49 - 26:55
    to do a trick here. So to understand what
    we did here, our target is that we
  • 26:55 - 27:00
    reconstruct a key bit. And if the key bit
    is one we execute a square and multiply.
  • 27:00 - 27:09
    If the key bit is zero, we execute a
    square. So to visualize how we execute
  • 27:09 - 27:14
    zero and single stepping, we have to dig
    into the assembler a bit. So to test for
  • 27:14 - 27:19
    the key bit, we execute like a test
    instruction and then we execute a
  • 27:19 - 27:25
    conditional jump. And if we execute the
    square and multiply we have for instance,
  • 27:25 - 27:29
    K instructions. And if we execute the
    square we have for instance L
  • 27:29 - 27:34
    instructions. So we can see that these two
    numbers do not add up. They are different.
  • 27:34 - 27:40
    So we cannot simply measure each Kth
    instruction and get the key out. So we
  • 27:40 - 27:45
    need to do something different here. We
    can number the instructions after the jump
  • 27:45 - 27:53
    instruction and then using single stepping
    to single step to the Nth instruction
  • 27:53 - 27:59
    after the jump instruction. And on the
    left side, if you observe one, we hit then
  • 27:59 - 28:05
    exactly the AVX instruction there, used in
    the AVX memset. And if you then use our
  • 28:05 - 28:10
    measurement framework to measure exactly
    the nth instruction after the jump, we
  • 28:10 - 28:15
    observe on the one hand a high energy
    consumption and on the other hand, we
  • 28:15 - 28:20
    observe low energy consumption if the
    branch was not taken or a zero.
  • 28:20 - 28:23
    M: It's very clever.
    A: So if you measured both
  • 28:23 - 28:28
    instructions here, we can then combine
    this energy measurements and then use a
  • 28:28 - 28:35
    simple threshold to reconstruct the key
    bit in the beginning. And then we do this
  • 28:35 - 28:39
    iteratively for each key bit.
    M: This sounds pretty promising, but
  • 28:39 - 28:41
    did you try it out?
    laughter
  • 28:41 - 28:45
    A: Sure. Here, the results of that.
    And we can clearly see that we have
  • 28:45 - 28:49
    different energy consumption or in this
    case voltage
  • 28:49 - 28:51
    applause
    based on if the
  • 28:51 - 28:56
    AVX instruction is executed or if the
    instruction at the same offset in the
  • 28:56 - 28:59
    other branch is executed.
    M: How fast does this work, does this
  • 28:59 - 29:03
    take like 5 days?
    A: Not quite that long. We have one
  • 29:03 - 29:08
    problem here that the time per key bit
    increases the further or later the key bit
  • 29:08 - 29:14
    is in the key. So basically the first key
    bit we can reconstruct very fast, but for
  • 29:14 - 29:18
    the last key bit, we need a single step
    much further in the code to actually reach
  • 29:18 - 29:23
    it. And this adds up. So basically the
    time increases linearly between the key
  • 29:23 - 29:29
    bits. But for our key here, our test key
    with 512 bits that takes us about 3.5
  • 29:29 - 29:35
    hours to reconstruct a complete key. Note
    here that we spent like 52 minutes
  • 29:35 - 29:40
    only to find the target instruction. So
    basically, if we could optimize that, the
  • 29:40 - 29:46
    attack would be much faster. In addition,
    we had to record like 3 samples per key
  • 29:46 - 29:50
    bit. But with the implementation, it
    should be possible to actually do that
  • 29:50 - 29:55
    with 1 sample. And since we then only need
    one sample per key bit, we actually can do
  • 29:55 - 29:59
    it with a single trace attack. But we did
    not try that out, unfortunately.
  • 29:59 - 30:03
    Moritz: quite fast.
    Michael: So while all this sounded quite
  • 30:03 - 30:08
    easy and straightforward in hindsight,
    this was actually a really long process.
  • 30:08 - 30:14
    Starting at the beginning of 2017 when we
    discovered this interface, the RAPL
  • 30:14 - 30:19
    interface. Then we had to come up with a
    title for this talk, of course, laughter
  • 30:19 - 30:26
    and some lyrics for a song. We had the
    first toy attack on RSA at the end of
  • 30:26 - 30:34
    2017. It took us until 2018 to finally get
    a KASLR break that was working and only in
  • 30:34 - 30:41
    2019, by the end of 2019. After Andreas
    did his master's thesis on that, we were
  • 30:41 - 30:48
    able to produce a full attack on RSA. And
    this is also the time when we submitted
  • 30:48 - 30:54
    that as a paper to a conference and
    disclosed that to the CPU vendors so that
  • 30:54 - 31:00
    they can fix that. And this is also the
    start of the embargo. This embargo for
  • 31:00 - 31:11
    this vulnerability lasted almost one year.
    So from November 2019 to November 2020. It
  • 31:11 - 31:16
    was just a few weeks ago that this embargo
    ended here.
  • 31:16 - 31:21
    Moritz: But there's one thing missing. We
    really wanted to do crypto attacks, but
  • 31:21 - 31:28
    not only with SGX-step as a compromised
    operating system, but also from userspace.
  • 31:28 - 31:34
    But as we've seen, it's so difficult to
    measure parts of the code without having
  • 31:34 - 31:40
    SGX-step. But what we can do is we can
    measure the power consumption of the
  • 31:40 - 31:46
    overall execution of an algorithm and
    there correlation power analysis comes in
  • 31:46 - 31:53
    handy. And there what we do is we build a
    power consumption model of our device. As
  • 31:53 - 31:59
    we've heard earlier, the Hamming Weight is
    the number of bits that is set in an
  • 31:59 - 32:06
    operand or in the data. And we assume that
    if a bit is set, the computer takes more
  • 32:06 - 32:11
    power to process it. In addition, what you
    can use as a different model is the
  • 32:11 - 32:18
    Hamming distance. So from one operation to
    the other, how many bits change? And then
  • 32:18 - 32:25
    we assume the more bits change, the more
    power is consumed. And we really want to
  • 32:25 - 32:31
    try that out. So what we are targeting now
    is AES-NI, a side channel resistant
  • 32:31 - 32:37
    instruction set of Intel. And we target it
    in a scenario where we can trigger the
  • 32:37 - 32:44
    encryption and decryption of many, many
    blocks over long time so that the
  • 32:44 - 32:51
    execution time is longer than the RAPL
    update rate, so that we can really see the
  • 32:51 - 32:56
    power consumption in our measurement. And
    this is used, for instance, in disk
  • 32:56 - 33:05
    encryption or decryption or if you seal or
    unseal the SGX enclave state. And we can
  • 33:05 - 33:11
    now do that and record power measurements
    in different scenarios, right?
  • 33:11 - 33:17
    Andreas: Sure, we can try that. So in our
    experiment, we recorded two million traces
  • 33:17 - 33:26
    over 26 hours for SGX environment. But we
    also tried to reconstruct it without SGX
  • 33:26 - 33:30
    where we used the encryption inside a
    kernel module. And there we recorded
  • 33:30 - 33:37
    4 million traces in 50 hours. And to
    understand the attack here, we have to
  • 33:37 - 33:42
    look at this animation. So basically we
    have our computer where secret key is
  • 33:42 - 33:50
    stored somewhere intern. Then we have this
    key to encrypt some messages and we also
  • 33:50 - 33:54
    have the power consumption here. And what
    we now did is we recorded the encrypted
  • 33:54 - 34:01
    message and the power consumption it took
    to encrypt this message for many messages.
  • 34:01 - 34:08
    And then we use a model of the CPU here to
    predict the energy consumption, to
  • 34:08 - 34:13
    reconstruct the key. The key is usually
    split up into parts, where each of the
  • 34:13 - 34:21
    parts can have a value between 0 and 255.
    So to reconstruct the key here, we simply
  • 34:21 - 34:29
    use our measurements in the model and we
    try out one of the key parts and estimate
  • 34:29 - 34:36
    the energy consumption for the key part.
    And then we store the correlation between
  • 34:36 - 34:43
    the recorded messages and the prediction.
    And we do this for every of the possible
  • 34:43 - 34:50
    key values. And once we found the key
    value of the highest correlation, we know
  • 34:50 - 34:57
    that this key value corresponds to the key
    part of the key. And we then simply repeat
  • 34:57 - 35:02
    the process for each of the parts of the
    key until we get the final key.
  • 35:02 - 35:07
    M: And we actually tried that out. So
    here in our demo video, you see on the
  • 35:07 - 35:13
    left where we test all the combinations
    and see what is the most likely key
  • 35:13 - 35:18
    candidate at the moment, while for a
    single key byte on the right, you see
  • 35:18 - 35:24
    every possible value and the correlation.
    So in the beginning, with not that many
  • 35:24 - 35:30
    traces processed, it's not very clear
    which key candidate is the right one,
  • 35:30 - 35:35
    because there's so much measurement noise
    introduced by measuring over the overall
  • 35:35 - 35:41
    execution time. But over time, this signal
    gets more stable and we see on the right
  • 35:41 - 35:46
    with the peak getting more and more
    distance from the other candidates that
  • 35:46 - 35:52
    this is our correct key byte. And we do
    this, as Andreas said, for every possible
  • 35:52 - 35:57
    key byte with every possible value. So in
    the end, we end up with the correct key.
  • 35:57 - 36:01
    applause
    A: OK, but this seems like it's only
  • 36:01 - 36:06
    Intel CPUs. Does this also affect others?
    M: Yes. So actually, we also tried
  • 36:06 - 36:11
    out how to CPU vendors if they have
    similar interfaces. And for instance, AMD
  • 36:11 - 36:18
    is affected as well. But we never really
    heard back from them after our disclosure.
  • 36:18 - 36:24
    And the patch how to try to solve the
    problem with the driver is similar to the
  • 36:24 - 36:27
    one that Intel has.
    A: Your right Moritz, it actually
  • 36:27 - 36:32
    works. So I tried the same code on AMD.
    The one you showed before was
  • 36:32 - 36:37
    distinguishing operands, at that also
    works on AMD. That's pretty nice. It's not
  • 36:37 - 36:41
    an Intel only issue. It also affects at
    least AMD as well.
  • 36:41 - 36:45
    M: Yes, but actually there are many
    other vendors as well that provide
  • 36:45 - 36:50
    interfaces, even some of them unprivileged
    to user space where you could probably
  • 36:50 - 36:56
    mount similar attacks. For instance,
    Nvidia, IBM, or Marvell and Ampere.
  • 36:56 - 37:01
    A: So this is really an industry
    wide problem here. And we've also seen
  • 37:01 - 37:08
    that from the media coverage. So not only
    German news brought about that like Heise
  • 37:08 - 37:14
    or Golem, but it also went more
    international with ZDNET, Ars Technica,
  • 37:14 - 37:21
    CSO, Tech Radar, Computer Weekly and many,
    many others that wrote about this new type
  • 37:21 - 37:29
    of vulnerability that affects many
    computers out there. And I guess if it
  • 37:29 - 37:31
    affects many computers, we should do
    something against that.
  • 37:31 - 37:36
    M: Yes, you're right. We cannot only
    have an attack and no mitigation against
  • 37:36 - 37:41
    it. This would not be right. And indeed,
    it's quite easy to fix that because we
  • 37:41 - 37:46
    said in the beginning, you have
    unprivileged access to those registers. So
  • 37:46 - 37:52
    we just restrict the access. And we are
    done, and this is exactly a one line patch
  • 37:52 - 37:59
    for the Linux kernel. But as we've seen
    with the threat model of Intel SGX, which
  • 37:59 - 38:05
    allows a compromised operating system. So
    this one line patch does not help there
  • 38:05 - 38:11
    because I'm the operating system, I can do
    whatever I want to. We need more and more
  • 38:11 - 38:18
    complex mitigations. And in this case,
    microcode updates are necessary. And what
  • 38:18 - 38:24
    Intel does is to fall back to the model of
    the energy consumption. So they have an
  • 38:24 - 38:29
    internal model. How much energy is
    consumed by an executed instruction and
  • 38:29 - 38:34
    use that instead of the real measurement.
    And this does not allow to distinguish
  • 38:34 - 38:41
    data and operands from each other again.
    So if your implementation is implemented
  • 38:41 - 38:47
    correctly, if you use constant time, then
    you are mitigated and protected against
  • 38:47 - 38:53
    these attacks. And as we see here in the
    plot, we tried to mitigation out. So on
  • 38:53 - 38:58
    the left, we were able to see differences
    depending on the Hamming weight of the
  • 38:58 - 39:04
    operands. And on the right with the
    mitigation in place, it just does not work
  • 39:04 - 39:07
    anymore and you cannot see any
    differences. applause
  • 39:07 - 39:11
    Andreas: Nice. So you really
    can't read her power trace any more.
  • 39:11 - 39:36
    Music: Pokerface by Lady Gaga
  • 39:36 - 39:40
    sings
    I wonna probe 'em like in 1943
  • 39:40 - 39:43
    touch 'em, measure wattage
    correlate and get the key
  • 39:43 - 39:44
    I probe it
  • 39:44 - 39:47
    Oscilloscopes are not the same
    without a probe
  • 39:47 - 39:52
    And babe, if it's remote if it's not code,
    it cannot run
  • 39:56 - 40:00
    I'll let him plot, let's see what he's got
  • 40:04 - 40:08
    I'll let him plot, let's see what he's got
  • 40:08 - 40:10
    Can't read my, can't read my
  • 40:10 - 40:14
    No he can't read my power trace
  • 40:14 - 40:16
    She's got the countermeasure
  • 40:16 - 40:18
    Can't read my, can't read my
  • 40:18 - 40:22
    No he can't read my power trace
  • 40:22 - 40:25
    She's got the countermeasure
  • 40:25 - 40:28
    P-p-p-power trace, p-p-power trace
  • 40:29 - 40:32
    P-p-p-power trace, p-p-power trace
  • 40:33 - 40:36
    P-p-p-power trace, p-p-power trace
  • 40:37 - 40:40
    P-p-p-power trace, p-p-power trace
  • 40:41 - 40:44
    applause
  • 40:44 - 40:46
    Moritz: With all those nasty songs, we
  • 40:46 - 40:51
    wrote them down in a scientific paper and
    the PLATYPUS paper has been accepted
  • 40:51 - 40:57
    recently at a conference. And we also want
    to thank you, all the other coauthors who
  • 40:57 - 41:05
    are not in this talk, like David Oswald,
    Catherine Easton and Claudio Canela. To
  • 41:05 - 41:10
    sum it up, what we have seen is that with
    power sidechannel attacks, you can even
  • 41:10 - 41:17
    exploit them from software. So there is no
    need to attach an oscilloscope on modern
  • 41:17 - 41:20
    Intel CPUs.
  • 41:20 - 41:23
    Michael: And what we've also seen is
    that since the SGX threat model allows for
  • 41:23 - 41:28
    much more capable attackers, mitigating
    power sidechannel attacks on the SGX
  • 41:28 - 41:32
    enclaves is much more work than simple
    software patches.
  • 41:32 - 41:35
    Andreas: Yes, and that concludes
  • 41:35 - 41:40
    our talk on PLATYPUS. Thank you all for
    listening.
  • 41:40 - 41:57
    Applause and Music
  • 41:59 - 42:06
    Herald: Thank you very much for your
    excuse me, nerdy talk and thank Moritz,
  • 42:06 - 42:13
    Michael, Daniel and Andreas. We head over
    to our Q&A session and the first question
  • 42:13 - 42:21
    would be, how does it come that you have
    so, let's say through the back door
  • 42:21 - 42:27
    against CPU attack against the CPU idea,
    you mentioned you attack the through a
  • 42:27 - 42:32
    power driver RSA. Could you tell me a
    little bit more about that?
  • 42:32 - 42:37
    Moritz: Yes. So the basic idea of
    attacking cryptographic algorithms with
  • 42:37 - 42:41
    power side channel attacks is not very new
    This was like one of the first things
  • 42:41 - 42:46
    researchers have shown, but most of the
    time for like smaller devices, like smart
  • 42:46 - 42:53
    cards, like your bank card, for instance.
    And for those attacks, you usually had
  • 42:53 - 42:57
    like an oscilloscope that you needed to
    attach to the device to do the attack. But
  • 42:57 - 43:02
    with modern processors, they have
    basically an oscilloscope built into the
  • 43:02 - 43:07
    processor, which you can read out as the
    operating system. And in our case, there
  • 43:07 - 43:12
    are like drivers that expose this
    interface, also to userspace. So from
  • 43:12 - 43:18
    there as an unprivileged attacker, you can
    then try to exploit that. And yeah
  • 43:18 - 43:23
    basically the best thing that we wanted to
    achieve with those attacks is to attack
  • 43:23 - 43:29
    cryptographic algorithms and not to
    transmit some data between two processes.
  • 43:29 - 43:36
    Herald: Cool, thank you. Our next
    question, you mentioned a little bit about
  • 43:36 - 43:44
    ARM sorry, AMD, how about ARM? So not x86
    architecture?
  • 43:44 - 43:49
    Moritz: So there are many other vendors
    that have similar interfaces, some of them
  • 43:49 - 43:56
    also provide drivers that expose them
    directly to userspace, but we hardly had
  • 43:56 - 44:01
    any access to those devices, so we could
    not really fully evaluate if these attacks
  • 44:01 - 44:06
    are also possible on them. But in the
    paper, we have an appendix where we
  • 44:06 - 44:10
    describe them in a bit more detail so you
    can try it out on your own and let us know
  • 44:10 - 44:15
    if it works.
    Herald: Cool. Thank you. So please, fellow
  • 44:15 - 44:20
    hackers, try it out at your system, at
    home. Now, our next question is related to
  • 44:20 - 44:26
    that. Is there a survey which hardware has
    the RAPL or similar weaknesses? Intel,
  • 44:26 - 44:33
    AMD, ARM even.
    Moritz: I don't know if anyone else wants
  • 44:33 - 44:39
    to answer that, I can also take the
    question. So the RAPL interface itself
  • 44:39 - 44:44
    comes from Intel, but a similar interface
    is also implemented for AMD, and they also
  • 44:44 - 44:50
    use basically the same name. They have
    a... For now, it's implemented in two ways
  • 44:50 - 44:54
    for the Linux kernel, also in the RAPL
    driver, but also in a separate called AMD
  • 44:54 - 45:00
    Energy Driver, which is included since a
    few months in the Linux kernel, in the
  • 45:00 - 45:05
    upstream Kernel. And for other vendors it
    works a bit differently. So some of them
  • 45:05 - 45:12
    just give you similar measurements, but
    not in a tightly related way to the RAPL
  • 45:12 - 45:16
    Interface with a measure over a period of
    time and give you the average.
  • 45:17 - 45:22
    Herald: OK, and..
    Michael: Maybe to add one point here: On
  • 45:22 - 45:27
    Intel, basically the high resolution
    sensors are included since the Skylake
  • 45:27 - 45:31
    micro architecture. So something around
    2015.
  • 45:33 - 45:40
    Herald: I see. We have another related
    question to AMD. So did AMD issue any
  • 45:40 - 45:45
    Microcode update for the secure encrypted
    virtual machines case apart from
  • 45:45 - 45:53
    restricting access to MSR?
    Moritz: Not as far as we know. But from
  • 45:53 - 45:58
    our knowledge to attack AMD CPU's, we need
    to wait for a new generation so that we
  • 45:58 - 46:03
    can do similar attacks from a similar
    threat model than we can do on an Intel.
  • 46:03 - 46:09
    Herald: Cool, thank you. So another I
    think this is also related to it, you
  • 46:09 - 46:14
    mentioned your Xen example where you
    attack through a hypervisor. Does it work
  • 46:14 - 46:18
    on other hypervisors like KVM or hyperV as
    well?
  • 46:18 - 46:24
    Moritz: So for KVM, I don't think so. For
    Windows I also don't know I don't think
  • 46:24 - 46:30
    they exposed those MSR directly to the
    virtual machines. So the issue is really
  • 46:30 - 46:34
    here that we can have access to those MSRs
    at the virtual machine where we should not
  • 46:34 - 46:41
    have access to.
    Herald: OK, we have another question from,
  • 46:41 - 46:47
    I think, the hardware section of our
    remote Congress. Someone wonders if the
  • 46:47 - 46:52
    same could be achieved with external power
    measurement.
  • 46:53 - 46:58
    Moritz: You mean if you could attach
    actually an oscilloscope or a different
  • 46:58 - 47:04
    probe to the CPU? Yes, you can do that.
    And it has already been demonstrated in
  • 47:04 - 47:07
    the past.
    Michael: But it turned out with external
  • 47:07 - 47:13
    tools, it takes even longer than with
    software. You have more issues finding the
  • 47:13 - 47:21
    right spot in measuring. And there is one
    paper, it took 14 days of collecting
  • 47:21 - 47:27
    traces which are harder to probe, which is
    much longer than in software. But it can
  • 47:27 - 47:31
    be done.
    Herald: And there's another follow up
  • 47:31 - 47:39
    question, how external is external? Where
    do you measure power consumptions of an
  • 47:39 - 47:47
    x86 server?
    Moritz: OK, you would need to get physical
  • 47:47 - 47:51
    access to the data center, I guess. And if
    this is in your threat model, you probably
  • 47:51 - 47:58
    have different things to worry about.
    Michael: Yeah, you still need to find the
  • 47:58 - 48:05
    right spot on your mainboard.
    Herald: OK, so are there, let's say
  • 48:05 - 48:09
    documentation's where to get that right
    spot.
  • 48:10 - 48:15
    Moritz: I think one can take a look at
    other research papers where they attached
  • 48:15 - 48:19
    a probe, I think there are experts out
    there, but I don't know.
  • 48:19 - 48:27
    Herald: OK, thank you. The next question,
    why is the power information exported in
  • 48:27 - 48:33
    such detail to the kernel or userspace
    software? Why isn't it only available to
  • 48:33 - 48:38
    the firmware or filtered to return an
    average, for example, one second power
  • 48:38 - 48:43
    trace?
    Moritz: Good question. We did not
  • 48:43 - 48:48
    implement that. I think the reason is...
    Andi?
  • 48:48 - 48:54
    Andreas: The once second power trace would
    make the attack only slower because you
  • 48:54 - 48:58
    can still do exactly what we did with
    single stepping here, because RAPL is
  • 48:58 - 49:04
    already very slow and we need a mechanism
    to replay instructions to get a good
  • 49:04 - 49:09
    reading of the energy consumption of the
    instructions. So if you only increase the
  • 49:09 - 49:14
    update rate there, the attacks would still
    be possible, but only take longer to
  • 49:14 - 49:23
    record the traces there. So you have to...
    Yeah. So you have to find a tradeoff
  • 49:23 - 49:28
    between your countermeasures there.
    Herald: Okay, so let's say with an
  • 49:28 - 49:33
    average, your resolution is lower, but
    still it just takes more time to record
  • 49:33 - 49:38
    it. And still it does work, right?
    Moritz: Yes. And the other thing is that
  • 49:38 - 49:43
    one needs to keep in mind those drivers
    are not written for security in mind, but
  • 49:43 - 49:49
    for performance so that this can be used
    by other tools that like give you the best
  • 49:49 - 49:55
    performance of your CPU. And in that case,
    it just has not been masked and you get
  • 49:55 - 49:59
    the value directly at the operating system
    sees.
  • 49:59 - 50:06
    Herald: Crazy. Our second to last
    question, how long is the update interval
  • 50:06 - 50:13
    for this measurement? I heard something
    about...
  • 50:13 - 50:17
    Andreas: For the fastest register we
    observed, it's like 10 microseconds, for
  • 50:17 - 50:21
    the slowest one... So there are different
    domains where you measure only parts of
  • 50:21 - 50:25
    the CPU and for the whole package, this
    includes all the cores and the memory
  • 50:25 - 50:30
    controller, it takes around one
    millisecond there. So this is already very
  • 50:30 - 50:35
    slow, if you compare it to the frequency
    where CPUs are currently running at.
  • 50:37 - 50:44
    Herald: Crazy. In this case, are there any
    other questions from the interwebs, from
  • 50:44 - 50:50
    Twitter, from our IRC channel? Because
    otherwise we would head over to more,
  • 50:50 - 50:56
    let's say, personal interview. Let's give
    them a try.
  • 51:08 - 51:10
    In this case, no more
  • 51:10 - 51:17
    questions, so in this. So, again, thank
    you. Moritz, Michael, Daniel and Andreas,
  • 51:17 - 51:27
    for these for this really interesting talk
    for this Q&A session, the Internet tells
  • 51:27 - 51:36
    me no questions. We head over to our
    personal interview. I asked you earlier
  • 51:36 - 51:44
    before our talk. So with all these, let's
    say, research things going on in the
  • 51:44 - 51:49
    Corona time. So what's your personal
    experience? What changed in your work life
  • 51:49 - 51:56
    balance in the last one year?
    Moritz: I think the biggest change is that
  • 51:56 - 52:02
    most of the coffee breaks you do alone
    instead of with the colleagues.
  • 52:04 - 52:09
    Herald: So how do you meet in your in
    your, let's say, lunch break? Do you have
  • 52:09 - 52:16
    as well a lunch break break out session in
    Jitsi? Yeah, we started with Jitsi, but
  • 52:16 - 52:20
    used different systems on the long way.
    And now it's like a fixed coffee meeting
  • 52:20 - 52:26
    at 2:00 p.m. every day and try to meet
    everyone or have individual meetings, of
  • 52:26 - 52:29
    course.
    Herald: And does this work? But so is
  • 52:29 - 52:35
    everyone on time. So sharp 12?
    Moritz: No, but I think no one really
  • 52:35 - 52:40
    cares.
    Herald: So it's just for socializing?
  • 52:40 - 52:47
    Moritz: Yes. But we also discuss work
    related issues also in separate meetings.
  • 52:47 - 52:55
    And yeah, I think time is different, but
    you get used to it. But let's hope it's
  • 52:55 - 53:02
    over soon.
    Herald: What about the others, Michael?
  • 53:02 - 53:09
    Michael: Yes, I'm in the same coffee
    breaks as Moritz. Sometimes every day,
  • 53:09 - 53:17
    depends on the workload, so I feel quite
    lucky that we can still work full time and
  • 53:17 - 53:22
    get our work done. And I don't have to
    fear that we lose our jobs in the in the
  • 53:22 - 53:31
    short term. So I think that takes a lot of
    pressure off. But, yeah, I mean, it's
  • 53:31 - 53:36
    different. I'm also missing the
    conferences, so I used to travel around a
  • 53:36 - 53:44
    lot before Corona times and this year is
    basically nothing. So you really miss the
  • 53:44 - 53:50
    social interactions and conferences,
    meeting other researchers, exchanging
  • 53:50 - 54:00
    ideas, having that online is different and
    just not the same, but still it works. So
  • 54:00 - 54:05
    I can still do a lot of research. The
    positive thing, you have less
  • 54:05 - 54:12
    interruptions than when you're in the
    office. So that's a positive thing. But
  • 54:12 - 54:17
    yeah, I also hope that it's over soon.
    Daniel: But then again, on the other side,
  • 54:17 - 54:22
    you have way more conference calls because
    instead of writing emails, people ask for
  • 54:22 - 54:27
    conference calls all the time.
    Michael: Yes, you are in meetings all the
  • 54:27 - 54:30
    time.
    Herald: Yeah, Daniel you mentioned earlier
  • 54:30 - 54:37
    you're, let's say, flightplan the last
    year. And as far as I understood it, you
  • 54:37 - 54:43
    like to be in personal contact with your
    colleagues, also from others or from
  • 54:43 - 54:49
    foreign countries. How does this work? So
    let's say topic exchange between different
  • 54:49 - 54:52
    organizations, between different
    countries?
  • 54:52 - 55:00
    Daniel: Yeah, it's more difficult. So in
    2018, I had these 54 talks outside of Graz
  • 55:00 - 55:12
    in 52 weeks and this year I had a single
    talk outside of, outside of Graz where I
  • 55:12 - 55:18
    was in person of course. Of course more
    Online. Um yeah. So it's, it's difficult
  • 55:18 - 55:24
    to engage with people from other places,
    but it works of course in teams that you,
  • 55:24 - 55:30
    that you already have established in the
    past, for instance. So you can continue in
  • 55:30 - 55:37
    teams that you've already built there. But
    also in some cases it works to start new
  • 55:37 - 55:41
    collaborations. But it's of course more
    difficult than if you can just meet people
  • 55:41 - 55:47
    in person like we did for this paper
    actually, David Osvald, one of the
  • 55:47 - 55:53
    coauthors, we met with him in person and
    talked with him about the paper in person.
  • 55:56 - 56:02
    Herald: Andreas, what's your, let's say,
    Corona year?
  • 56:02 - 56:07
    Andreas: Yeah, since I'm one of the
    persons who was interrupting Michael all
  • 56:07 - 56:14
    the time I am missing the office because
    it looks like the unscheduled flow,
  • 56:14 - 56:18
    because it's sitting in an office and
    suddenly you have like a question or idea,
  • 56:18 - 56:24
    you can not or you don't have to write it.
    You can just ask it on the fly. So I'm a
  • 56:24 - 56:29
    bit missing that side. On the other side,
    I gained a lot of time since I don't have
  • 56:29 - 56:37
    to travel to work there. And often I got a
    bit better in writing stuff I want to
  • 56:37 - 56:40
    know, asking questions more, much more
    faster, like losing the clover and that
  • 56:40 - 56:49
    stuff. And so I think it's both positive
    and negative. And I only joined since I
  • 56:49 - 56:56
    think August, when I finished my master's
    thesis and in the first half of the year,
  • 56:56 - 57:00
    I worked at a software company where the
    first lockdown was also handled very well.
  • 57:00 - 57:05
    So we had like a smooth transition. So I'm
    kind of used to home office, but I miss
  • 57:05 - 57:17
    interacting with people.
    Herald: I think that's the main thing 2020
  • 57:17 - 57:24
    brings us: more remote work. Which is
    basically a good thing to work more from
  • 57:24 - 57:32
    home, but we have some minutes left. And
    please excuse me myself. Did your mate
  • 57:32 - 57:41
    consumption increase or decrease?
    Moritz: I think it's hard to say for
  • 57:41 - 57:46
    coffee because I used to drink more coffee
    in the office than at home. Yeah, but but
  • 57:46 - 57:57
    now I see it when we go grocery shopping.
    laughs It's hard to say.
  • 57:57 - 58:02
    Michael: I think it decreased for me
    because now if I'm tired, I can simply
  • 58:02 - 58:11
    take a nap, thats easier.
    Herald: And just turn your instant
  • 58:11 - 58:16
    messaging off.
    Michael: Yeah.
  • 58:17 - 58:24
    Herald: So our time is over. Thank you
    again for the brilliant for the amazing
  • 58:24 - 58:32
    work, for these attack against CPU, for
    the great puns you brought, for the nice
  • 58:32 - 58:37
    interview and have a nice remote Congress
    3.
  • 58:37 - 58:51
    postrol music
  • 58:51 - 59:16
    Subtitles created by c3subtitles.de
    in the year 2021. Join, and help us!
Title:
#rC3 - Attacking CPUs with Power Side Channels from Software: Warum leaked hier Strom? (en)
Description:

more » « less
Video Language:
English
Duration:
59:17

English subtitles

Revisions