Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage Evaluation #242

Closed
22 tasks done
maxammann opened this issue Apr 27, 2023 · 13 comments
Closed
22 tasks done

Coverage Evaluation #242

maxammann opened this issue Apr 27, 2023 · 13 comments

Comments

@maxammann
Copy link
Contributor

maxammann commented Apr 27, 2023

Targets:

  • OpenSSL 1.1.1 (one version e.g. f/k)
  • wolfSSL 5.3.0

Fuzzers/Testers:

Methodology:

Option A)

Issues:

  • ⚠️ In tlspuffin we use a custom setup of the server (certificate, options)

Option B)

  • Use Option A) for AFLNet, TLSAnvil
    • ...
  • Let the fuzzer run for 1h or 24h and collect corpus
  • Compile a libssl.a static library just like the coverage binary from Option A)
    • Do not use any fuzzing specific flags for this binary! No -fsanitze=coverage! Use -fprofile-arcs -ftest-coverage!
    • Requires a build of tlspuffin which is designed for coverage evaluation.
  • Use libssl.a in tlspuffin and execute the seed corpus

TODO

  • Adjust coverage filters for profuzzbench

  • Compile without optimizations

  • Verify and check ASAN usage (max 1 campaign in parallel with ASAN!) #244

  • Enable 1.2 and 1.3 (wolfssl: -v d -7 3)

  • profuzzbench

    • Create a coverage.csv from profuzzbench with OpenSSL
      • StateAFL
      • AFLNwe
      • AFLNet
    • Create a coverage.csv from profuzzbench with wolfSSL
      • StateAFL
      • AFLNwe
      • AFLNet
  • tlspuffin

    • Create a coverage.csv from tlspuffin with OpenSSL
    • Create a coverage.csv from tlspuffin with wolfSSL
  • TLSAnvil

    • Generate max. coverage from TLS-Anvil with OpenSSL
      Coverage with TLS-Anvil when testing an OpenSSL 1.1.1j server:

    • Generate max. coverage from TLS-Anvil with wolfSSL

  • Precompiled (Instead of precompiled I validated that the max. line count matches across all campaign evaluations)

    • Use precompiled OpenSSL with TLS-Anvil with OpenSSL
    • Use precompiled OpenSSL with profuzzbench
    • Use precompiled OpenSSL with TLS-Anvil with wolfSSL
    • Use precompiled wolfSSL with profuzzbench
    • Use precompiled OpenssL with tlspuffin
    • Use precompiled wolfSSL with tlspuffin
@maxammann
Copy link
Contributor Author

maxammann commented May 5, 2023

AFLnwe: -f .tmp-file to workaround short read race condition.

-> Does not work, fix is to just use a malloc buffer

race condition probably happend because openssl was exiting directly

@maxammann
Copy link
Contributor Author

maxammann commented May 8, 2023

Execution plan:

  • Task A: Profuzzbench fuzzers (aflnet, aflnwe, stateafl): 10 trials, 24h each
    • Fuzzes wolfSSL and OpenSSL TLS 1.3/1.2 servers
    • 10 (trials) * 2 (targets) * 3 (fuzzers) = 60 campaigns
    • -> Coverage plot
  • Task B: tlspuffin: 10 trials, 24h, each one core
    • Restrict to TLS 1.3/1.2 servers (only TLS 1.3/1.2 server seeds)
    • 10 (trials) * 2 (targets) = 20 campaigns
    • -> Coverage plot

  • Task C: tlspuffin 32 cores, 24h, 1 trial
    • (all seeds)
    • 1 (trials) * 2 (targets) = 2 campaigns
    • -> Single coverage number
  • Task D: TLS Anvil
    • Test first clients and then servers
    • 1 (trials) * 2 (targets) = 2 campaigns
    • -> Single coverage number

The final result of this evaluation will be:

  • a large coverage plot, which includes tlspuffin, StateAFL, AFLNet and AFLnwe
  • Single number coverage comparision between TLS Anvil and tlspuffin and something like tlspuffin reached 95% the coverage of TLS Anvil after x hours.

Rediscover vulns:

  • Task E: Profuzzbench fuzzers (aflnet, aflnwe, stateafl): 3 trials, 24h each
    • Fuzzes wolfSSL 1.3/1.2 servers
    • ASAN
    • 3 (trials) * 1 (targets) * 3 (fuzzers) = 3 campaigns
    • -> # of crashes

(optional)

  • Task A.1: Profuzzbench fuzzers (aflnet, aflnwe, stateafl): 10 trials, 24h each
    • Fuzzes OpenSSL TLS 1.2 server
    • With null cipther
    • 10 (trials) * 1 (targets) * 1(fuzzers) = 10 campaigns
    • -> coverage plot (+ # of crashes)

@maxammann
Copy link
Contributor Author

maxammann commented May 8, 2023

Pain points during evaluation

  • Getting StateAFL running (-K flag)
  • Getting AFLnwe runnign (-f flag)
  • tlspuffin uses Cargo for linking. This makes tlspuffin reproducible, but it is very hard to compare with others, because linking is done by rustc instead of having control
  • Environment differences: like clang/gcc versions, gcov versions, optimization levels, different compiler options chosen in build.rs/container/pesto.

@maxammann
Copy link
Contributor Author

@maxammann
Copy link
Contributor Author

Running s_server with --rand-state=0 does not work -> crash

@maxammann
Copy link
Contributor Author

GCC and Clang calculate coverage differently, some seeses case XYZ as a line, the other doesn't.

@maxammann
Copy link
Contributor Author

maxammann commented May 10, 2023

@maxammann
Copy link
Contributor Author

Renegotiatoin Info in 5.3.0 is incompatible with TLS-Anvil: tls-attacker/TLS-Attacker#152

@maxammann
Copy link
Contributor Author

maxammann commented May 11, 2023

Had to fight this one: profuzzbench/profuzzbench#6

@maxammann
Copy link
Contributor Author

Fixed coverage misses when generating it. flush on exit

@maxammann
Copy link
Contributor Author

read_from_terminal was the issue with aflnwe stuck coverage on OpenSSL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant