VYPR
Medium severity6.5NVD Advisory· Published May 15, 2024· Updated Apr 15, 2026

CVE-2024-3744

CVE-2024-3744

Description

A security issue was discovered in azure-file-csi-driver where an actor with access to the driver logs could observe service account tokens. These tokens could then potentially be exchanged with external cloud providers to access secrets stored in cloud vault solutions. Tokens are only logged when TokenRequests is configured in the CSIDriver object and the driver is set to run at log level 2 or greater via the -v flag.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
sigs.k8s.io/azurefile-csi-driverGo
< 1.29.41.29.4
sigs.k8s.io/azurefile-csi-driverGo
>= 1.30.0, < 1.30.11.30.1

Patches

2
e11ff3dc2c03

fix: strip service account token

2 files changed · +85 1
  • pkg/csi-common/utils.go+47 1 modified
    @@ -17,6 +17,7 @@ limitations under the License.
     package csicommon
     
     import (
    +	"encoding/json"
     	"fmt"
     	"net"
     	"os"
    @@ -98,7 +99,7 @@ func getLogLevel(method string) int32 {
     func LogGRPC(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
     	level := klog.Level(getLogLevel(info.FullMethod))
     	klog.V(level).Infof("GRPC call: %s", info.FullMethod)
    -	klog.V(level).Infof("GRPC request: %s", protosanitizer.StripSecrets(req))
    +	klog.V(level).Infof("GRPC request: %s", StripSensitiveValue(protosanitizer.StripSecrets(req), "csi.storage.k8s.io/serviceAccount.tokens"))
     
     	resp, err := handler(ctx, req)
     	if err != nil {
    @@ -108,3 +109,48 @@ func LogGRPC(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, h
     	}
     	return resp, err
     }
    +
    +type stripSensitiveValue struct {
    +	// volume_context[key] is the value to be stripped.
    +	key string
    +	// req is the csi grpc request stripped by `protosanitizer.StripSecrets`
    +	req fmt.Stringer
    +}
    +
    +func StripSensitiveValue(req fmt.Stringer, key string) fmt.Stringer {
    +	return &stripSensitiveValue{
    +		key: key,
    +		req: req,
    +	}
    +}
    +
    +func (s *stripSensitiveValue) String() string {
    +	return stripSensitiveValueByKey(s.req, s.key)
    +}
    +
    +func stripSensitiveValueByKey(req fmt.Stringer, key string) string {
    +	var parsed map[string]interface{}
    +
    +	err := json.Unmarshal([]byte(req.String()), &parsed)
    +	if err != nil || parsed == nil {
    +		return req.String()
    +	}
    +
    +	volumeContext, ok := parsed["volume_context"].(map[string]interface{})
    +	if !ok {
    +		return req.String()
    +	}
    +
    +	if _, ok := volumeContext[key]; !ok {
    +		return req.String()
    +	}
    +
    +	volumeContext[key] = "***stripped***"
    +
    +	b, err := json.Marshal(parsed)
    +	if err != nil {
    +		return req.String()
    +	}
    +
    +	return string(b)
    +}
    
  • pkg/csi-common/utils_test.go+38 0 modified
    @@ -127,6 +127,44 @@ func TestLogGRPC(t *testing.T) {
     			},
     			`GRPC request: {"starting_token":"testtoken"}`,
     		},
    +		{
    +			"NodeStageVolumeRequest with service account token",
    +			&csi.NodeStageVolumeRequest{
    +				VolumeContext: map[string]string{
    +					"csi.storage.k8s.io/serviceAccount.tokens": "testtoken",
    +					"csi.storage.k8s.io/testfield":             "testvalue",
    +				},
    +				XXX_sizecache: 100,
    +			},
    +			`GRPC request: {"volume_context":{"csi.storage.k8s.io/serviceAccount.tokens":"***stripped***","csi.storage.k8s.io/testfield":"testvalue"}}`,
    +		},
    +		{
    +			"NodePublishVolumeRequest with service account token",
    +			&csi.NodePublishVolumeRequest{
    +				VolumeContext: map[string]string{
    +					"csi.storage.k8s.io/serviceAccount.tokens": "testtoken",
    +					"csi.storage.k8s.io/testfield":             "testvalue",
    +				},
    +				XXX_sizecache: 100,
    +			},
    +			`GRPC request: {"volume_context":{"csi.storage.k8s.io/serviceAccount.tokens":"***stripped***","csi.storage.k8s.io/testfield":"testvalue"}}`,
    +		},
    +		{
    +			"with secrets and service account token",
    +			&csi.NodeStageVolumeRequest{
    +				VolumeId: "vol_1",
    +				Secrets: map[string]string{
    +					"account_name": "k8s",
    +					"account_key":  "testkey",
    +				},
    +				VolumeContext: map[string]string{
    +					"csi.storage.k8s.io/serviceAccount.tokens": "testtoken",
    +					"csi.storage.k8s.io/testfield":             "testvalue",
    +				},
    +				XXX_sizecache: 100,
    +			},
    +			`GRPC request: {"secrets":"***stripped***","volume_context":{"csi.storage.k8s.io/serviceAccount.tokens":"***stripped***","csi.storage.k8s.io/testfield":"testvalue"},"volume_id":"vol_1"}`,
    +		},
     	}
     
     	for _, test := range tests {
    
a1b7446de942

fix: strip service account token

2 files changed · +85 1
  • pkg/csi-common/utils.go+47 1 modified
    @@ -17,6 +17,7 @@ limitations under the License.
     package csicommon
     
     import (
    +	"encoding/json"
     	"fmt"
     	"strings"
     
    @@ -74,7 +75,7 @@ func getLogLevel(method string) int32 {
     func logGRPC(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
     	level := klog.Level(getLogLevel(info.FullMethod))
     	klog.V(level).Infof("GRPC call: %s", info.FullMethod)
    -	klog.V(level).Infof("GRPC request: %s", protosanitizer.StripSecrets(req))
    +	klog.V(level).Infof("GRPC request: %s", StripSensitiveValue(protosanitizer.StripSecrets(req), "csi.storage.k8s.io/serviceAccount.tokens"))
     
     	resp, err := handler(ctx, req)
     	if err != nil {
    @@ -84,3 +85,48 @@ func logGRPC(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, h
     	}
     	return resp, err
     }
    +
    +type stripSensitiveValue struct {
    +	// volume_context[key] is the value to be stripped.
    +	key string
    +	// req is the csi grpc request stripped by `protosanitizer.StripSecrets`
    +	req fmt.Stringer
    +}
    +
    +func StripSensitiveValue(req fmt.Stringer, key string) fmt.Stringer {
    +	return &stripSensitiveValue{
    +		key: key,
    +		req: req,
    +	}
    +}
    +
    +func (s *stripSensitiveValue) String() string {
    +	return stripSensitiveValueByKey(s.req, s.key)
    +}
    +
    +func stripSensitiveValueByKey(req fmt.Stringer, key string) string {
    +	var parsed map[string]interface{}
    +
    +	err := json.Unmarshal([]byte(req.String()), &parsed)
    +	if err != nil || parsed == nil {
    +		return req.String()
    +	}
    +
    +	volumeContext, ok := parsed["volume_context"].(map[string]interface{})
    +	if !ok {
    +		return req.String()
    +	}
    +
    +	if _, ok := volumeContext[key]; !ok {
    +		return req.String()
    +	}
    +
    +	volumeContext[key] = "***stripped***"
    +
    +	b, err := json.Marshal(parsed)
    +	if err != nil {
    +		return req.String()
    +	}
    +
    +	return string(b)
    +}
    
  • pkg/csi-common/utils_test.go+38 0 modified
    @@ -127,6 +127,44 @@ func TestLogGRPC(t *testing.T) {
     			},
     			`GRPC request: {"starting_token":"testtoken"}`,
     		},
    +		{
    +			"NodeStageVolumeRequest with service account token",
    +			&csi.NodeStageVolumeRequest{
    +				VolumeContext: map[string]string{
    +					"csi.storage.k8s.io/serviceAccount.tokens": "testtoken",
    +					"csi.storage.k8s.io/testfield":             "testvalue",
    +				},
    +				XXX_sizecache: 100,
    +			},
    +			`GRPC request: {"volume_context":{"csi.storage.k8s.io/serviceAccount.tokens":"***stripped***","csi.storage.k8s.io/testfield":"testvalue"}}`,
    +		},
    +		{
    +			"NodePublishVolumeRequest with service account token",
    +			&csi.NodePublishVolumeRequest{
    +				VolumeContext: map[string]string{
    +					"csi.storage.k8s.io/serviceAccount.tokens": "testtoken",
    +					"csi.storage.k8s.io/testfield":             "testvalue",
    +				},
    +				XXX_sizecache: 100,
    +			},
    +			`GRPC request: {"volume_context":{"csi.storage.k8s.io/serviceAccount.tokens":"***stripped***","csi.storage.k8s.io/testfield":"testvalue"}}`,
    +		},
    +		{
    +			"with secrets and service account token",
    +			&csi.NodeStageVolumeRequest{
    +				VolumeId: "vol_1",
    +				Secrets: map[string]string{
    +					"account_name": "k8s",
    +					"account_key":  "testkey",
    +				},
    +				VolumeContext: map[string]string{
    +					"csi.storage.k8s.io/serviceAccount.tokens": "testtoken",
    +					"csi.storage.k8s.io/testfield":             "testvalue",
    +				},
    +				XXX_sizecache: 100,
    +			},
    +			`GRPC request: {"secrets":"***stripped***","volume_context":{"csi.storage.k8s.io/serviceAccount.tokens":"***stripped***","csi.storage.k8s.io/testfield":"testvalue"},"volume_id":"vol_1"}`,
    +		},
     	}
     
     	for _, test := range tests {
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

7

News mentions

0

No linked articles in our index yet.