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

Created basics of AFL-SWAM interface #7

Closed
wants to merge 63 commits into from

Conversation

olapiv
Copy link
Collaborator

@olapiv olapiv commented Jun 18, 2020

See fuzzer/README.md for details

fuzzer/README.md Outdated
Therefore, instead of using the C++-compiler provided by AFLplusplus (afl-clang-fast++), we use the "standard" g++ compiler and instead mimic the instrumentation behaviour in the interface.

AFL communicates with the target binary with a shared memory by default. Since Scala does not seem suitable for such low-level operations, we have instead created a low-level wrapper for SWAM, interface.cpp. Whilst the code coverage plugin for SWAM writes it's results to a fixed file, our interface wrapper reads from this file and then feeds the content into the shared memory used by AFL.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! Could you add a little more of context? How does this work as a general picture? Maybe a summary about kelinci. WHat about this URL https://lcamtuf.blogspot.com/2014/10/fuzzing-binaries-without-execve.html in the C code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added another commit, which actually makes it work in the way I had in mind. The interface is now however feeding dummy coverage data to AFL. As a next step I will try to integrate this with SWAM and then try to feed the code coverage from Tarek's work into AFL.

If those steps are validated, I will start being more concise in the README. Hope that's ok!

olapiv added 28 commits June 18, 2020 20:11
…Function & executeFunction. Created first basic Server file.
…xed anymore; Fixed measure time; Parsing received socket message to byte array.
@olapiv
Copy link
Collaborator Author

olapiv commented Jul 14, 2020

Hey @Jacarte, the program seems to work overall now. There are still some irregularities concerning the Socket connection, which I can look into. But I've updated the README and you should be able to run it quite easily on your machine. I can merge this to master on my repo and forward this to the others via email if you want to!

Copy link

@satabin satabin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice at a first sight. Just left a few comments for when it will go to upstream.


// TODO: Read port from env-variable SWAM_SOCKET_PORT
object Server {
val maxQueue = 50000
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really interesting. Just a thing: I'd like to keep Swam pure and functional. Can you try to implement the server using fs2-io? See https://fs2.io/io.html

If you are not used to this kind of programming I can do it for you, but I'd really love to have this before merging upstream.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I get that. I'll have a go at it..!

cli/src/swam/cli/Server.scala Outdated Show resolved Hide resolved
cli/src/swam/cli/Main.scala Outdated Show resolved Hide resolved
cli/src/swam/cli/Main.scala Outdated Show resolved Hide resolved
@@ -0,0 +1,22 @@
FROM aflplusplus/aflplusplus
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is docker really required to make coverage work?

Copy link
Collaborator Author

@olapiv olapiv Jul 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not meant to be required for coverage to work.

I think it's useful to have for fuzzing though, given the nature of fuzzing:

  1. I'd prefer to have the fuzzer somehow containerized, given that I am testing all of this on my local machine and the AFLplusplus docs state "you shouldn't be fuzzing on systems where the prospect of data loss is not an acceptable risk". It might not make a difference though, I'm not sure.

  2. Since fuzzing is meant to be run for a longer period of time "in production", i.e. probably on a server, I don't want to spend time on portability issues, especially since I am not developing on Linux.

As stated in the README files however, I've at least written a run_test.sh script to test the SWAM server without Docker.

And lastly, the entire docker-compose configuration is set up to work very easily, which I think it currently does. It will work without Docker though, if you install AFLplusplus manually and source the .env file first.

Nonetheless, you may want to check whether you're fine with the Dockerfile I put into the root of this repository.

@olapiv olapiv closed this Jul 29, 2020
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

Successfully merging this pull request may close these issues.

4 participants