Skip to content

Commit 566c3d8

Browse files
authored
Merge pull request #202 from vulncheck-oss/new-exploit-types
Updates to C2 Handling New Exploit Types
2 parents b26ced4 + bd3fc01 commit 566c3d8

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

cli/commandline.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,14 @@ func dbFlags(conf *config.Config) {
411411

412412
// handle generic sounding c2 flags.
413413
func c2Flags(c2Selection *string, conf *config.Config) {
414+
415+
flag.BoolVar(&conf.ThirdPartyC2Server, "o", false, "Indicates if the reverse shell should be caught by an outside program (nc, openssl)")
416+
417+
if len(conf.SupportedC2) == 0 {
418+
// the implementing exploit doesn't support any c2, just exit
419+
return
420+
}
421+
414422
c2Default, _ := c2.ImplToString(conf.SupportedC2[0])
415423
c2Available := "The C2 server implementation to use. Supported: "
416424
for _, value := range conf.SupportedC2 {
@@ -437,15 +445,13 @@ func c2Flags(c2Selection *string, conf *config.Config) {
437445
} else {
438446
flag.IntVar(&conf.C2Timeout, "t", 30, "The number of seconds to listen for reverse shells.")
439447
}
440-
441-
flag.BoolVar(&conf.ThirdPartyC2Server, "o", false, "Indicates if the reverse shell should be caught by an outside program (nc, openssl)")
442448
}
443449

444450
// loop through the c2 the exploit supports and find the one the user actually selected.
445451
func validateC2Selection(c2Selection string, conf *config.Config) bool {
446452
c2Selected, ok := c2.StringToImpl(c2Selection)
447453
if !ok {
448-
output.PrintFrameworkError("Provided an invalid c2 implementation")
454+
output.PrintFrameworkError("The user provided an invalid c2 implementation")
449455

450456
return false
451457
}
@@ -679,7 +685,9 @@ func FormatFileCmdLineParse(conf *config.Config) bool {
679685

680686
return false
681687
}
682-
if !validateC2Selection(c2Selection, conf) {
688+
689+
// must be validate (to set default for payload gen) and then check third party c2
690+
if validateC2Selection(c2Selection, conf) && !conf.ThirdPartyC2Server {
683691
return false
684692
}
685693
if !conf.ThirdPartyC2Server && (conf.Lport == 0 || len(conf.Lhost) == 0) {
@@ -715,7 +723,8 @@ func LocalCmdLineParse(conf *config.Config) bool {
715723
}
716724
flag.Parse()
717725

718-
if !validateC2Selection(c2Selection, conf) {
726+
// must be validate (to set default for payload gen) and then check third party c2
727+
if validateC2Selection(c2Selection, conf) && !conf.ThirdPartyC2Server {
719728
return false
720729
}
721730

framework.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ import (
6666
"sync"
6767
"time"
6868

69+
"github.com/vulncheck-oss/go-exploit"
6970
"github.com/vulncheck-oss/go-exploit/c2"
7071
"github.com/vulncheck-oss/go-exploit/cli"
7172
"github.com/vulncheck-oss/go-exploit/config"
@@ -275,7 +276,8 @@ func parseCommandLine(conf *config.Config) bool {
275276
}
276277

277278
func startC2Server(conf *config.Config) bool {
278-
if conf.DoExploit && !conf.ThirdPartyC2Server && conf.Bport == 0 {
279+
if conf.DoExploit && !conf.ThirdPartyC2Server && conf.Bport == 0 &&
280+
(conf.ExType != exploit.InformationDisclosure && conf.ExType != exploit.Webshell) {
279281
c2Impl, success := c2.GetInstance(conf.C2Type)
280282
if !success || c2Impl == nil {
281283
return false

0 commit comments

Comments
 (0)