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

changes to disable LDAP and FTP in responder when they are used by "interactsh" #987

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ $ sudo interactsh-server -responder -d localhost
On default settings, the daemon listens on the following ports:

- UDP: 137, 138, 1434
+ TCP: 21 (might collide with FTP daemon if used), 110, 135, 139, 389, 445, 1433, 3141, 3128
+ TCP: 21 (might collide with FTP daemon if used), 110, 135, 139, 389 (might collide with LDAP server), 445, 1433, 3141, 3128

## Interactsh Integration

Expand Down
18 changes: 10 additions & 8 deletions cmd/interactsh-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ func main() {
flagSet.IntVar(&cliOptions.SmtpsPort, "smtps-port", 587, "port to use for smtps service"),
flagSet.IntVar(&cliOptions.SmtpAutoTLSPort, "smtp-autotls-port", 465, "port to use for smtps autotls service"),
flagSet.IntVar(&cliOptions.LdapPort, "ldap-port", 389, "port to use for ldap service"),
flagSet.BoolVar(&cliOptions.LdapWithFullLogger, "ldap", false, "enable ldap server with full logging (authenticated)"),
flagSet.BoolVar(&cliOptions.Ldap, "ldap", true, "enable ldap server"),
flagSet.BoolVar(&cliOptions.LdapWithFullLogger, "ldapFullLog", false, "enable ldap server with full logging (authenticated)"),
flagSet.BoolVarP(&cliOptions.RootTLD, "wildcard", "wc", false, "enable wildcard interaction for interactsh domain (authenticated)"),
flagSet.BoolVar(&cliOptions.Smb, "smb", false, "start smb agent - impacket and python 3 must be installed (authenticated)"),
flagSet.BoolVar(&cliOptions.Responder, "responder", false, "start responder agent - docker must be installed (authenticated)"),
Expand Down Expand Up @@ -319,13 +320,14 @@ func main() {
go smtpServer.ListenAndServe(tlsConfig, smtpAlive, smtpsAlive)

ldapAlive := make(chan bool)
ldapServer, err := server.NewLDAPServer(serverOptions, cliOptions.LdapWithFullLogger)
if err != nil {
gologger.Fatal().Msgf("Could not create LDAP server: %s", err)
if cliOptions.Ldap {
ldapServer, err := server.NewLDAPServer(serverOptions, cliOptions.LdapWithFullLogger)
if err != nil {
gologger.Fatal().Msgf("Could not create LDAP server: %s", err)
}
go ldapServer.ListenAndServe(tlsConfig, ldapAlive)
defer ldapServer.Close()
}
go ldapServer.ListenAndServe(tlsConfig, ldapAlive)
defer ldapServer.Close()

ftpAlive := make(chan bool)
ftpsAlive := make(chan bool)
if cliOptions.Ftp {
Expand All @@ -338,7 +340,7 @@ func main() {

responderAlive := make(chan bool)
if cliOptions.Responder {
responderServer, err := server.NewResponderServer(serverOptions)
responderServer, err := server.NewResponderServer(serverOptions,cliOptions.Ldap,cliOptions.Ftp)
if err != nil {
gologger.Fatal().Msgf("Could not create SMB server: %s", err)
}
Expand Down
1 change: 1 addition & 0 deletions pkg/options/server_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type CLIServerOptions struct {
HttpsPort int
Hostmasters []string
LdapWithFullLogger bool
Ldap bool
Eviction int
NoEviction bool
Responder bool
Expand Down
15 changes: 13 additions & 2 deletions pkg/server/responder_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,20 @@ var responderMonitorList map[string]string = map[string]string{
// ResponderServer is a Responder wrapper server instance
type ResponderServer struct {
options *Options
ldapInteract bool
ftpInteract bool
LogFile string
ipAddress net.IP
cmd *exec.Cmd
tmpFolder string
}

// NewResponderServer returns a new SMB server.
func NewResponderServer(options *Options) (*ResponderServer, error) {
func NewResponderServer(options *Options,LdapInteract bool,FtpInteract bool) (*ResponderServer, error) {
server := &ResponderServer{
options: options,
ldapInteract:LdapInteract,
ftpInteract:FtpInteract,
ipAddress: net.ParseIP(options.IPAddress),
}
return server, nil
Expand All @@ -51,7 +55,14 @@ func (h *ResponderServer) ListenAndServe(responderAlive chan bool) error {
}
h.tmpFolder = tmpFolder
// execute dockerized responder
cmdLine := "docker run -p 137:137/udp -p 138:138/udp -p 389:389 -p 1433:1433 -p 1434:1434/udp -p 135:135 -p 139:139 -p 445:445 -p 21:21 -p 3141:3141 -p 110:110 -p 3128:3128 -p 5355:5355/udp -v " + h.tmpFolder + ":/opt/Responder/logs --rm interactsh:latest"
cmdLine := "docker run -p 137:137/udp -p 138:138/udp -p 1433:1433 -p 1434:1434/udp -p 135:135 -p 139:139 -p 445:445 -p 3141:3141 -p 110:110 -p 3128:3128 -p 5355:5355/udp"
if !h.ldapInteract{
cmdLine += " -p 389:389 "
}
if !h.ftpInteract{
cmdLine += " -p 21:21 "
}
cmdLine += " -v " + h.tmpFolder + ":/opt/Responder/logs --rm interactsh:latest"
args := strings.Fields(cmdLine)
h.cmd = exec.Command(args[0], args[1:]...)
err = h.cmd.Start()
Expand Down
Loading