Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use execle instead of popen in tacas nss to avoid shell escape exploi…
…ts (#15284) Why I did it Tacacs nss library uses popen to execute useradd and usermod commands. Popen executes using a shell (/bin/sh) which is passed the command string with "-c". This means that if untrusted user input is supplied, unexpected shell escapes can occur. In this case the username supplied can be untrusted user input when logging in via ssh or other methods when tacacs is enabled. Debian has very little limitation on usernames and as such characters such as quotes, braces, $, >, | etc are all allowed. Since the nss library is run by root, any shell escape will be ran as root. In the current community version of tacacs nss library, the issue is mitigated by the fact that the useradd command is only ran if the user is found to exist on the tacacs server, so the bad username would have to already exists there which is unlikely. However, internally (at Dell) we had to modify this behavior to support other tacacs servers that do not allow authorization messages to verify user existence prior to a successful authentication. These servers include Cisco ISE and Aruba ClearPass. In order to support these tacacs+ servers, we have to create a temporary user immediately, which means this would be a much bigger issue. I also plan to supply the patch to support ISE and ClearPass and as such, I would suggest taking this patch to remediate this issue first. How I did it Replace call to popen with fork/execl of the useradd/usermod binary directly. How to verify it Install patched version of libnss-tacplus and verify that tacacs+ user login still works as expected.
- Loading branch information