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

WIP Unexpected protocol: Extend trustedAppReferenceList to include more protocols #577 #618

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 18 additions & 7 deletions parser/fsimporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type (
trustedAppTiplet struct {
protocol string
port int
service string
service []string
}
)

Expand All @@ -71,10 +71,18 @@ func NewFSImporter(res *resources.Resources,
neverIncluded: util.ParseSubnets(res.Config.S.Filtering.NeverInclude),
}
}

// These protocols are innocent until proven guilty
var trustedAppReferenceList = [...]trustedAppTiplet{
{"tcp", 80, "http"},
{"tcp", 443, "ssl"},
{"tcp", 80, []string{"http", "ssl", "http,ssl"}},
{"tcp", 443, []string{"ssl"}},
{"tcp", 53, []string{"dns"}},
{"tcp", 22, []string{"ssh"}},
{"udp", 123, []string{"ntp", "-"}},
{"udp", 53, []string{"dns"}},
{"tcp", 445, []string{"smb"}},
{"tcp", 25, []string{"smtp", "ssl", "smtp,ssl"}},
{"tcp", 3306, []string{"mysql"}},
{"tcp", 143, []string{"imap", "ssl", "imap,ssl"}},
}

//GetInternalSubnets returns the internal subnets from the config file
Expand Down Expand Up @@ -468,9 +476,12 @@ func (fs *FSImporter) parseFiles(indexedFiles []*fpt.IndexedFile, parsingThreads
if uconnMap[srcDstKey].UPPSFlag == false {
for _, entry := range trustedAppReferenceList {
if (protocol == entry.protocol) && (dstPort == entry.port) {
if service != entry.service {
hostMap[srcKey].UntrustedAppConnCount++
uconnMap[srcDstKey].UPPSFlag = true
for i := range entry.service {
if service != entry.service[i] {
hostMap[srcKey].UntrustedAppConnCount++
uconnMap[srcDstKey].UPPSFlag = true
break; // make sure it only doesn't match once
}
}
}
}
Expand Down