Code Monkey home page Code Monkey logo

pastis's Introduction

The PASTIS project is a fuzzing framework aiming at combining various software testing techniques within the same workflow to perform collaborative fuzzing also called ensemble fuzzing. At the moment it supports the following fuzzing engines:

  • Honggfuzz (greybox fuzzer)
  • AFL++ (greybox fuzzer)
  • TritonDSE (whitebox fuzzer)

[Documentation]


Overview

Note The video highlight the use-case driven by SAST alerts. However, the main use-case the standard fuzzing for coverage or bug research.


Quick start

Installation

The PASTIS framework can be installed with:

pip install pastis-framework

The pip package will install all dependencies and the tritondse engine.

AFL++

To install AFL++ please refer to the official documentation.

Honggfuzz (>= v2.6)

To install Honggfuzz please refer to the official documentation.

Usage

The main component is the broker that will serve the appropriate configurations to fuzzing engines and that will aggregate results. An example is the following:

tar xvf doc/figs/fsm-demo.tar.gz && cd fsm-demo
make
pastis-broker -b bin -s initial -w output

It will run the broker using binaries in the bin directory. Initial corpus is initial and the whole output workspace will be save in output. By default it will listen on the local interface on port 5555.

Then fuzzing engines can be launched to start testing the software.

pastis-aflpp online

Or:

pastis-tritondse online

Full documentation is available: here

Adding a Fuzzer

Integrating a fuzzer requires writing a Python driver using the libpastis library installed by the package. It requires implementing some callbacks to receive the initial configuration and also to receive inputs from the broker. Conversely the API enables sending newly generated inputs to the broker.

The process is further detailed in the documentation.

Note We warmly welcome any Pull Request to add the support for a new fuzzing engine.


Docker

You can also run PASTIS using Docker:

# Pull from GitHub's registry.
docker pull ghcr.io/quarkslab/pastis:latest

# Or build the image.
docker build -t pastis .

# And run a container.
docker run -v <HOST-WORKSPACE>:/workspace --cap-add=SYS_PTRACE --user $(id -u $USER):$(id -g $USER) -it ghcr.io/quarkslab/pastis # or pastis if you buily the image locally.

To open another terminal to an already running container:

docker exec -it $(docker ps | grep 'pastis' | awk '{print $1}') /bin/bash

The PASTIS Docker image has already installed all the needed dependencies such as AFL++ and Honggfuzz.


Papers and conferences

  • PASTIS: A Collaborative Approach to Combine Heterogeneous Software Testing Techniques Venue: SBFT 2023, Melbourne, Australia ๐ŸŽฅ slides Authors: Robin David, Richard Abou Chaaya, Christian Heitman

  • Symbolic Execution the Swiss-Knife of the Reverse Engineer Toolbox Venue: KLEE Workshop, 2022 ๐Ÿ“š ๐ŸŽฅ Authors: Robin David, Richard Abou Chaaya, Christian Heitman

  • From source code to crash test-case through software testing automation Venue: European Cyber Week, C&ESAR Workshop, 2021 paper slides Authors: Robin David, Jonathan Salwan, Justin Bourroux

Cite PASTIS

@inproceedings{david2023pastis,
  title={PASTIS: A Collaborative Approach to Combine Heterogeneous Software Testing Techniques},
  author={David, Robin and Abou Chaaya, Richard and Heitman, Christian},
  booktitle={2023 IEEE/ACM International Workshop on Search-Based and Fuzz Testing (SBFT)},
  pages={17--24},
  year={2023},
  organization={IEEE}
}

Contributors

PASTIS is powered by Quarkslab and initially financed by DGA-MI.

All contributions

pastis's People

Contributors

cnheitman avatar jonathansalwan avatar robindavid avatar sambacha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pastis's Issues

lief enums seem to be incorrectly capitalised

pastis/libpastis/package.py

Lines 266 to 267 in 917e076

