Skip to content

Commit

Permalink
WSUS host server collection from localmachine and added edge "patches…
Browse files Browse the repository at this point in the history
…" for attack path analysis
  • Loading branch information
lkarlslund committed May 6, 2022
1 parent d877dcb commit 699e656
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 1 deletion.
16 changes: 15 additions & 1 deletion modules/integrations/localmachine/analyze/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package analyze

import (
"fmt"
"net/url"
"path/filepath"
"strings"

Expand Down Expand Up @@ -56,6 +57,9 @@ var (
PwnSeTcb = engine.NewPwn("SeTcb")

PwnSIDCollision = engine.NewPwn("SIDCollision")

DNSHostname = engine.NewAttribute("dnsHostName")
PwnPatches = engine.NewPwn("Patches")
)

func MapSID(original, new, input windowssecurity.SID) windowssecurity.SID {
Expand Down Expand Up @@ -90,10 +94,20 @@ func (ld *LocalMachineLoader) ImportCollectorInfo(cinfo localmachine.Info) error
computerobject = ld.ao.AddNew()
}

computerobject.SetValues(
computerobject.SetFlex(
engine.IgnoreBlanks,
activedirectory.SAMAccountName, engine.AttributeValueString(strings.ToUpper(cinfo.Machine.Name)+"$"),
)

if cinfo.Machine.WUServer != "" {
if u, err := url.Parse(cinfo.Machine.WUServer); err == nil {
wsusserver, _ := ld.ao.FindOrAdd(
DNSHostname, engine.AttributeValueString(u.Host),
)
wsusserver.Pwns(computerobject, PwnPatches)
}
}

var isdomaincontroller bool
if cinfo.Machine.ProductType != "" {
// New way of detecting domain controller
Expand Down
10 changes: 10 additions & 0 deletions modules/integrations/localmachine/collect/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,16 @@ func Collect(outputpath string) error {
machineinfo.SCCMLastValidMP, _, _ = ccmsetup_key.GetStringValue(`LastValidMP`)
}

// WSUS SETTINGS
wu_key, err := registry.OpenKey(registry.LOCAL_MACHINE,
`SOFTWARE\Policies\Microsoft\Windows\WindupsUpdate`,
registry.READ|registry.ENUMERATE_SUB_KEYS|registry.WOW64_64KEY)
if err == nil {
defer wu_key.Close()
machineinfo.WUServer, _, _ = wu_key.GetStringValue(`WUServer`)
machineinfo.WUStatusServer, _, _ = wu_key.GetStringValue(`WUStatusServer`)
}

// UAC SETTINGS
polsys_key, err := registry.OpenKey(registry.LOCAL_MACHINE,
`SOFTWARE\Microsoft\Windows NT\CurrentVersion\Policies\System`,
Expand Down
3 changes: 3 additions & 0 deletions modules/integrations/localmachine/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ type Machine struct {

SCCMLastValidMP string `json:",omitempty"`

WUServer string `json:",omitempty"`
WUStatusServer string `json:",omitempty"`

UACConsentPromptBehaviorAdmin uint64 `json:",omitempty"`
UACEnableLUA uint64 `json:",omitempty"`
UACLocalAccountTokenFilterPolicy uint64 `json:",omitempty"`
Expand Down
24 changes: 24 additions & 0 deletions modules/integrations/localmachine/structs_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 699e656

Please sign in to comment.