lkarlslund/Adalanche

Runtime error: invalid memory address or nil pointer dereference

Closed this issue · 4 comments

qz4 commented

Step 1: adalanche-windows-x64-v2024.1.11.exe collect activedirectory
Finishes with message "Terminating successfully".

Step 2: adalanche-windows-x64-v2024.1.11.exe analyze
The lines prior to the runtime error is first an information line saying:
"We produced a total of x objects from data",
followed by a warning saying
"Can not find machine object for DC CN=xxxxx...."
and then the runtime error occurs.

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x20 pc=0xa6ae47]

goroutine 861 [running]:
github.com/lkarlslund/adalanche/modules/integrations/activedirectory/analyze.init.0.func46.1(0xc0599cb010?)
/home/runner/work/Adalanche/Adalanche/modules/integrations/activedirectory/analyze/analyze-ad.go:1254 +0x827
github.com/lkarlslund/adalanche/modules/integrations/activedirectory/analyze.init.0.func46.(*Objects).Iterate.func2(0x377b90?, 0xc02cea9790?)
/home/runner/work/Adalanche/Adalanche/modules/engine/objects.go:471 +0x1a
github.com/SaveTheRbtz/generic-sync-map-go.(*MapOf[...]).Range(0x1de0940?, 0xc000377d68?)
/home/runner/go/pkg/mod/github.com/!save!the!rbtz/generic-sync-map-go@v0.0.0-20230201052002-6c5833b989be/map.go:334 +0x29a
github.com/lkarlslund/adalanche/modules/engine.(*Objects).Iterate(...)
/home/runner/work/Adalanche/Adalanche/modules/engine/objects.go:470
github.com/lkarlslund/adalanche/modules/integrations/activedirectory/analyze.init.0.func46(0xc000449200)
/home/runner/work/Adalanche/Adalanche/modules/integrations/activedirectory/analyze/analyze-ad.go:1199 +0x51f
github.com/lkarlslund/adalanche/modules/engine.Process.func1({0x1cdf560, {0xd17841, 0x25}, 0x1, 0x0})
/home/runner/work/Adalanche/Adalanche/modules/engine/edgeanalyzers.go:70 +0x54
created by github.com/lkarlslund/adalanche/modules/engine.Process in goroutine 855
/home/runner/work/Adalanche/Adalanche/modules/engine/edgeanalyzers.go:69 +0x291

Thanks for the error report :-)

There has been internal changes to this recently, is it possible to get you to try with the latest build so I'm not chasing down something that's already fixed?

qz4 commented

Hi, yes, I can give this a try.
I tried the same, but using adalanche-windows-x64-v2024.1.11-37-g7bdd945.exe

10:24:10.406 INFORMA We produced a total of x objects from data
10:24:26.159 WARNING Can not find machine object for DC CN=x,OU=x,DC=x
10:24:27.900 INFORMA Domain x has a bidirectional trust with x
10:24:28.039 INFORMA Domain x has a bidirectional trust with x
10:24:29.815 INFORMA Domain x has a incoming trust with x
10:24:30.006 INFORMA Domain x has a bidirectional trust with x
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x20 pc=0xfb03cf]

goroutine 867 [running]:
github.com/lkarlslund/adalanche/modules/integrations/activedirectory/analyze.init.0.func45.1(0xc019a5c1e0)
/home/runner/work/Adalanche/Adalanche/modules/integrations/activedirectory/analyze/analyze-ad.go:1265 +0x66f
github.com/lkarlslund/adalanche/modules/integrations/activedirectory/analyze.init.0.func45.(*Objects).Iterate.2(0x4c5b80?, 0xc08f0c5050?)
/home/runner/work/Adalanche/Adalanche/modules/engine/objects.go:467 +0x1a
github.com/SaveTheRbtz/generic-sync-map-go.(*MapOf[...]).Range(0x23c08a0?, 0xc0004c5f40?)
/home/runner/go/pkg/mod/github.com/!save!the!rbtz/generic-sync-map-go@v0.0.0-20230201052002-6c5833b989be/map.go:334 +0x2fa
github.com/lkarlslund/adalanche/modules/engine.(*Objects).Iterate(...)
/home/runner/work/Adalanche/Adalanche/modules/engine/objects.go:466
github.com/lkarlslund/adalanche/modules/integrations/activedirectory/analyze.init.0.func45(0xc0000fc908)
/home/runner/work/Adalanche/Adalanche/modules/integrations/activedirectory/analyze/analyze-ad.go:1203 +0x51f
github.com/lkarlslund/adalanche/modules/engine.Process.func1({0x2299460, {0x12ce329, 0x25}, 0x1, 0x0})
/home/runner/work/Adalanche/Adalanche/modules/engine/edgeanalyzers.go:70 +0x50
created by github.com/lkarlslund/adalanche/modules/engine.Process in goroutine 851
/home/runner/work/Adalanche/Adalanche/modules/engine/edgeanalyzers.go:69 +0x286

Curious that you have an account without the accountExpires attribute, this is the first time I see this, but it is optional. I've committed a fix for it with commit 3ab9960 ...

qz4 commented

I can confirm that 3ab9960 has fixed the issue.