Eclipser icon indicating copy to clipboard operation
Eclipser copied to clipboard

Fork server died: Success

Open vanhauser-thc opened this issue 4 years ago • 12 comments

I run Eclipser in a docker container and running a target results in a crash of Eclipser:

# dotnet /Eclipser/build/Eclipser.dll -t 5 -s eclipser -o out -p fuzz-target --exectimeout 5000 --arg foo -v 2
[00:00:00:00] [*] Fuzz target : /targets/test/fuzz-target
Fork server died: Success

Unhandled Exception: System.Exception: Failed to initialize fork server for coverage tracer
   at Eclipser.Executor.initializeForkServer(FuzzOption opt) in /Eclipser/src/Core/Executor.fs:line 75
   at Eclipser.Executor.initialize(FuzzOption opt) in /Eclipser/src/Core/Executor.fs:line 92
   at Eclipser.Fuzz.main(String[] args) in /Eclipser/src/Fuzz/Fuzz.fs:line 137
Aborted (core dumped)

the target runs without problem when called native or when fuzzed via afl-fuzz -Q. what could the issue be?

vanhauser-thc avatar Jan 24 '21 11:01 vanhauser-thc

Thank you for reporting the issue. Could you upload the target binary you tested?

jchoi2022 avatar Jan 25 '21 01:01 jchoi2022

eclipser.zip

here you go!

vanhauser-thc avatar Jan 25 '21 08:01 vanhauser-thc

The current Dockerfile is based on Ubuntu 18.04, so glibc version mismatch makes fuzz-target to abort. I tried to directly execute the target program in our docker container, and encountered the following error.

test@7450e4731ddb:~/Eclipser$ dotnet build/Eclipser.dll -t 5 -o out -p fuzz-target --exectimeout 5000 --arg foo -v 2
[00:00:00:00] [*] Fuzz target : /home/test/Eclipser/fuzz-target
Fork server died: Success

Unhandled Exception: System.Exception: Failed to initialize fork server for coverage tracer
   at Eclipser.Executor.initializeForkServer(FuzzOption opt) in /home/test/Eclipser/src/Core/Executor.fs:line 75
   at Eclipser.Executor.initialize(FuzzOption opt) in /home/test/Eclipser/src/Core/Executor.fs:line 92
   at Eclipser.Fuzz.main(String[] args) in /home/test/Eclipser/src/Fuzz/Fuzz.fs:line 137

test@234c0ac61d54:~/Eclipser$ ./fuzz-target                                      
./fuzz-target: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by ./fuzz-target)
                                                                                 
test@234c0ac61d54:~/Eclipser$ ldd --version                                      
ldd (Ubuntu GLIBC 2.27-3ubuntu1.4) 2.27

When I tried Ubuntu 20.04 instead of 18.04 (for this you can simply fix the two lines from the above Dockerfile), the fork server error has disappeared.

Would you confirm whether this was the problem in your case, too?

jchoi2022 avatar Jan 27 '21 09:01 jchoi2022

To continue, in Ubuntu 20.04, I encounter different error as follow.

test@6e07cf102579:~/Eclipser$ dotnet build/Eclipser.dll -t 5 -o out -p fuzz-target --exectimeout 5000 --arg foo -v 2
[00:00:00:00] [*] Fuzz target : /home/test/Eclipser/fuzz-target
[00:00:00:00] [*] Total 1 initial seeds
[00:00:00:00] [*] Time limit : 5 sec
[00:00:00:00] [*] Start fuzzing
[00:00:00:00] Fuzzing with:  ...16bytes... (0) (Right)
[00:00:00:00] [Warning] Unexpected operand size
[00:00:00:00] [Warning] Coverage logging failed : []
[00:00:00:00] [Warning] Coverage logging failed : []
[00:00:00:00] [Warning] Coverage logging failed : []

I assume this is because the target program is multi-processed or multi-threaded. Could you provide more information about the target program, like its source code?

jchoi2022 avatar Jan 27 '21 09:01 jchoi2022

I will try to update the container to Ubuntu 20.04, thanks!

The source code is: https://gitlab.com/wg1/jpeg-xl, target is tools/djxl

vanhauser-thc avatar Jan 27 '21 11:01 vanhauser-thc

The current Dockerfile is based on Ubuntu 18.04, so glibc version mismatch makes fuzz-target to abort. I tried to directly execute the target program in our docker container, and encountered the following error.

can you supply that dockerfile? I tried to switch my Dockerfile to 20.04 and the correct microsoft deb, but the eclipser qemu compilation fails

vanhauser-thc avatar Jan 27 '21 12:01 vanhauser-thc

Oh, would you check if your Dockerfile trying to checkout 'v2.0' release of Eclipser?

Ubuntu 20.04 QEMU build issue was fixed in more recent commit, so you should use the latest commit in master branch. (Today I updated the Dockerfile to use master branch instead of v2.0 release).

jchoi2022 avatar Jan 27 '21 13:01 jchoi2022

Dockerfile in both master in dev are Using Ubuntu 18.04 - just checked again here on github :)

https://github.com/SoftSec-KAIST/Eclipser/blob/master/Dockerfile

https://github.com/SoftSec-KAIST/Eclipser/blob/dev/Dockerfile

vanhauser-thc avatar Jan 27 '21 14:01 vanhauser-thc

Sorry, it seems my words were confusing.

What I meant was to checkout master branch as in https://github.com/SoftSec-KAIST/Eclipser/blob/master/Dockerfile , and the version string ("18.04") must be replaced.

I fixed the two lines of that Dockerfile as follow, and it compiled without an error.

jschoi@ubuntu:~/Eclipser$ git diff Dockerfile
diff --git a/Dockerfile b/Dockerfile
index ba1d341..729b3fc 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,5 @@
 # For other Ubuntu versions, you should also fix the URL of .NET Core install
-FROM ubuntu:18.04
+FROM ubuntu:20.04
 
 WORKDIR /root/
 
@@ -18,7 +18,7 @@ RUN apt-get update && \
 RUN apt-get -yy build-dep qemu
 
 # Install .NET Core for Eclipser
-RUN wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
+RUN wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
     dpkg -i packages-microsoft-prod.deb && \
     apt-get update && apt-get -yy install dotnet-sdk-2.1 && \
     rm -f packages-microsoft-prod.deb

jchoi2022 avatar Jan 28 '21 06:01 jchoi2022

yes, works. I had inserted a bug in my dockerfile thats why it didnt worked.

any progress in the threading issue that kills eclipser? because it works fine with afl-fuzz -Q and symqemu.

vanhauser-thc avatar Jan 28 '21 09:01 vanhauser-thc

Unfortunately, I think it will take some time until I can fix this issue :(

Eclipser's instrumentation had to handle fork() syscalls in a different way from AFL-QEMU, and I suspect there are some bugs in this code. This may require some debugging and testing.

jchoi2022 avatar Feb 01 '21 11:02 jchoi2022

no hurry, just so that it is not forgotten :)

vanhauser-thc avatar Feb 01 '21 11:02 vanhauser-thc