lkarlslund/Adalanche

runtime error: slice bounds out of range [:2080704] with length 1000000

Shionfox opened this issue · 1 comments

Hi I ran the following

adalanche-windows-x64-v2024.1.11-43-g7774681.exe collect activedirectory -authdomain "contoso" --domain "contoso.com" --ignorecert --tlsmode "tls" --username Admin_AD--password P4$$w0rd --datapath "c:\ADALANCHE\ContosoData"

And got these error from the console:


[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:   export GIN_MODE=release
 - using code:  gin.SetMode(gin.ReleaseMode)

13:58:54.561  INFORMA  Adalanche Open Source v2024.1.11-43-g7774681 (non-release), (c) 2020-2024 Lars Karlslund, This program comes with ABSOLUTELY NO WARRANTY
13:58:54.683  INFORMA  AD controller(s) detected as: DC01.contoso.com, DC02.contoso.com, DC03.contoso.com, DC04.contoso.com, DC05.contoso.com, DC02.contoso.com, DC06.contoso.com
13:58:54.684  INFORMA  Setting up TLS encrypted LDAP session to DC01.contoso.com:389
13:58:54.687  INFORMA  Connecting to DC01.contoso.com:389
13:58:54.896  INFORMA  Using user Admin_AD authentication mode LDAP_AUTH_NEGOTIATE
13:58:55.001  INFORMA  Successfull connect to DC DC01.contoso.com
13:58:55.016  INFORMA  Probing RootDSE ...
| Dumping from  ... (1/-, 51 objects/s) [0s]
13:58:55.043  INFORMA  Saving RootDSE ...
| Dumping from  ... (1/-, 44 objects/s) [0s]
13:58:55.090  INFORMA  Collecting schema objects from CN=Schema,CN=Configuration,DC=contoso,DC=com...
- Dumping from CN=Schema,CN=Configuration,DC=contoso,DC=com... (4710/-, 2512 objects/s) [1s]
13:58:57.017  INFORMA  Collecting configuration objects from CN=Configuration,DC=contoso,DC=com...
/ Dumping from CN=Configuration,DC=contoso,DC=com... (4166/-, 2008 objects/s) [2s] panic: runtime error: slice bounds out of range [:2080704] with length 1000000

goroutine 1 [running]:
github.com/lkarlslund/adalanche/modules/integrations/activedirectory/collect.GoBytes(...)
        /home/runner/work/Adalanche/Adalanche/modules/integrations/activedirectory/collect/ldap_windows.go:831
github.com/lkarlslund/adalanche/modules/integrations/activedirectory/collect.LDAPBerval.Data(...)
        /home/runner/work/Adalanche/Adalanche/modules/integrations/activedirectory/collect/ldap_windows.go:742
github.com/lkarlslund/adalanche/modules/integrations/activedirectory/collect.(*WAD).Dump(0xc0000c0180, {{0xc000458690, 0x28}, 0x2, {0x1e7a4be, 0xf}, {0x0, 0x0, 0x0}, 0x1, ...})
        /home/runner/work/Adalanche/Adalanche/modules/integrations/activedirectory/collect/ldap_windows.go:370 +0x1b4f
github.com/lkarlslund/adalanche/modules/integrations/activedirectory/collect.Execute(0xc0000c2700?, {0x1e64ef5?, 0x4?, 0x1e64ef9?})
        /home/runner/work/Adalanche/Adalanche/modules/integrations/activedirectory/collect/cli.go:461 +0x3087
github.com/spf13/cobra.(*Command).execute(0x3687580, {0xc0001429a0, 0xe, 0xe})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:983 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0x3686fc0)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/lkarlslund/adalanche/modules/cli.Run()
        /home/runner/work/Adalanche/Adalanche/modules/cli/main.go:156 +0xb08
main.main()
        /home/runner/work/Adalanche/Adalanche/adalanche/main.go:15 +0x25

Seems to be that the Collector for Active Directory doesn't finnish correclty so when I run the Analyze

adalanche-windows-x64-v2024.1.11-43-g7774681.exe analyze --datapath "c:\ADALANCHE\ContosoData"

[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:   export GIN_MODE=release
 - using code:  gin.SetMode(gin.ReleaseMode)

13:56:24.363  INFORMA  Adalanche Open Source v2024.1.11-43-g7774681 (non-release), (c) 2020-2024 Lars Karlslund, This program comes with ABSOLUTELY NO WARRANTY
13:56:24.461  INFORMA  Scanning for data files from data ...
13:56:24.462  INFORMA  Will process 3 files
13:56:24.728  INFORMA  Loaded 3 files, skipped 0 files
13:56:25.534   FATAL   Can't apply unique source for AD data from data\DC=contoso,DC=com, this will give errors during object merging: No domain info found in collection

Thanks for the bug report, it should be fixed in the latest commit