syzkaller icon indicating copy to clipboard operation
syzkaller copied to clipboard

executor: Support configuring process name

Open mmiszczyk opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe. I'd like to fuzz drivers which only allow processes with a specified name to open their associated device files. Currently I can fuzz them by removing the check and rebuilding the kernel, but being able to set process name in config would be much more convenient than rebuilding the kernel.

Describe the solution you'd like Process name checks are done by calls to current->comm (see: https://github.com/OP-TEE/optee_linuxdriver/blob/master/core/tee_core.c#L169 for an open-source example of such code). Right now, current->comm will always be 'syz-executor'. Those checks can be trivially bypassed by changing executable name, and I'm pretty sure a more elegant option would be to run the syz-executor binary as it is but put the configured name in argv[0] (I am however not sure if it's doable in Go as my knowledge of Go is very limited; in C it's easy to do with execve: https://man7.org/linux/man-pages/man2/execve.2.html)

mmiszczyk avatar Jan 12 '23 12:01 mmiszczyk

Why would a kernel driver want to do this? This does not look like it's a serious security protection. Can this check be removed entirely? Or at least made configurable with cmdline option?

prctl(PR_SET_NAME) should change comm, this can be executed from executor itself.

dvyukov avatar Jan 12 '23 13:01 dvyukov

I agree that this is not a serious security protection and shouldn't be done. I didn't write the driver I'm fuzzing though (the one I've linked is just an example, the driver I'm fuzzing doesn't seem to be publicly available), so I'm just suggesting things that would make fuzzing easier.

mmiszczyk avatar Jan 12 '23 16:01 mmiszczyk