GithubHelp home page GithubHelp logo

connornelson / cartprograph Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 1007 KB

For interactively mapping out the state space of a program

CSS 1.59% HTML 4.20% JavaScript 43.88% Python 47.97% Dockerfile 1.51% C 0.86%

cartprograph's People

Contributors

adamdoupe avatar connornelson avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

checrs

cartprograph's Issues

Tracer Regex Race Condition

Tracer matched against:

b'26 bind(4,{sin_family=AF_INET,sin_port=htons(3004),sin_addr=inet_addr("0.0.0.0")'

This is incorrect.

One potential solution is enforcing that the number of ( is equal to the number of ), and the number of { is equal to the number of }. Strings could still mess this up.

Big Picture Thoughts

Overview

Currently there are 3 separate layers to Cartprograph:

  • qtrace
    This implements the core tracing logic. It includes a QEMU plugin to instrument blocks and syscalls with coverage instrumentation; and a python interface which collects this trace, and also interfaces with the QEMU gdb stub to interleave in a user-requested data trace. Ultimately, this tool produces a trace containing an ordered list of all basic blocks executed, syscalls executed, and any user-requested data (registers/memory values at some specific point in time).

  • cartprograph
    This is basically a server for managing qtrace traces. Clients connect and supply interactions which will be traced. These interactions can fork off of other partial interactions to form a tree of interactions.

  • angr management
    This is the primary supported client to cartprograph. Users can supply interactions via this client, and receive traces back, which can in turn guide analysis within the larger angr management ecosystem.

Problems

Data Traces

This concept of the data trace is new. Collecting syscall traces is no problem. Collecting complete basic block traces is pushing it, but seems to be tractable. Collecting a complete data trace seems entirely non-feasible.

For this reason, users can specify what data they want to collect. This is pretty straight forward to do programmatically within qtrace. The question is how we want to do this within angr management, and to what extent it should be "collaborative".

Handle Unhandled Syscall Blocks

If we aren't expecting a syscall to block, it will block forever and nothing will ever resolve itself.
This can be handled by giving syscalls a time limit between start and finish.

Collapse Equivalent Traces

When two traces are equivalent, it probably isn't worthwhile to have them both exist.

Additionally, this can get at the idea of what it means for two traces to be equivalent.

Refactor and define the cartprograph protocol

Currently:

  • socketio.connect
  • receive update events containing all prior events
  • receive update events as they occur
  • update event contains:
    • node
      • id
      • parent_id
      • interaction (syscalls/syscall args/syscall ret/io)
      • bb_trace
      • annotation
    • edge
      • start_node_id
      • end_node_id
      • interaction
      • bb_trace
      • annotation
  • send entire node with interaction filled in for input

New:

  • socketio.connect
  • receive update events containing all prior events
  • receive update events as they occur
  • update event contains:
    • src_node_id, dst_node_id
  • query server for more data
    • id:
      • node: <node_id>
      • edge: <src_id>-<dst_id>
    • /trace/basic_block/<id>
      • return list of basic blocks
    • /trace/syscall/<id>
      • return list of syscalls
        • syscall_nr
        • syscall_args
        • syscall_ret
          • None if blocked here
        • basic_block_index
    • /trace/interaction/<node_id>
      • return list of interactions
        • channel
        • direction
        • data
          • None if blocked here
        • basic_block_index
          • should be equal to some syscall's basic_block_index
  • push input
    • /input/<node_id>
      • data

Deprecate annotations for now (needs more thought on if/how this fits into cartprograph).

Unify IO Interaction Model

tracer.IOBlockingTracer implements logic for handling stdio.
IOBlockingArchrTracer adds logic for handling tcp.
Aside from handling the accept system call, the code for read/write to stdio/tcp is basically equivalent.

Code duplication makes me sad. Fix.

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.