boofuzz icon indicating copy to clipboard operation
boofuzz copied to clipboard

Fuzzing session prevents application from exiting with `exit()` or `sys.exit()`

Open 678098 opened this issue 3 years ago • 2 comments

Fuzzing main loop handles all exceptions, but for SystemExit exception (that is being generated when exit() or sys.exit() is called) it just doesn't stop. So it's impossible to exit fuzzing application from another thread with exit() or sys.exit().

Workaround: brutally exit with os._exit() (it just doesn't raise SystemExit exception).

678098 avatar Nov 19 '21 19:11 678098

Can you tell us where exactly the SystemExit exception is being caught? I tried a raise SystemExit in _main_fuzz_loop but that exited the program just fine. https://github.com/jtpereyda/boofuzz/blob/8384d46daef31622a4c51c96c970944fd3ce01c5/boofuzz/sessions.py#L1353

We catch Exception in some places, which I have to admit is not pretty, but doesn't catch BaseException which SystemExit or KeyboardInterrupt inherit from. I couldn't find any occurrences of base except: so SystemExit should work. https://docs.python.org/3/library/exceptions.html#Exception

SR4ven avatar Nov 23 '21 21:11 SR4ven

I will double check it soon

678098 avatar Sep 25 '23 11:09 678098