Skip to content

Implement Cross Language Attacks on Rust for Linux

Notifications You must be signed in to change notification settings

ntu-ssl/linux-cla

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

linux-cla

Implement Cross Language Attacks on Rust for Linux

Experiment Enviroment

Host Machine

  • OS: Ubuntu 20.04.6 LTS
  • Kernel Version: 5.15.0-88-generic
  • Arch: x86_64
  • QEMU Version: 7.0.0
  • LLVM Version: 16.0.0

Virtual Machine

Enviroment setup

cp .config ./linux
cd linux
make LLVM=1 -j4

Run VM

# may take some time in the first time
# need root permission
bash debootstrap.sh

The username and password should both be root

Attack POC

Base on Cross Language Attacks, there are several types of attack, e.g. Use after Free (UaF), Out-of-Bounds (OOB), and etc. The related POC in Rust for linux is under corresponding dir.

Threat Model

Generally, we consider a sinario that an attacker needs 3 pharse/step to manipulate a machine:

  1. Memory Corruption
  2. Inject Gadgets
  3. Control-Flow Hijack or Data-only Attack

Control-Flow Hijack aims to manipulate the execution flow of a program, one of the possible way is using ROP chain. Usually this kind of attack can be defended by ensuring CFI.

On the other hand, Data-only attack is to manipulate with data itself, For example, add a new malicious user/admin, therefore an attacker can use this new data to cachieve other vulnerbilities.

Each step missing may make the attacker harder to lauch an attack, or even impposible. Take memory safe language, e.g. Rust, as an example, such language is designed to prevent programs from memory vulanbility, so it is nearly impossible to achieve Memory Corruption step for attackers. (c) represent this situation. On the other hand, C is famous for its highly free properties, which leads to a lot of memory unsafe. In order to not being attack, we can use CFI in C program to avoid Control-Flow Hijack, this is stated in (b)

Everything seems well, however, it is more complicated in multi-language program. In such program, components written in different language would interact witt each other via Foreign Function Interface(FFI) or even other ways. This process is described in (d) as Language Transfer node. Therefore, if the attack flow follows from C to Rust, then the protection in different language is bypassed. To elaborated, we can construct and insert gadgets in C can corrupted the Rust memory, let Rust execute the gadget and get hijeck.

About

Implement Cross Language Attacks on Rust for Linux

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published