CVE-2024-43803
Description
The Bare Metal Operator (BMO) implements a Kubernetes API for managing bare metal hosts in Metal3. The BareMetalHost (BMH) CRD allows the userData, metaData, and networkData for the provisioned host to be specified as links to Kubernetes Secrets. There are fields for both the Name and Namespace of the Secret, meaning that versions of the baremetal-operator prior to 0.8.0, 0.6.2, and 0.5.2 will read a Secret from any namespace. A user with access to create or edit a BareMetalHost can thus exfiltrate a Secret from another namespace by using it as e.g. the userData for provisioning some host (note that this need not be a real host, it could be a VM somewhere).
BMO will only read a key with the name value (or userData, metaData, or networkData), so that limits the exposure somewhat. value is probably a pretty common key though. Secrets used by _other_ BareMetalHosts in different namespaces are always vulnerable. It is probably relatively unusual for anyone other than cluster administrators to have RBAC access to create/edit a BareMetalHost. This vulnerability is only meaningful, if the cluster has users other than administrators and users' privileges are limited to their respective namespaces.
The patch prevents BMO from accepting links to Secrets from other namespaces as BMH input. Any BMH configuration is only read from the same namespace only. The problem is patched in BMO releases v0.7.0, v0.6.2 and v0.5.2 and users should upgrade to those versions. Prior upgrading, duplicate the BMC Secrets to the namespace where the corresponding BMH is. After upgrade, remove the old Secrets. As a workaround, an operator can configure BMO RBAC to be namespace scoped for Secrets, instead of cluster scoped, to prevent BMO from accessing Secrets from other namespaces.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
github.com/metal3-io/baremetal-operatorGo | >= 0.7.0-rc.0, < 0.8.0 | 0.8.0 |
github.com/metal3-io/baremetal-operatorGo | >= 0.6.0, < 0.6.2 | 0.6.2 |
github.com/metal3-io/baremetal-operatorGo | < 0.5.2 | 0.5.2 |
Patches
3bedae7b997d1Merge pull request #1931 from Nordix/tuomo/ghsa-pqfh-xh7w-7h3p-0.5
3 files changed · +60 −4
controllers/metal3.io/baremetalhost_controller_test.go+4 −0 modified@@ -41,6 +41,10 @@ const ( ) func newSecret(name string, data map[string]string) *corev1.Secret { + return newSecretInNamespace(name, namespace, data) +} + +func newSecretInNamespace(name, namespace string, data map[string]string) *corev1.Secret { secretData := make(map[string][]byte) for k, v := range data { secretData[k] = []byte(base64.StdEncoding.EncodeToString([]byte(v)))
controllers/metal3.io/host_config_data.go+7 −3 modified@@ -2,11 +2,11 @@ package controllers import ( "github.com/go-logr/logr" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/types" - metal3api "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1" "github.com/metal3-io/baremetal-operator/pkg/secretutils" + "github.com/pkg/errors" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/types" ) // hostConfigData is an implementation of host configuration data interface. @@ -21,6 +21,10 @@ type hostConfigData struct { // parameter to detirmine which data to return in case secret contins multiple // keys. func (hcd *hostConfigData) getSecretData(name, namespace, dataKey string) (string, error) { + if namespace != hcd.host.Namespace { + return "", errors.Errorf("%s secret must be in same namespace as host %s/%s", dataKey, hcd.host.Namespace, hcd.host.Name) + } + key := types.NamespacedName{ Name: name, Namespace: namespace,
controllers/metal3.io/host_config_data_test.go+49 −1 modified@@ -324,6 +324,54 @@ func TestProvisionWithHostConfig(t *testing.T) { ExpectedNetworkData: "", ErrNetworkData: true, }, + { + Scenario: "user-data secret in different namespace", + Host: newHost("host-user-data", + &metal3api.BareMetalHostSpec{ + BMC: metal3api.BMCDetails{ + Address: "ipmi://192.168.122.1:6233", + CredentialsName: defaultSecretName, + }, + UserData: &corev1.SecretReference{ + Name: "user-data", + Namespace: "other-namespace", + }, + }), + UserDataSecret: newSecretInNamespace("user-data", "other-namespace", map[string]string{"userData": "somedata"}), + ErrUserData: true, + }, + { + Scenario: "meta-data secret in different namespace", + Host: newHost("host-user-data", + &metal3api.BareMetalHostSpec{ + BMC: metal3api.BMCDetails{ + Address: "ipmi://192.168.122.1:6233", + CredentialsName: defaultSecretName, + }, + MetaData: &corev1.SecretReference{ + Name: "meta-data", + Namespace: "other-namespace", + }, + }), + NetworkDataSecret: newSecretInNamespace("meta-data", "other-namespace", map[string]string{"metaData": "key: value"}), + ErrMetaData: true, + }, + { + Scenario: "network-data secret in different namespace", + Host: newHost("host-user-data", + &metal3api.BareMetalHostSpec{ + BMC: metal3api.BMCDetails{ + Address: "ipmi://192.168.122.1:6233", + CredentialsName: defaultSecretName, + }, + NetworkData: &corev1.SecretReference{ + Name: "net-data", + Namespace: "other-namespace", + }, + }), + NetworkDataSecret: newSecretInNamespace("net-data", "other-namespace", map[string]string{"networkData": "key: value"}), + ErrNetworkData: true, + }, } for _, tc := range testCases { @@ -379,7 +427,7 @@ func TestProvisionWithHostConfig(t *testing.T) { } if actualMetaData != tc.ExpectedMetaData { - t.Fatal(fmt.Errorf("Failed to assert MetaData. Expected '%s' got '%s'", actualMetaData, tc.ExpectedMetaData)) + t.Fatal(fmt.Errorf("Failed to assert MetaData. Expected '%s' got '%s'", tc.ExpectedMetaData, actualMetaData)) } }) }
3af4882e9c5fMerge pull request #1930 from Nordix/tuomo/ghsa-pqfh-xh7w-7h3p-0.6
3 files changed · +60 −4
controllers/metal3.io/baremetalhost_controller_test.go+4 −0 modified@@ -41,6 +41,10 @@ const ( ) func newSecret(name string, data map[string]string) *corev1.Secret { + return newSecretInNamespace(name, namespace, data) +} + +func newSecretInNamespace(name, namespace string, data map[string]string) *corev1.Secret { secretData := make(map[string][]byte) for k, v := range data { secretData[k] = []byte(base64.StdEncoding.EncodeToString([]byte(v)))
controllers/metal3.io/host_config_data.go+7 −3 modified@@ -2,11 +2,11 @@ package controllers import ( "github.com/go-logr/logr" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/types" - metal3api "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1" "github.com/metal3-io/baremetal-operator/pkg/secretutils" + "github.com/pkg/errors" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/types" ) // hostConfigData is an implementation of host configuration data interface. @@ -21,6 +21,10 @@ type hostConfigData struct { // parameter to detirmine which data to return in case secret contins multiple // keys. func (hcd *hostConfigData) getSecretData(name, namespace, dataKey string) (string, error) { + if namespace != hcd.host.Namespace { + return "", errors.Errorf("%s secret must be in same namespace as host %s/%s", dataKey, hcd.host.Namespace, hcd.host.Name) + } + key := types.NamespacedName{ Name: name, Namespace: namespace,
controllers/metal3.io/host_config_data_test.go+49 −1 modified@@ -324,6 +324,54 @@ func TestProvisionWithHostConfig(t *testing.T) { ExpectedNetworkData: "", ErrNetworkData: true, }, + { + Scenario: "user-data secret in different namespace", + Host: newHost("host-user-data", + &metal3api.BareMetalHostSpec{ + BMC: metal3api.BMCDetails{ + Address: "ipmi://192.168.122.1:6233", + CredentialsName: defaultSecretName, + }, + UserData: &corev1.SecretReference{ + Name: "user-data", + Namespace: "other-namespace", + }, + }), + UserDataSecret: newSecretInNamespace("user-data", "other-namespace", map[string]string{"userData": "somedata"}), + ErrUserData: true, + }, + { + Scenario: "meta-data secret in different namespace", + Host: newHost("host-user-data", + &metal3api.BareMetalHostSpec{ + BMC: metal3api.BMCDetails{ + Address: "ipmi://192.168.122.1:6233", + CredentialsName: defaultSecretName, + }, + MetaData: &corev1.SecretReference{ + Name: "meta-data", + Namespace: "other-namespace", + }, + }), + NetworkDataSecret: newSecretInNamespace("meta-data", "other-namespace", map[string]string{"metaData": "key: value"}), + ErrMetaData: true, + }, + { + Scenario: "network-data secret in different namespace", + Host: newHost("host-user-data", + &metal3api.BareMetalHostSpec{ + BMC: metal3api.BMCDetails{ + Address: "ipmi://192.168.122.1:6233", + CredentialsName: defaultSecretName, + }, + NetworkData: &corev1.SecretReference{ + Name: "net-data", + Namespace: "other-namespace", + }, + }), + NetworkDataSecret: newSecretInNamespace("net-data", "other-namespace", map[string]string{"networkData": "key: value"}), + ErrNetworkData: true, + }, } for _, tc := range testCases { @@ -379,7 +427,7 @@ func TestProvisionWithHostConfig(t *testing.T) { } if actualMetaData != tc.ExpectedMetaData { - t.Fatal(fmt.Errorf("Failed to assert MetaData. Expected '%s' got '%s'", actualMetaData, tc.ExpectedMetaData)) + t.Fatal(fmt.Errorf("Failed to assert MetaData. Expected '%s' got '%s'", tc.ExpectedMetaData, actualMetaData)) } }) }
c2b5a557641bMerge pull request #1929 from Nordix/tuomo/ghsa-pqfh-xh7w-7h3p
3 files changed · +58 −1
controllers/metal3.io/baremetalhost_controller_test.go+4 −0 modified@@ -37,6 +37,10 @@ const ( ) func newSecret(name string, data map[string]string) *corev1.Secret { + return newSecretInNamespace(name, namespace, data) +} + +func newSecretInNamespace(name, namespace string, data map[string]string) *corev1.Secret { secretData := make(map[string][]byte) for k, v := range data { secretData[k] = []byte(base64.StdEncoding.EncodeToString([]byte(v)))
controllers/metal3.io/host_config_data.go+5 −0 modified@@ -4,6 +4,7 @@ import ( "github.com/go-logr/logr" metal3api "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1" "github.com/metal3-io/baremetal-operator/pkg/secretutils" + "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" ) @@ -20,6 +21,10 @@ type hostConfigData struct { // parameter to detirmine which data to return in case secret contins multiple // keys. func (hcd *hostConfigData) getSecretData(name, namespace, dataKey string) (string, error) { + if namespace != hcd.host.Namespace { + return "", errors.Errorf("%s secret must be in same namespace as host %s/%s", dataKey, hcd.host.Namespace, hcd.host.Name) + } + key := types.NamespacedName{ Name: name, Namespace: namespace,
controllers/metal3.io/host_config_data_test.go+49 −1 modified@@ -323,6 +323,54 @@ func TestProvisionWithHostConfig(t *testing.T) { ExpectedNetworkData: "", ErrNetworkData: true, }, + { + Scenario: "user-data secret in different namespace", + Host: newHost("host-user-data", + &metal3api.BareMetalHostSpec{ + BMC: metal3api.BMCDetails{ + Address: "ipmi://192.168.122.1:6233", + CredentialsName: defaultSecretName, + }, + UserData: &corev1.SecretReference{ + Name: "user-data", + Namespace: "other-namespace", + }, + }), + UserDataSecret: newSecretInNamespace("user-data", "other-namespace", map[string]string{"userData": "somedata"}), + ErrUserData: true, + }, + { + Scenario: "meta-data secret in different namespace", + Host: newHost("host-user-data", + &metal3api.BareMetalHostSpec{ + BMC: metal3api.BMCDetails{ + Address: "ipmi://192.168.122.1:6233", + CredentialsName: defaultSecretName, + }, + MetaData: &corev1.SecretReference{ + Name: "meta-data", + Namespace: "other-namespace", + }, + }), + NetworkDataSecret: newSecretInNamespace("meta-data", "other-namespace", map[string]string{"metaData": "key: value"}), + ErrMetaData: true, + }, + { + Scenario: "network-data secret in different namespace", + Host: newHost("host-user-data", + &metal3api.BareMetalHostSpec{ + BMC: metal3api.BMCDetails{ + Address: "ipmi://192.168.122.1:6233", + CredentialsName: defaultSecretName, + }, + NetworkData: &corev1.SecretReference{ + Name: "net-data", + Namespace: "other-namespace", + }, + }), + NetworkDataSecret: newSecretInNamespace("net-data", "other-namespace", map[string]string{"networkData": "key: value"}), + ErrNetworkData: true, + }, } for _, tc := range testCases { @@ -378,7 +426,7 @@ func TestProvisionWithHostConfig(t *testing.T) { } if actualMetaData != tc.ExpectedMetaData { - t.Fatal(fmt.Errorf("Failed to assert MetaData. Expected '%s' got '%s'", actualMetaData, tc.ExpectedMetaData)) + t.Fatal(fmt.Errorf("Failed to assert MetaData. Expected '%s' got '%s'", tc.ExpectedMetaData, actualMetaData)) } }) }
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
9- github.com/advisories/GHSA-pqfh-xh7w-7h3pghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2024-43803ghsaADVISORY
- github.com/metal3-io/baremetal-operator/commit/3af4882e9c5fadc1a7550f53daea21dccd271f74nvdWEB
- github.com/metal3-io/baremetal-operator/commit/bedae7b997d16f36e772806681569bb8eb4dadbbnvdWEB
- github.com/metal3-io/baremetal-operator/commit/c2b5a557641bc273367635124047d6c958aa15f7nvdWEB
- github.com/metal3-io/baremetal-operator/pull/1929nvdWEB
- github.com/metal3-io/baremetal-operator/pull/1930nvdWEB
- github.com/metal3-io/baremetal-operator/pull/1931nvdWEB
- github.com/metal3-io/baremetal-operator/security/advisories/GHSA-pqfh-xh7w-7h3pnvdWEB
News mentions
0No linked articles in our index yet.