This repository has been archived by the owner on Jul 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Sanitize user input when executing local commands #267
Labels
kind/epic
Large multi-story topic
lifecycle/rotten
Nobody worked on this for 12 months (final aging stage)
Comments
/assign |
Some comments on this in a related issue: https://github.com/gardener/gardenctl/pull/263/files#r473192089 |
/unassign unassign as:
|
/assign |
This was referenced Sep 15, 2020
/reopen is every occurence really fixed now? func ExecCmd(input []byte, cmd string, suppressedOutput bool, environment ...string) (err error) {
var command *exec.Cmd
parts := strings.Fields(cmd)
head := parts[0]
if len(parts) > 1 {
parts = parts[1:]
} else {
parts = nil
}
command = exec.Command(head, parts...)
... the |
This was referenced Sep 22, 2020
/epic Please do not close this ticket which as epic ticket tracking all the sub-tasks. |
gardener-robot
added
the
lifecycle/stale
Nobody worked on this for 6 months (will further age)
label
Nov 22, 2020
gardener-robot
added
lifecycle/rotten
Nobody worked on this for 12 months (final aging stage)
and removed
lifecycle/stale
Nobody worked on this for 6 months (will further age)
labels
Sep 22, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
kind/epic
Large multi-story topic
lifecycle/rotten
Nobody worked on this for 12 months (final aging stage)
User input should be sanitized before local command execution, otherwise there is a possibility for command injection.
E.g. see this code
https://github.com/gardener/gardenctl/blob/3ff05d6244a4cc19d618a55037dfd0ac1b9b31b8/pkg/cmd/ssh_alicloud.go#L202
a.MyPublicIP is determined by calling an external service
https://github.com/gardener/gardenctl/blob/3ff05d6244a4cc19d618a55037dfd0ac1b9b31b8/pkg/cmd/miscellaneous.go#L327-L331
If this service returns a command instead of an IP, I assume that this command would get executed as per code above.
There are a lot of other places where local commands are executed and most of them, if not all, do not sanitize the input.
And taking another look at the above example, why is the aliyun binary not called directly with the other parameters as arguments? https://github.com/gardener/gardenctl/blob/3ff05d6244a4cc19d618a55037dfd0ac1b9b31b8/pkg/cmd/ssh_alicloud.go#L202
See also #266 to further reduce the need to execute local commands and thereby reducing the attack vector.
The text was updated successfully, but these errors were encountered: