Hi I saw your post on /r/linux and took a look at the code. I've noticed a number of glaring security issues:
- Raw user input is
strcat()'d and run with system(). This is a command injection vulnerability. Since the binary is setuid root, this means that anybody on the system can escalate privileges by entering an argument like '; bash.
- There is no bounds checking when modifying the
cmd buffer. You could overflow this with a sufficiently long argument list and get the ability to arbitrarily write to the stack.
I would highly suggest removing the setuid requirement and instead require users to run the program with sudo or another proven system authentication manager. There is a large burden placed on setuid applications on UNIX systems because a single bug could mean the entire system's security model is compromised.
Hi I saw your post on /r/linux and took a look at the code. I've noticed a number of glaring security issues:
strcat()'d and run withsystem(). This is a command injection vulnerability. Since the binary is setuid root, this means that anybody on the system can escalate privileges by entering an argument like'; bash.cmdbuffer. You could overflow this with a sufficiently long argument list and get the ability to arbitrarily write to the stack.I would highly suggest removing the setuid requirement and instead require users to run the program with
sudoor another proven system authentication manager. There is a large burden placed on setuid applications on UNIX systems because a single bug could mean the entire system's security model is compromised.