From c4b777db2fe1707f1bd12d9d5f592905be2cbff9 Mon Sep 17 00:00:00 2001 From: neargle Date: Fri, 15 Nov 2024 20:26:30 +0800 Subject: [PATCH] fix (exp shim-pwn): #104 merged directory appears twice in path --- pkg/exploit/escaping/containerd_shim_pwn.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/exploit/escaping/containerd_shim_pwn.go b/pkg/exploit/escaping/containerd_shim_pwn.go index d74361b..6beea23 100644 --- a/pkg/exploit/escaping/containerd_shim_pwn.go +++ b/pkg/exploit/escaping/containerd_shim_pwn.go @@ -26,6 +26,7 @@ import ( "log" "net" "os" + "path/filepath" "regexp" "strings" @@ -123,7 +124,9 @@ func containerdShimApiExp(sock, shellCmd, rhost, rport string) error { localBundlePath := fmt.Sprintf("/cdk_%s", util.RandString(6)) os.Mkdir(localBundlePath, os.ModePerm) - dockerAbsPath := GetDockerAbsPath() + "/merged" + localBundlePath + absPath := GetDockerAbsPath() + absPath = strings.TrimSuffix(absPath, "/merged") + dockerAbsPath := filepath.Join(absPath, "merged", localBundlePath) var payloadShellCmd = "" if len(shellCmd) > 0 {