• Stars
    star
    169
  • Rank 224,453 (Top 5 %)
  • Language
    C
  • License
    GNU General Publi...
  • Created about 3 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

USENIX 2021 - Nyx: Greybox Hypervisor Fuzzing using Fast Snapshots and Affine Types

Nyx: Greybox Hypervisor Fuzzing using Fast Snapshots and Affine Types

Nyx is fast full-VM snapshot fuzzer for type-2 hypervisors. It's built upon kAFL, Redqueen and Hyper-Cube. The fuzzer is based on our paper (slides, recording):

@inproceedings {nyx,
author = {Sergej Schumilo and Cornelius Aschermann and Ali Abbasi and Simon W{\"o}r-ner and Thorsten Holz},
title = {Nyx: Greybox Hypervisor Fuzzing using Fast Snapshots and Affine Types},
booktitle = {30th {USENIX} Security Symposium ({USENIX} Security 21)},
year = {2021},
url = {https://www.usenix.org/conference/usenixsecurity21/presentation/schumilo},
}

Please note:

This release is based on our academic prototype implementation from early 2020 and it is quite outdated and has several known bugs, specific limitations and gets unstable in specific use cases (e.g. this version does not use the more stabile libxdc Intel-PT decoder).

If you are interested in using Nyx or one of Nyx's components for bug hunting or to build your project upon, we are recommending to use The public version of Nyx instead. It is a mainted, improved version of Nyx with all of its latest and greatest features. Other than that, we are not planning to maintain this prototype implementation anymore. So please do yourself a favor and use the real release of Nyx instead.

Setup:

Install dependencies:

The following commands will install all required dependencies (assuming an Ubuntu 20.04):

sudo apt-get install gcc-8 libisoburn1 libgcc-8-dev-i386-cross libx32gcc-8-dev-i386-cross build-essential curl qemu-utils python3-pip python-is-python3
pip install msgpack
sudo apt-get remove libcapstone3

# install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# install capstone-v4
git clone https://github.com/aquynh/capstone.git && \
cd capstone && \
git checkout v4 && \
make && \
sudo make install && \
cd -

# install all QEMU build dependencies (requires deb-src URIs in your /etc/apt/sources.list file)
sudo apt-get build-dep qemu

KVM-PT

One of Nyx's main components is KVM-PT. This standalone LKM is based on KVM (Kernel 4.20-rc4), but implements multiple features on top of KVM required to build a fast coverage-guided ring -1 fuzzer. KVM-PT provides an Intel-PT tracing module for vCPUs (instead of Intel-PT tracing per logical CPU), nested hypercalls (which are fully transparent to L1), an in-kernel dirty-memory tracker and many more other hacks.

  1. Install the following kernel and reboot your system. Ensure that you are using the right kernel by using uname:

    cd /tmp/ && \
    wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-headers-4.19.0-041900_4.19.0-041900.201810221809_all.deb && \
    wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-headers-4.19.0-041900-generic_4.19.0-041900.201810221809_amd64.deb && \
    wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-image-unsigned-4.19.0-041900-generic_4.19.0-041900.201810221809_amd64.deb && \
    wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v4.19/linux-modules-4.19.0-041900-generic_4.19.0-041900.201810221809_amd64.deb && \
    sudo dpkg -i *.deb && \
    sudo reboot
    
    
  2. After the system reboot verify that your system is using kernel 4.19 (by using uname -a). Otherwise, you can manually set kernel 4.19 in your grub configuration by adding the following line to /etc/default/grub and by generating a new GRUB config via update-grub:

GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 4.19.0-041900-generic"
  1. Execute load.sh in KVM-PT/ to compile and load KVM-PT.
  2. Check if the /dev/kvm-pt device node has been created.

QEMU-PT:

QEMU-PT is the user-space counterpart of KVM-PT. It is based on QEMU 4.2.50 and implements userspace handlers for hypercalls, fast snapshots and a custom Intel-PT decoder.

  1. Run sh compile_qemu_pt.h in QEMU-PT/ to build QEMU-PT. `

Build GRUB:

  1. Move to nyx_fuzzer/hypertrash_spec/build/hypertrash_os/grub/ and unpack grub.zip (unzip grub.zip). In case you want to compile GRUB by yourself instead of using our precompiled binaries, you can use install.sh to do so (gcc-6 is required).

Nyx-Fuzzer:

  1. Move to nyx_fuzzer/rust_fuzzer and run cargo build --release to build the fuzzer.

Getting Started:

bhyve (AHCI) Fuzzing:

  1. Move to the Targets/bhyve/VM folder.
  2. Execute prepare.sh. This script will download an ISO image of FreeBSD 11-3, prepare a virtual disk and spawn a QEMU instance. Connect via VNC (localhost:5900) and install FreeBSD. Install the following packages: base-dbg, kernel-dbg, ib32, ports. Create the follwing users: root / password: root, user / password: userand add user to wheelgroup.
  3. Once the OS installation has finished, reboot the VM and execute copy_files.shon the host (in another shell). Connect via SSH (localhost:2222) and run install.sh as root. Once the script has finished and the OS has shutdown, you can terminate QEMU via CTRL+c.
  4. Run create_pre_snapshot.sh and connect via VNC. Login as rootand run /home/user/loader. QEMU will create a pre-snapshot image and terminate.
  5. Create a config file by executing cp Targets/bhyve/config_template.ron Targets/bhyve/config.ron and adjust all paths in Targets/bhyve/config.ron (use absolute paths).
  6. Run make_sharedir.sh in nyx_fuzzer/hypertrash_spec/.
  7. Move to nyx-fuzzer/rust_fuzzer and execute cargo run --release -- -c ../../Targets/bhyve/config.ron to start the fuzzer.
  8. Use the following command to show all findings: cat /tmp/workdir_bhyve/corpus/crash/*.log | sort | uniq -c

qemu (legacy XHCI) Fuzzing:

  1. Move to the Targets/qemu/VM folder.
  2. Execute prepare.sh. This script will download an ISO image of Ubuntu 18-04 LTS, prepare a virtual disk and spawn a QEMU instance. Connect via VNC (localhost:5900) and install Ubuntu. Create the following users: user: user / password: userand add install openssh-server.
  3. Once the OS installation has finished, reboot the VM and execute copy_install_files.shon the host (in another shell). Connect via SSH (localhost:2223) and run ./install.sh as root. Once the install script is done and the OS has shutdown, you can terminate QEMU via CTRL+c.
  4. Run create_pre_snapshot.sh and connect via VNC. Login as rootand run /home/user/loader. QEMU will create a pre-snapshot image and exit.
  5. Create a config file by executing cp Targets/qemu/config_template.ron Targets/qemu/config.ron and adjust all paths in Targets/qemu/config.ron (use absolute paths).
  6. Run make_sharedir.sh in nyx_fuzzer/hypertrash_spec/.
  7. Move to Targets/qemu/agent and run build_sharedir.sh.
  8. Move to nyx-fuzzer/rust_fuzzer and execute cargo run --release -- -c ../../Targets/qemu/config.ron to start the fuzzer.
  9. Use the following command to show all findings: cat /tmp/workdir_qemu/corpus/crash/*.log | sort | uniq -c

License

Nyx is provided under GPLv2 license.

Free Software Hell Yeah!

Proudly provided by:

More Repositories

1

DroneSecurity

DroneSecurity (NDSS 2023)
Python
945
star
2

kAFL

Code for the USENIX 2017 paper: kAFL: Hardware-Assisted Feedback Fuzzing for OS Kernels
Python
550
star
3

redqueen

Python
339
star
4

OMEN

OMEN: Ordered Markov ENumerator - Password Guesser
C
313
star
5

Microcode

Microcode Updates for the USENIX 2017 paper: Reverse Engineering x86 Processor Microcode
Python
297
star
6

syntia

Program synthesis based deobfuscation framework for the USENIX 2017 paper "Syntia: Synthesizing the Semantics of Obfuscated Code"
Python
296
star
7

mobile_sentinel

Python
187
star
8

nyx-net

Python
176
star
9

ijon

C
164
star
10

GANDCTAnalysis

Code for the ICML 2020 paper: Leveraging Frequency Analysis for Deep Fake Image Recognition.
Python
161
star
11

nautilus

a grammar based feedback fuzzer
Rust
158
star
12

aurora

Usenix Security 2021 - AURORA: Statistical Crash Analysis for Automated Root Cause Explanation
Rust
146
star
13

grimoire

Python
125
star
14

loki

Hardening code obfuscation against automated attacks
Python
125
star
15

Password-Guessing-Framework

A Framework for Comparing Password Guessing Strategies
Python
120
star
16

Marx

Uncovering Class Hierarchies in C++ Programs
C++
114
star
17

antifuzz

AntiFuzz: Impeding Fuzzing Audits of Binary Executables
C
101
star
18

EthBMC

The code repository for the 2020 Usenix Security paper "EthBMC: A Bounded Model Checker for Smart Contracts"
Rust
91
star
19

WaveFake

Python
71
star
20

SiemensS7-Bootloader

Client utility for Siemens S7 bootloader special access feature
Python
55
star
21

NEMO

Modeling Password Guessability Using Markov Models
Python
54
star
22

gadget_synthesis

Esorics 2021 - Towards Automating Code-Reuse Attacks Using Synthesized Gadget Chains
Python
54
star
23

EvilCoder

Code for the paper EvilCoder: Automated Bug Insertion at ACSAC 2016
Java
42
star
24

JIT-Picker

Swift
34
star
25

cupid

Cupid: Automatic Fuzzer Selection for Collaborative Fuzzing
C
29
star
26

Probfuscator

An Obfuscation Approach using Probabilistic Control Flows
C#
28
star
27

Hypercube

NDSS 2020 - HYPER-CUBE: High-Dimensional Hypervisor Fuzzing
C
24
star
28

ijon-data

14
star
29

PrimGen

ACSAC 2018 paper: Towards Automated Generation of Exploitation Primitives for Web Browsers
HTML
13
star
30

adversarial-papers

TeX
12
star
31

DroneSecurity-Fuzzer

DroneSecurity Fuzzer (NDSS 2023)
11
star
32

dompteur

C++
10
star
33

we-value-your-privacy

Results and data from the paper "We Value Your Privacy ... Now Take Some Cookies: Measuring the GDPR’s Impact on Web Privacy"
9
star
34

VPS

VTable Pointer Separation
C++
7
star
35

APC

Android (Unlock) Pattern Classifier
Kotlin
6
star
36

WindowsVTV

MinGW for 32bit with Vtable pointer verification (VTV)
C++
6
star
37

nyx-net-profuzzbench

Shell
6
star
38

PriDi

Python
5
star
39

xTag-mtalloc

C
5
star
40

SUCI-artifacts

some PCAPs and logs
5
star
41

ASSS

Application-Specific Software Stacks
4
star
42

xTag

4
star
43

MiddleboxProtocolStudy

Auxiliary material for NDSS'20 paper: On Using Application-Layer Middlebox Protocols for Peeking Behind NAT Gateways
Python
4
star
44

Password-Strength-Meter-Accuracy

Measuring the Accuracy of Password Strength Meters
Python
3
star
45

uninformed-consent

Repo for material related to the CCS 2019 paper, "(Un)informed Consent: Studying GDPR Consent Notices in the Field"
3
star
46

be-the-phisher

Code related to the study presented in "Be the Phisher - Understanding Users’ Perception of Malicious Domains" @ AsiaCCS 2020
Jupyter Notebook
2
star
47

symtegrity

Code for the DIMVA 2018 paper "On the Weaknesses of Function Table Randomization"
2
star
48

MastersOfTime

2
star
49

libXSGS

Implementation of Delerablée and Pointcheval's eXtremely Short Group Signatures (XSGS)
Shell
2
star
50

xTag-llvm

C++
1
star
51

MachineCodeTimings

JavaScript
1
star
52

tropyhunter

TODO
Python
1
star
53

GDPR-fines

Supplemental Material for the PETS 2022 Paper "Investigating GDPR Fines in the Light of Data Flows"
Jupyter Notebook
1
star
54

GeneratedMediaSurvey

Jupyter Notebook
1
star