thank you for the introduction good
afternoon thank you for coming to my
session my name is Wei Wu I'm from
Institute of information engineer
Chinese Academy of Sciences this is the
joint work with the Penn State
University OS Colonels are reading
low-level language like C and C++ large
program retaining low-level language I
inevitably to have bugs such as Obi
access you will have data risk and even
type of confusion vulnerabilities
thousands of kernel bugs I reported last
year and some of the bugs are very
dangerous because they are exploitable
protect OS kernels we have a lot of
mitigations mitigation makes the
exploitation harder actually Expo bility
for each pack is a predicate about
whether and how easily it could be
exploited under the constraints of a set
of exploit mitigations to get a good
proof of the expo bility we need to give
concrete kernel exploit to generate the
concrete at kernel export we have
automatic export generation systems the
workflow behind AG system usually
consists of two steps in the first step
the identified for primitive X for
primitive is a machine State which
somehow empowers an attacker to craft
the export the second step of Ag system
is to evaluate whether this exploit
primitive could really be used to
generate the concrete export depending
on the type of available X word print
primitive we choose different exported
techniques to finish the export control
flow hijacking is one of the most
popular export primitive many Oxbow
techniques have been developed for post
to control flow hijacking to craft the
control flow hijacking ax voice before
triggering the vulnerability the first
step is adjusting the system course and
the parameters and the map in a POC
to adjust the memory layout and battery
or invulnerability could gather control
flow hijacking primitive after the last
tab is executing as protection payload
we have full payload
Sushil called a retirement hit the
programming that many research works
tackling these challenges
the question is despite a long list of
existing tools it is really easy to be
able to execute arbitrary Rock pedal in
Linux kernel with a control flow
hijacking primitive to answer the
question let's take a closer look into a
key step during the expectation among
hand at the side of the control flow
hijacking at the showing in kernel state
as the program counter is on our control
the stack pointer is not on the other
hand to use return rented programming to
execute except expectation payload we
have to construct a new kernel state s
prime the new in the new chrono state
state not only the program counter but
also the stack pointer is controllable
so we can execute Rob payload to for
example escalating the privilege to root
fixing the memory corruption safely
returning to user space and launching a
root shell
the remaining problem is how to
construct the transition from state
asset to state s prime the transition at
the first glance seems quite
straightforward to experienced hackers
but sometimes we have trouble in this in
the step in ask next few slides I will
explain the challenges for the Rob
bootstrapping task the first challenges
exploited primitive mitigations a buggy
in kernel may lead to crafted code
pointers and dead pointers hijacking
corrupted code pointer to execute user
space share code is blocked by
SME hijacking kernel sensitive dead
pointer to user space is blocked by SM
maybe the return to dia attack hijacks a
corrupted code pointer to execute your
code in feed map however this XY
technique is blocked by marking memory
pages in his map as now executable to
overcome as a media as well
maybe another export technique tries to
modify the control registers therefore
but they were in out two bits in this
register an attacker could attend of
post protections however such attempt to
over rather control registers could be
easily detected by by the virtualization
based hypervisor
the attempt to over rather control a
disturbed could we will trigger a VM
exit signal and the hybrid I could
handle the situation recently some mad
hackers also come up with new expedition
cuts for example the kernel function
call use a motor here per could
facilitate exploitation by invoking a
user root process by executing arbitrary
binaries however it is also eliminated
by a kernel patch which only allows the
execution of whitelist the binary the
second challenge is how to handle your
Sunita explore primitive as we mentioned
before a common Expo technique is to
appear with the kernel stack to either
space with gadget as a showing the
figures of the gaseous exchange reacts
with ESP and a return but unfortunately
it is blocked bias and maybe because a
new stack is in user space alternatively
one may think of finance data pivoting
gadgets inside kernel space such as the
exchange idea with a SP and a return so
we compute stack pointer to a fixed tag
in kernel space however in practice such
gadgets sometimes does not exist another
limitation is lack of control of general
registers for example using copy from
user to copy Rob change to current
kernel stack frame but it is still
challenged because the lack of control
registers copy from user requires
controlling story parameters but usually
we only control one of them the last
challenge is export
exploit pass pitfall to understand the
challenge let's look into another common
practice in exploitive element the expo
technique
triggers a vulnerability for multiple
times and I at each time the axial part
of the pillow such practice under the
context of some vulnerabilities
could dramatically decrease the success
ratio of an exploit this is because
memory corruption could happen
simultaneously with a control flow
hijacking primitive and the kernel to
dereference an invalid address during
the process to return into user space
and the trigger the invulnerability
again to tackle these challenges and
ideal solutions to circumvent this
exploit the past pitfall to do that we
could adopt a single-shot exploitation
which is similar to the so called magic
gadget in users base exploitation as he
is shown in the figure the single shot
of exploitation redirects the control
flow to smash the kernel stack and
execute arbitrary Rob Chan without
stretching a control flow hijacking
primitive twice and the details of
potential exploit past pitfall having
these challenges in mind let's look into
how Kepler achieved a one-shot
exploitation our first introduced
one-shot exploitation at high level of
data let's look into the details of its
basic building blocks to understand the
design of Kepler let's first go over
that this design of the single shot
exploitation at high level starting from
the initial control flow hijae
confirmative the first step is to direct
a control flow to execute a function
called blooming gadget to increase the
control of general registers the second
step is to direct the control flow to
the breeding gadget
breeding gadget banks to control flow
rejection primitive the first one is
used to leak stagger canary so the
combination of auxiliary gadget and his
closure gadget and the second one is
used to construct a stack overflow
against the current kernel stack frame
with a visual Rob payload as well as the
stack economy we just leaked finally we
could reach a virtual Rob payload
execution we choose Rob because it's
true and complete in the necks of
useless I will describe these building
blocks in detail
the core building blocks of Kepler is a
stack smashing gadget stack smashing
gadgets are you location size of func
function copy from user copy from user
is a data channel between users based on
the kernel the destination of copy from
user is usually a local variable on
kernel stack this is great for
exploitation because we can you reduce
the coincides our coffee phone user to
set the register at the height accounts
kernel stack frame without knowing its
precise address as shown in the right
hand side code the destination buffer is
a local variable another interesting
code style is saving invocation of a
copy from user to make kernel code more
robust the return value of copy from
user is checked if an error occurs
during the new location of a user the
function will return immediately and a
start executing our Rob payload to force
function copy from user to return a
nonzero value we could construct a page
paid for during a copy process the plan
sounds good but a kernel panic because
the kernel is protected by stare economy
and another problem is we do not control
the source address and the size of the
copy as first to take care of the stare
canary cover uses another family of
gadgets called active disclosure gadgets
similar to the previously mentioned the
stack smashing gadget the ability to
leak canary is empowered by the kernel
function capital user the function copy
to user also takes three arguments
negating destination source and length
of the data to copy find kernel to use
our space as showing the curved listing
if the kernel function copy to user
returns and down zero value the caller
function gets time of the day will
returns an error immediately and by
redirecting the kind of load to before
the call incisal copy to user we can set
the source buffer to kernel stack and
foster conservative execution to take
shorter return pass by constructing a
paid fault
however the problem here is the color of
a copy to user is also protected by a
stack cannery to pass this dagger
currently successfully and returned we
needed the aquaszero function gadget the
basic idea of auxiliary gadget is
straightforward kernel performs can we
check in function epilogue it it just
wants the legal canary before the return
address so it could just give it one to
make it happy to do that we first direct
the execution to the oxalate auxiliary
function gadget which creates a fixed
stack frame and stores a stack canary
before I return address we make sure the
stack frame is of the same size of the
caller function of copy to user there is
an internal call Khazaria function the
target of endeavor the call is
controllable we read agree with
redirected control flow to canary
disclosure gadget when the canary
disclosure gadget fails to copy the last
part and it returns is where finds it
were finds it were a final canary
stalled by all the wreckage and all
functions in the same kernel should
share the same stack kernel kernel has
no reason to reject our turn at the
mention before to invoked function
gadgets like a copy file and copy to
user we need to control more registers
so the last we use blooming gadget the
code of Linux kernel sometimes is
similar to object-oriented programming
the serf object is usually passed as the
first parameter and it is the reference
for target and parameters of an integral
code as shown in the code listing the
function accepts pointer to the VMA
object vma's dereference the multiple
times to fall together target and the
parameters of an indirect call giving
the VMA points to a controllable region
we can get a better state through the
gadget in the new state we are good to
use function gadget because we control
three registers parameters in order to
combine the operations of disclosing
their canary and the smashing stack into
a single shot we needed the assistance
of bridging gadgets breeding gadget a
kernel functions containing multiple
controllable in the articles breeding
gases burns to opportunity to hijack a
control flow we can combine the
operations of canary liquor and the
stack overflow into a single shot for
example function
reg cosmic dirty is a bridging gadget
which performs two in our call if we
left the map points to the fist map
region under our control we can use the
in diverter call look to execute
auxiliary and the disclosure gadget
ridiculous that canary and use a second
interval call unlock code to execute the
text merging gadget the implementation
Kepler contains two modules the first
module is a stated analysis module we
collect the candidate graduate through
static analysis plaguing belong at a pro
in the second module we convert the
export chain identification at the
research problem over the candidate
gadgets the search tree contains five
steps corresponding to the previous cust
building blocks we also employ multiple
workers to explore the search space
concurrently the gadget teaching engine
is built our anger to prune the search
space will perform constraints
satisfiability check at multiple key
locations we mitigate state explosion by
setting stretch hold of the maximal step
in each stage and the maximum time of
entering a dupe to evaluate the capture
we collected 16 CVS and Sri city of
challenges about Linux kernel this
vulnerability are known to be
control-flow ejectable including OB
excess use a free double free indoor
flow and I initialized the use the table
shows weather Kevlar and the uses in
tools could generate expose for our own
ability
Kepler generate exploited for 17 out of
19 bucks and it out firmly existing
export hardening tools because Kepler
has a capability of bypassing widely
deployed kernel mitigations and to not
rely on stack a pivoting gadget or
triggering a bug for multiple times
Kepler could also find many different
expeditions from the right hand side
figure we can find a number of different
candidate gadgets for each vulnerability
the time to find the first exploitation
channel as well as the time to finish
the search the total number of
identified X what Chinese also listed
Kepler could find the first X / Chan in
50 more o'clock minutes and the in total
tens of thousands of exploit chance
the exposed change generated is a hard
to defeat because this function cages
used by Kepler could not be easily
removed from the kernel in summary we
propose the single-shot x protection
technique it is an effective and a
generic kernel exportation technique we
implemented Kepler to facilitate
identification of single-shot
exploitation and we open-source the tool
to prevent control-flow hijacking
attacks see if I could solutions with
low overhead should be considered and
widely deployed for a major release of
Linux kernels thank you for attention
and I'm ready for questions
all right well one of those
questionnaires come on up
I'm interested to know a little bit
about the robustness of the kind of
susceptibility to like the single shot
right so what happens if you did like
something like fine-grained
randomization at a function granularity
would that be problematic or if there is
a randomization like okay yeah we needed
the cooperation of an info Dieker
vulnerability so that we can dig the
address of the gadget that we need to
use the index rotation for fine so more
fine-grain the randomization I didn't
see implementation for Linux kernel so I
cannot draw and in conclusion okay but
something that did fine grained we
randomized ation would probably be a
little bit challenging yeah
randomization okay it's beautiful very
challenging we can't hear you so thanks
sorry hi my name is David from UC Irvine
a great talk which versions of Linux did
you look at me which kernel versions did
you look at the latest version of the
kernel yeah it's the 4.15 yeah at the
time of the writing of the paper it is
the most recent UNIX kernel version did
you look at any other words or only then
after the after the projector I also use
it easier to generate exploit for
vulnerability in kernel 4.20 it also
works in for 4.20 and for more recent of
a version I have not have not tested yet
okay cool thank you thank you
go ahead yeah hi I'm Anne ill from IBM
Research Zurich I had a question on your
slide 19 I think just two slides before
you have these numbers for the first
chain time no the one before that so I
can see for some of them there's a lot
of repetitions of say 17 minutes is it
because it finds the same exploit chain
because the initial conditions are the
same or asking about the time rod the
total number of X were generated no the
first chain the first chain minute I
just noticed this so I was just
wondering if you if you tend to find the
same exploit change because of the same
initial conditions that you have as
you're basically as your restriction for
your for finding your exploit change so
how generic are the exploit change that
you find is the overall question yeah
yeah as we can see from the figures the
number of Canada catches the foil for
each vulnerability is different this
this is this is because the context of
each paddock is different you asked a
very good question about the reusability
of the generate a expose explore the
trap but I have not to statistic about
about the data you want so okay sorry
all right once again let's think our
speaker
[Applause]