mapping = {lief.ELF.ARCH.x86_64: Arch.X86_64,
lief.ELF.ARCH.i386: Arch.X86,

I don't think I'm holding this wrong; this causes the following error in a local fuzzbench run:

[fuzz] Running command: pastis-benchmark run -b /out/targets -w /out/corpus -s /out/seeds -m FULL -i ARGV -p 5551 --triton --hfuzz --hfuzz-threads 1 --aflpp --skip-cpufreq
Traceback (most recent call last):
  File "/usr/local/bin/pastis-benchmark", line 393, in <module>
    cli()
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/bin/pastis-benchmark", line 176, in run
    broker = PastisBroker(workspace,
  File "/usr/local/lib/python3.10/site-packages/pastisbroker/broker.py", line 88, in __init__
    self._find_binaries(binaries_dir)
  File "/usr/local/lib/python3.10/site-packages/pastisbroker/broker.py", line 710, in _find_binaries
    pkg = BinaryPackage.auto_directory(file)  # try creating a package
  File "/usr/local/lib/python3.10/site-packages/libpastis/package.py", line 219, in auto_directory
    p = BinaryPackage.auto(bin_f)
  File "/usr/local/lib/python3.10/site-packages/libpastis/package.py", line 172, in auto
    data = BinaryPackage._read_binary_infos(bin_f)
  File "/usr/local/lib/python3.10/site-packages/libpastis/package.py", line 266, in _read_binary_infos
    mapping = {lief.ELF.ARCH.x86_64: Arch.X86_64,
AttributeError: type object 'ARCH' has no attribute 'x86_64'. Did you mean: 'X86_64'?
Return code: 1

Does this enum usage need to be updated?

tritondse for fuzzing

The pastis setup is pretty complex.
I am looking for an easy symbolic/concolic solution that could be integrated into afl++, and maybe tritondse could be it.
could you give me some pointers what would be needed to get tritondse running on a target with some input?
That way I would easier understand how to form a custom mutator around it.
that would be great!

[CLI-0-HF] [ERROR] Cannot start target, HFQBDIPRELAOD not found

My log is

2023-07-02 12:47:11 [ BROKER ] [INFO] new binary detected [LINUX, X86_64]: bin/fsm.tt
2023-07-02 12:47:11 [ BROKER ] [INFO] new binary detected [LINUX, X86_64]: bin/fsm.hf
2023-07-02 12:47:11 [ BROKER ] [INFO] new binary detected [LINUX, X86_64]: bin/fsm.afl
2023-07-02 12:47:11 [ BROKER ] [INFO] Add seed initial.seed in pool
2023-07-02 12:47:11 [ BROKER ] [INFO] start broking
2023-07-02 12:47:11 [ BROKER ] [INFO] [CLI-0-N/A] [HELLO] Name:niko2023 Arch:X86_64 engines:['HONGGFUZZ'] (cpu:12, mem:16678973440)
2023-07-02 12:47:11 [ BROKER ] [INFO] send start client 0: fsm.afl [HONGGFUZZ, AUTO, BINARY_ONLY, PERSISTENT]
2023-07-02 12:47:11 [CLI-0-HF] [ERROR] Cannot start target, HFQBDIPRELAOD not found

$ pastis-honggfuzz online
2023-07-02 12:47:02 INFO Starting fuzzer...
2023-07-02 12:47:11 INFO [START] bin:fsm.afl engine:HONGGFUZZ exmode:PERSISTENT fuzzmode:BINARY_ONLY seedloc:STDIN chk:CHECK_ALL
2023-07-02 12:47:11 INFO Start process
2023-07-02 12:47:11 ERROR target in BINARY_ONLY but can't find HFQBDI_LIB_PATH
2023-07-02 12:47:11 INFO [SEED] received  d8e8fca2dc0f896fd7cb4cb0031ba249 (INPUT)

The reason is honggfuzz wants fsm.hf, but the broker sends fsm.afl. So, how does the broker choose the target file to send?

tritondse - coverage not found- causing triton to never find other seeds

I'm building your demo file code using:
clang -Wall -g demo.c -o demo.ttt

I'm running the broker with: pastis-broker -b bin -s initial -w output
and than I run tritondse using: pastis-triton online

and I getting warning that coverage wasn't found:
image

from looking on source code the coverage should be on /mnt/ramdisk or /tmp/triton_{}.trace but it's not on either of them....
This causing triton to never find other seeds

image
image

running the demo with statically compiled code

I compiled your demo statically:
clang -static -Wall -g demo.c -o ./bin/demo.ttt

and when I trying to run it using pastis and trintondse, I get:

  1. I get exception, that my platform doesn't exist:
    image

I fixed it by adding it on tritondse/loaders/cle_loader.py :
image
and this really solved it

  1. but it still didn't worked since it doesn't get the coverage:
    image

when I tried to run the command by hand:
with statically compiled code, it never print "Runs....." :
image

without statically compiled code, it prints "Runs.....":
image

from some unknown reason this script didn't arrive vm.run(start, stop) in the qdbi_trace.py

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.