Code Monkey home page Code Monkey logo

tlspuffin's Issues

Implementation of a term algebra

A term looks like the following f(g(a, b,c)). There is a basic implementation which allows the following:

  • Evaluate it using concrete implementations
  • Make it possible to dynamically build terms during runtime.

Some possibilities for ways of doing this:

  • Use a message (enum) type from which the types can be derived
    • The defined operations take care of getting the correct type
  • Use higher level apis like KeyScheduleHandshake to implement operations: Needs exposure here https://github.com/ctz/rustls/blob/d03bf27e0b520fe73c901d0027bab12753a42bb6/rustls/src/lib.rs#L279
  • Automatically get all functions from rustls and make it possible to call them (through Map<str, fn>
    • Statically analyze rustls and get all possible ways of calling functions
    • -> This would eliminate the need to define all operations manually
    • Also very hard because attacker capabilities are not exposed easily. Some need context which can not easily be provided (deep static understanding is required)

Implement a trace which outputs and inputs terms

It must be possible to get data out of it. This will probably rusttls Messages.
It also must be possible to inject data. This could come from the attacker.

This task includes refactoring as we do not need the same kind of agents as in the current code.
We should also rename Send to Output and Expect to Input.

Setup LibAFL

LibAFL needs to be setup:

  • Allow the fuzzer to execute a trace
  • Serialize traces
  • Define a dummy mutator, which does nothing

Remove all uses of unwrap()

If the harness panics then the process is stopped. This is usually not a security vulnerability and shouldn't be counted as one by LibAFL.

Therefore we need to make sure that the Harness is not crashing. This can be done using Rust's Result.

Add a way to deconstruct messages

Right now we manually deconstruct each message in the old Expect steps. We need a procedure to deconstruct it.

Maybe use generators?

Control TLS Handshake Transcript

In TLS we keep a transcript hash of all actions. Maybe the attacker needs some kind of "memory" from which we can calculate a transcript hash.

See whether we can refactor VariableData

The VariableData and the data which flows into operations is basically the same. We could simply remove VariableData and replace it with any probably.

Another way would be to add a Enum VariableData. That would also remove the need of Box<> inside the dynamic function type, because the enum would be copyable/cloneable.

Add mutators for traces

This means we want to be able to add input and output steps, as well as mutate who receives which handle.

Discussion: Modle Variables as dyn Traid or Enum?

https://www.possiblerust.com/guide/enum-or-trait-object

Pro Trait:

  • Open Set
  • No code generation

Pro Enum:

  • Fast
  • Cloneable and no Heap required

The VariableData and the data which flows into operations is basically the same. We could simply remove VariableData and replace it with any probably.

Another way would be to add a Enum VariableData. That would also remove the need of Box<> inside the dynamic function type, because the enum would be copyable/cloneable.

Detect Deep Structure of Messages

When OpenSSl outputs a TLS message we can only see which fields are there. We are not able to see deeper and know which secrets have been used to compute the message. This would be needed to detect secrecy.

Here are some notes:

  • keyloging callback
  • -> follow flow into bitstrings

dynamic analysis ->

  • find constructors and desctructors in source code manually
  • When creating a tls message log which in formation was used in which order
    • e.g. session->session_id, ssl->server_random, hs->secret, derive_secret , hs->client_handshake_secret, hs->secret, derive_secret , hs->server_handshake_secret
  • Instrument these variables/functions which are traceable via XRay
  • Build terms out of these logs via heuristics.

https://llvm.org/docs/XRay.html#xray-runtime-library

https://github.com/llvm/llvm-project/tree/d480f968ad8b56d3ee4a6b6df5532d485b0ad01e/compiler-rt/lib/xray

Trace to trigger a Vulnerability

We want to test whether the attacker is able to detect simple implementation vulnerabilities in TLS 1.3.

There are two ways:

  • Choose a known volnerability of which we know that we can trigger it by modifing fields in a TLS message
  • Introduce a vulnerability which can be triggered by an attacker

We do not yet need a way of automatically detecting it. This is done e.g. in https://gitlab.inria.fr/mammann/tlspuffin/-/issues/15

Model attacker knowledge

The attacker needs to have knowledge available to be able to generate terms.

This could be as simple as a Vector of variables with a specific types and corresponding handles to VariableData.

Use only rustls Messages

Refactor such that we only deal with buffers of rustls messages. Right now we only want to send rustls messages. This means we do not need to store them as byte buffers.

This maybe simplifies code as the parsing of packages happens right at the interface between openssl and rust.

Give Fuzzing Runs a Score

Possible metrics:

  • Path Coverage
  • Node Coverage to some extend
  • Different Protocol Runs (probably similar to Path Coverage)
  • New Types of messages/alerts discovered?

Trigger CVE 2021-3449 in TLS 1.2

The function symbol op_attack_cve_2021_3449 already removes a specific extension. The renegotiation ClientHello must be constructed and signed/encrypted such that this works.

Use OpenSSL: 1.1.1j

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.