Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

execute command with sudo has a potential password exposure #350

Closed
rcaldwel opened this issue Jun 23, 2020 · 2 comments
Closed

execute command with sudo has a potential password exposure #350

rcaldwel opened this issue Jun 23, 2020 · 2 comments

Comments

@rcaldwel
Copy link

Hi. Somewhat new to the tool but I have found that running remote commands with sudo can expose the users sudo password due to the way it's running it with a one liner. Is there something I'm missing? Here is the snip

self._shell.exec_command('echo %s | sudo --stdin --prompt "" %s' % (sudo_password, command))

Anyone with root on that box can see the users password while it's running with a ps command. Also if commands are logged as I have to deal with they will log the sudo command

Thanks for your insight and awesome tool.

@cristii006
Copy link
Contributor

Hi @rcaldwel,

Firstly thanks for your kind words. Regarding the problem you described can you provide the usage of ps command so that I can obtain the users password as I was able only to obtain the command itself and not the password. Also logging a command is something that the users decide to do or not by taking multiple things into account, one of them is that passwords can also be logged so not much that can be done here.

Best regards,
Cristi

@mihaiparvu
Copy link
Contributor

Reproduced the problem, but still trying to figure it out how to make it more secure. If anyone has some ideas feel free to share them.

I wouldn't consider this as a critical priority though, as most of the users probably use SSHLibrary in isolated environments (with test users) created specifically for automated testing.

I will leave this ticket open, because is a valid concern and will think further on a solution.

@mihaiparvu mihaiparvu mentioned this issue Nov 5, 2021
@mihaiparvu mihaiparvu added this to the SSHLibrary 3.8.0 milestone Nov 5, 2021
@mihaiparvu mihaiparvu added rc 1 and removed help wanted Extra help appreciated labels Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants