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

Possible OS command injection in code #442

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/src/api/libv2/api_hypervisors.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ def update_fingerprint(self, hostname, port):

try:
print("ssh-keygen", "-R", "[" + hostname + "]:" + str(port), "-f", path)
# Possible OS Command injection
check_output(
("ssh-keygen", "-R", "[" + hostname + "]:" + str(port), "-f", path),
text=True,
Expand All @@ -303,6 +304,7 @@ def update_fingerprint(self, hostname, port):
log.error("Could not remove ssh key for [" + hostname + "]" + str(port))
return False
try:
# Possible OS Command injection
check_output(
(
"ssh-keygen",
Expand All @@ -318,6 +320,7 @@ def update_fingerprint(self, hostname, port):
return False

try:
# Possible OS Command injection
new_fingerprint = check_output(
("ssh-keyscan", "-p", port, "-t", "rsa", "-T", "3", hostname), text=True
).strip()
Expand Down