researchers find an unfixable bug in EVERY ARM cpu
Summary
TLDRThis video delves into a fascinating CPU vulnerability that exploits speculative execution and memory tagging in ARM architecture. The attack, reminiscent of Spectre and Meltdown, leverages cache invalidation to bypass security measures, allowing information leakage. The presenter, Ed, breaks down complex concepts like memory corruption, buffer overflows, and memory tagging, explaining how researchers have identified a method to leak memory tags within the V8 JavaScript engine sandbox, highlighting the intricacies of this advanced exploit.
Takeaways
- 💡 Computers can 'see' the future to some extent through speculative execution, which is a method used to predict and preload memory addresses to avoid cache misses.
- 🔍 The video discusses a memory corruption vulnerability that exploits CPU's speculative execution to bypass ARM's security architecture.
- 👤 The presenter, Ed, introduces the topic with a focus on cybersecurity and software security, encouraging viewers to subscribe for more content.
- 📚 The script mentions 'Smashing the Stack', a foundational paper on buffer overflows that have been a major source of hacks since the 1990s.
- 🛡️ ARM's chip architecture has implemented features like memory tagging in ARMv8 and ARMv9 to enhance security against memory corruption vulnerabilities.
- 🔑 Memory tagging involves adding a specific number or tag to a pointer, which the CPU checks to ensure it matches metadata on each load and store operation.
- 🔄 The script explains how pointers work, including their role in virtual memory and how they are used to translate virtual memory addresses to physical memory addresses.
- 🚫 Memory tagging is designed to prevent attacks like use-after-free by recoloring freed memory addresses with different tags, causing exceptions if incorrectly accessed.
- 🕵️♂️ The researchers discovered a method to leak memory tags through speculative execution, which can undermine the security provided by memory tagging.
- 💻 The attack, named 'MTE Leak', operates within the V8 sandbox, which is used for running JavaScript, and the researchers found multiple 'TIC tag gadgets' that can be exploited.
- 🌐 The video concludes by emphasizing the complexity and significance of the paper, urging viewers to read the original research for a deeper understanding.
Q & A
What is the main topic of the video?
-The main topic of the video is the discussion of a memory corruption vulnerability that allows bypassing a major feature of the ARM computer instruction set, which is related to memory tagging and speculative execution.
What are the two infamous bugs mentioned in the video that broke the internet around 2016-2017?
-The two infamous bugs mentioned are Spectre and Meltdown, which are related to CPU vulnerabilities.
What is the purpose of memory tagging in ARM architecture?
-Memory tagging in ARM architecture is a security feature that adds a specific number or tag to a pointer to prevent memory corruption attacks. If the tag is altered, the CPU will crash at runtime.
How does a buffer overflow work in the context of memory corruption?
-A buffer overflow occurs when data is written past the boundaries of a buffer, potentially overwriting adjacent memory locations such as the return pointer, which can allow an attacker to take control of the program flow.
What is a pointer in computer architecture?
-A pointer in computer architecture is a variable that stores the memory address of another value or object. It is used as an index into tables, which is part of the virtual memory system.
What is speculative execution and why is it used?
-Speculative execution is a technique where the CPU predicts the path a program will take and preloads memory addresses into the cache to avoid cache misses and speed up execution.
How does the attack described in the video exploit speculative execution?
-The attack exploits speculative execution by creating a guess pointer and a test pointer with the same memory tag. It then uses the speculative execution to check if the guessed tag is correct by timing whether the test pointer has been cached.
What is a cache invalidation side channel?
-A cache invalidation side channel is a method used by attackers to leak information about the CPU's cache state, which can be used to infer the execution flow or data values.
What is a 'TIC tag gadget' mentioned in the video?
-A 'TIC tag gadget' is a snippet of code that can be used to leak memory tags by exploiting speculative execution and cache invalidation side channels.
How did the researchers find TIC tag gadgets in the V8 VM?
-The researchers identified TIC tag gadgets in the V8 VM by looking for code snippets that perform speculative execution and cache checks, which can be used to leak ARM V8 tags.
What is the significance of the attack being able to bypass hardware memory protection?
-The significance is that it demonstrates a sophisticated method of exploiting CPU vulnerabilities, even within hardware-enforced security measures like ARM's memory tagging, to potentially execute memory corruption attacks.
Outlines
💡 CPU Speculative Execution and Memory Corruption Vulnerability
This paragraph introduces the concept of how CPUs can 'see' the future through speculative execution, which is a method that allows the CPU to predict and preload memory addresses to improve performance. However, this feature has been exploited to bypass security features in ARM's instruction set architecture. The video discusses a memory corruption vulnerability that leverages this speculative execution to undermine ARM's security architecture, similar to the Spectre and Meltdown vulnerabilities that emerged around 2016-2017. The video aims to explain the technical aspects of this attack for viewers with varying levels of experience in cybersecurity and computer architecture.
🔒 Memory Tagging and Its Role in Security
The second paragraph delves into the specifics of memory tagging, a security feature introduced by ARM in its ARMv8 and RV9 specifications. Memory tagging involves appending a unique tag to a pointer, which the CPU checks during load and store operations to ensure data integrity. The paragraph explains how this feature is designed to prevent buffer overflows and use-after-free vulnerabilities, which have been common attack vectors in software security. It also discusses the concept of virtual memory and how pointers work, including how ARM uses reserved bits in pointers for memory protection features like memory tagging and pointer authentication codes. The paragraph concludes with a mention of the video's sponsor, LLL Academy, which offers courses in assembly and C programming.
Mindmap
Keywords
💡CPU
💡Memory Corruption
💡ARM
💡Memory Tagging
💡Buffer Overflow
💡Virtual Memory
💡Speculative Execution
💡Cache Invalidation
💡Use After Free
💡V8 Sandbox
💡Pointer Authentication Code
Highlights
CPUs use speculative execution to improve performance by predicting future paths and preloading memory addresses.
Speculative execution vulnerabilities can lead to memory corruption and bypass security features, as seen in Spectre and Meltdown.
The attack discussed exploits cache invalidation as a side channel to leak CPU information.
Memory corruption vulnerabilities, like buffer overflows, allow hackers to control return addresses and execute malicious code.
ARM has added memory tagging in ARMv8 and ARMv9 to enhance security by checking pointers and metadata tags on each load and store.
Memory tagging involves adding a specific tag to a pointer, and if this tag is changed, the CPU crashes at runtime.
Speculative execution can bypass memory tagging protections by predicting future code paths and preloading memory.
Attackers can use speculative execution to leak memory tags by timing cache fills and guessing correct tags.
The TIC-TAG attack uses speculative execution to break ARM's memory tagging security.
The attack can be performed inside the V8 JavaScript sandbox, making it highly versatile and dangerous.
The researchers found multiple TIC-TAG leak gadgets in the V8 VM that can be exploited.
TIC-TAG gadgets involve address control, speculative branching, and cache fill checks to leak memory tags.
Pointer authentication codes (PACs) in ARM cryptographically sign pointers to prevent tampering.
Memory tagging also protects against use-after-free attacks by recoloring memory tags upon deallocation.
Speculative execution attacks can invalidate hardware memory protections, demonstrating a critical security flaw.
Transcripts
can computers see the future yes sort of
in this video we're talking about how
the way that CPUs look into the future
actually presented a memory corruption
vulnerability that allows people to
bypass a major feature of the arm
computer instruction set this attack is
one of those crazy ones and I want to
talk about this one so badly because any
attack that uses a cash invalidation as
a side channel to leak information about
the CPU is already cool enough think
about Spectre and meltdown right those
bugs that broke the internet around 2016
2017 time period but on top of it being
a bug in a cash invalidation it is also
speculative execution and Via this
attack they're able to break one of the
major pieces of arms security
architecture now if you're new here hi
my name is Ed this is Ol learning a
channel where I make videos about cyber
security software security and all kinds
of other cool stuff so if you like that
or just want to hang out hit that sub
button I really appreciate it also yes I
got a haircut it's uh it's a little long
little something weird going on here
okay I do want to give my hats off to
the researchers here all the people are
named here in white please go take some
time after this video go read their
paper 18 pages of computer architecture
goodness binary exploitation goodness in
this video I want to make this paper a
little more digestible for people who
may not have as much experience with how
CPU memory Works how binary exploitation
works and all that kind of stuff so what
is memory tagging what are buffer
overflows what what is all the stuff
about well to understand how this attack
works we have to start at the basics
hackers like to exploit these sing
called memory corruption vulnerabilities
the basic one that everyone knows about
is a buffer overflow right this paper
here by alf1 called smashing the stack
from front and profit which is a paper
within Frack the hacker E from a million
years ago uh talks about basically hey
if we are able to right past the bounds
of a buffer in C we can use that to take
control of The Code by changing the
return pointer this guy lf1 enumerates
that if we are able to control the
return address of a program by setting
this value to a hacker controlled value
we can put code in that location and run
malicious code this has been the basis
of the majority of the hacks that have
happened over 70% of them since the
1990s and this is the thing that
companies are trying to prevent by
either secure code or secure
architecture now arm the chip
architecture designer that licenses out
the arm spec has added several features
in armv8 and rv9 one of them being this
idea of memory tagging so memory tagging
is theide aide of just like it sounds
putting a tag or a specific number at
the end of a pointer by putting that
number there you effectively make a a
special number that if it gets changed
the CPU will crash at runtime the CPU
checks that the pointer and the metadata
tags on each load and store match now
you're probably wondering wait aren't
pointers memory addresses like how are
they able to just put a random value in
a pointer well pointers actually aren't
all that magic they actually have a
specific function that they do when you
look at a 64-bit pointer for example
there are a few things that are
happening on the inside of this pointer
but basically almost the entire pointer
is a series of indexes into tables this
index into table system is known what is
called virtual memory that allows a
program to think that it has access to
all the memory on the CPU by translating
these virtual memory addresses to a
physical memory address via page tables
we're able to give a program the
illusion that it has access to the
entire memory map meanwhile it doesn't
actually it's a specific memory address
that get gets mapped into a pointer now
the entire pointer isn't actually used
there are certain bits that are reserved
for special purposes or that don't
actually do anything in the pointer and
so arm has taken advantage of these
leftover bits and use them to do
specific memory protection elements one
of them being memory tagging another
example is the pointer authentication
code where effectively the CPU will sign
the pointer cryptographically and if you
overflow it you invalidated the
signature and therefore the pointer is
invalid also real quick this video is
sponsored by none other than me if you
want to learn to code in assembly or C
or learn to do Network code in C please
go check out my website L level Academy
the courses are on sale right now for
the summer go check it out if you want
to learn to code in the C language you
can get a free preview with the arrays
lesson here if you want to go learn to
code in assembly you can get a free
lesson with the load operations lesson
right here please go check him out I
honestly believe that if you want to be
a better programmer you got to learn the
fundamentals where do you learn the
fundamentals C and assembly on low-level
Academy back to the video memory tagging
stuff memory tagging an arm also
prevents against certain attacks like
use after freeze this place where you
have data in a heap location for example
you free it but accidentally access it
later the way it works is actually
pretty cool and this graphic here does a
really good job of explaining it so we
have this character pointer here that
gets allocated 16 bytes when we allocate
it with 16 bytes using an mte compliant
allocator like the one on Android for
example we have we can call this a
particular color right now the memory is
blue now what happens is we either can
overflow this data or we can delete it
we can free it and when we do that we
recolor the data to a different color so
this memory address now has a different
tag if we were to in the future use the
old pointer the use after free but it
still has that original tag the blue
color this will throw a CPU exception
now the important part here is if the
hacker is a able to reveal the tag and
put the tag back in place this defeats
the entire security of the system the
idea is that the memory tag which is 16
bits it hides in the first 16 bits of
the pointer itself if we are able to
leak that tag then this entire system
falls apart now this is where the TIC
tag paper gets really really interesting
now what they do is they use this thing
called speculative execution now we all
want our computers to run as fast as
possible Right ideally our computers
would run our programs it would load and
store all of our memory and it would
never take what is called a cash Miss
where effectively when it looks up a
memory address if the memory isn't there
in cash it has to go out to random
access memory and load that into cash
now that is very expensive it causes the
program to slow down so there has been
this push to do this thing called
speculative execution where your CPU
will actually run the instructions that
are ahead of the current program counter
it will go into the future and predict
what path you're going to go down and
try to preload that memory address to
put it into cash so that when you
actually get there you don't miss the
cash now like I said in the beginning of
the video there have been a variety of
memory corruption attacks or leaks uh
that have come out of speculative
execution and spoiler alert this is how
the mte leak works now I'm going to zoom
in here to their graphic I want to
highlight this because this is really
really interesting so the way that it
works is they create a guess pointer and
a test pointer that both both live
within the same 16b block so that they
have the same memory tag now they create
an area of speculative execution that
will go out and try to dreference the
guest pointer and dreference the test
pointer now notice they don't actually
ever go and run this code all they do is
they put it into the code in a way that
it could conditionally execute but the
problem here is that if the tag
mismatches right the whole point of
memory tagging is that if the tag Mis
matches it crashes a CPU if it
mismatches in a speculative case if it
mismatches in the future it will not
crash the CPU and even so if it
mismatches it won't cash it won't go
into Cash the test pointer will not be
uh cash filled and therefore the guess
is wrong what they're able to do they're
able to time did we already cash fill
this test pointer and use that to figure
out if the tag that they guessed was
correct so what they do is they iterate
is tag one correct is tag two correct
and they keep checking over and over
again until their access to test pointer
is now filled in cash therefore they're
able to leak the tag of the target
address and use that for a future memory
corruption attack like when I read this
paper not only are they doing cash side
Channel leaking they are doing it in
speculative execution to bypass a
hardware memory protection dude it is
just one of the craziest bugs and make
it even more crazy what they figured out
how to do is they're able to do this
attack inside of the V8 sandbox so what
the the entire structure here is they
create these things called tic tag
gadgets now this this graphic that I
just showed you is called a tic tag
Gadget template so basically if you can
find a piece of code that does this sort
of thing where you have address you want
to leak address you control speculative
branch and then you can check at the end
of it you've created what is called a a
gadget template so if you can look for
Snippets of code that are like this you
can find ways to leak the mte and other
code and these researchers actually
found a bunch of tic tag leak Gadgets in
the V8 VM which as I've said in previous
videos is the VM that they use to run
the JavaScript sandbox right and they're
they're showing you here in this paper
and again I'm not going to PR like I
know how all this works it's very very
complicated uh that they found tic tag
V2 gadgets that can work inside the V8
sandbox to leak arm V8 tags so like I I
just cannot emphasize how crazy this
paper is I I really please go go go show
them some love go go read it I hope it
made this more accessible to you guys um
and if you like this video do me a favor
hit like hit subscribe then go check out
this other this video that you will also
like as well
Ver Más Videos Relacionados
L-5.1: Memory Management and Degree of Multiprogramming | Operating System
L-1.4:Types of Buses (Address, Data and Control) in Computer Organization and Architecture
Registers & Special Purpose Registers in Assembly Language Urdu/Hindi | Lecture # 2 | very Important
How JavaScript Code is executed? ❤️& Call Stack | Namaste JavaScript Ep. 2
05. Berpikir Komputasional - Model Komputer Von Neumann - Informatika Kelas X
But, what is Virtual Memory?
5.0 / 5 (0 votes)