boofuzz
boofuzz copied to clipboard
Shlex doesn't play nice with Windows filepaths
https://github.com/jtpereyda/boofuzz/blob/7a977d7f45d41804a30a0be6cb76de60a5cf2595/boofuzz/utils/process_monitor_pedrpc_server.py#L26
When working with the procmon_options= {"start_commands" : ["C:\\Program Files\\program\\program.exe"]}
the shlex.split
referenced above will split like so:
>>> test = "C:\\Program Files\\program\\program.exe"
>>> import shlex
>>> shlex.split(test)
['c:Program', 'Filesprogramprogram.exe']
>>> shlex.split(test, posix=False)
['c:\\Program', 'Files\\program\\program.exe']
>>>
This results in the windows debugger thread throwing an OSError "The system cannot find the files specified....."
This could be fixed by changing https://github.com/jtpereyda/boofuzz/blob/7a977d7f45d41804a30a0be6cb76de60a5cf2595/boofuzz/utils/process_monitor_pedrpc_server.py#L25 to
if isinstance(command, basestring) and sys.platform != 'win32':
@KevinCooper It looks like the issue is the space in the filename, which can also happen on Linux systems.
If you're encountering this error in a script, the quick fix is to put your command into an array within an array.
This is due to some confusion in the way start commands are being handled. The set_start_commands
function expects a list of start commands. Each start command could itself be a string or a list. If a string, boofuzz assumes (this is where it's being too "clever" for its own good) that the command is a string representing commands and arguments. If a list, boofuzz assumes the first element in the list is the command and the rest are arguments.
We should probably drop this "clever" behavior and just require each command to be a list.