Skip to content

Commit

Permalink
ssh keyboard interactive auth check
Browse files Browse the repository at this point in the history
  • Loading branch information
praetorian-thendrickson committed Feb 1, 2023
1 parent 1b179b6 commit 80b2fd6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/plugins/services/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,16 @@ func (p *SSHPlugin) Run(conn net.Conn, timeout time.Duration, target plugins.Tar
conf := ssh.ClientConfig{}
conf.Auth = nil
conf.Auth = append(conf.Auth, ssh.Password("admin"))
conf.Auth = append(conf.Auth,
ssh.KeyboardInteractive(func(user, instruction string, questions []string, echos []bool) ([]string, error) {
answers := make([]string, len(questions))
for i := range answers {
answers[i] = "password"
}
return answers, nil
}),
)

conf.User = "admin"
conf.HostKeyCallback = ssh.InsecureIgnoreHostKey()
// use all the ciphers supported by the go crypto ssh library
Expand All @@ -254,7 +264,7 @@ func (p *SSHPlugin) Run(conn net.Conn, timeout time.Duration, target plugins.Tar

authClient, err := ssh.Dial("tcp", target.Address.String(), &conf)

passwordAuth = strings.Contains(err.Error(), "password")
passwordAuth = strings.Contains(err.Error(), "password") || strings.Contains(err.Error(), "keyboard-interactive")
if authClient != nil {
authClient.Close()
}
Expand Down

0 comments on commit 80b2fd6

Please sign in to comment.