Skip to main content
CVE Vulnerability Database

CVE-2024-5651: Fence Agents Remediation Operator RCE

CVE-2024-5651 is a remote code execution vulnerability in Fence Agents Remediation operator that enables privilege escalation to cluster-admin. This article covers technical details, affected versions, and mitigation strategies.

Published:

CVE-2024-5651 Overview

A code injection flaw exists in the Fence Agents Remediation (FAR) operator that allows authenticated low-privilege users to achieve remote code execution on the operator's pod. The vulnerability stems from insufficient validation of the --ssh-path and --telnet-path arguments passed to fence agents through a FenceAgentsRemediation custom resource. An attacker with developer-level access can craft a malicious remediation object to execute arbitrary commands. Successful exploitation escalates privileges first to the operator's service account, then pivots to a service account holding cluster-admin privileges. The issue is tracked under CWE-94: Improper Control of Generation of Code.

Critical Impact

Low-privileged users can escalate to cluster-admin through arbitrary command execution in the fence agent operator pod.

Affected Products

  • Red Hat Workload Availability Fence Agents Remediation Operator
  • OpenShift clusters with the FAR operator installed
  • Deployments allowing developer-tier users to create FenceAgentsRemediation custom resources

Discovery Timeline

  • 2024-08-12 - CVE-2024-5651 published to the National Vulnerability Database (NVD)
  • 2024-08-12 - Red Hat releases security advisory RHSA-2024:5453
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-5651

Vulnerability Analysis

The Fence Agents Remediation operator invokes fence agent binaries to power-cycle or isolate unhealthy nodes in a Kubernetes cluster. Users specify agent arguments through the FenceAgentsRemediation custom resource. When the operator builds the fence agent command line, it forwards user-supplied --ssh-path and --telnet-path values without sanitization. Fence agents that support these arguments treat the path as an executable, allowing an attacker to substitute an arbitrary command. The command runs inside the operator pod under the operator's service account. From that foothold, the attacker leverages workload identities associated with the operator to reach a service account with cluster-admin binding.

Root Cause

The root cause is improper control of code generation [CWE-94]. The operator concatenates untrusted custom resource fields into a subprocess invocation without an allowlist, path canonicalization, or shell-metacharacter filtering. Any user permitted to create FenceAgentsRemediation resources can therefore control the executed binary.

Attack Vector

An authenticated attacker with permission to create FenceAgentsRemediation objects submits a manifest referencing a fence agent that honors --ssh-path or --telnet-path. The attacker sets the path argument to a shell payload or an existing binary such as /bin/sh with attacker-controlled follow-on arguments. When the operator reconciles the resource, it executes the payload inside the pod. The attacker then reads mounted service account tokens from /var/run/secrets/kubernetes.io/serviceaccount/ and uses them to authenticate to the Kubernetes API as a privileged identity.

No verified public proof-of-concept code is available. See the Red Hat CVE-2024-5651 Details advisory for vendor analysis.

Detection Methods for CVE-2024-5651

Indicators of Compromise

  • Creation of FenceAgentsRemediation resources by non-administrative service accounts or developer users
  • FenceAgentsRemediation objects containing --ssh-path or --telnet-path values that are not standard binary paths such as /usr/bin/ssh or /usr/bin/telnet
  • Unexpected process execution inside the FAR operator pod, particularly shells (sh, bash) or network utilities (curl, wget, nc)
  • Kubernetes API calls originating from the operator pod that access resources outside the operator's normal reconciliation scope

Detection Strategies

  • Audit Kubernetes API server logs for create and update verbs against the fenceagentsremediations.fence-agents-remediation.medik8s.io resource, correlating with the requesting user identity
  • Inspect the spec.agent and spec.sharedparameters fields on remediation objects for suspicious path arguments
  • Monitor container runtime telemetry for the operator pod and alert on child processes that are not fence agent binaries

Monitoring Recommendations

  • Enable Kubernetes audit logging at the RequestResponse level for the FAR operator namespace
  • Forward operator pod process and network telemetry to a centralized analytics platform for behavioral baselining
  • Track service account token usage from the operator pod and alert on API activity that exceeds its RBAC scope

How to Mitigate CVE-2024-5651

Immediate Actions Required

  • Apply the fixed Fence Agents Remediation operator version distributed in RHSA-2024:5453
  • Restrict RBAC permissions so only trusted cluster administrators can create or modify FenceAgentsRemediation resources
  • Review existing FenceAgentsRemediation objects for malicious --ssh-path or --telnet-path values and delete suspicious resources
  • Rotate service account tokens and credentials associated with the FAR operator and any cluster-admin bindings reachable from the operator pod

Patch Information

Red Hat has published a fixed build of the Fence Agents Remediation operator through advisory RHSA-2024:5453. The patched operator validates fence agent path arguments and prevents user-controlled substitution of the executed binary. Consult the Red Hat CVE-2024-5651 Details page and Red Hat Bug #2290540 Report for build identifiers and errata metadata.

Workarounds

  • Remove the create, update, and patch verbs on fenceagentsremediations resources from developer roles and namespace-scoped role bindings
  • Use an admission controller such as OPA Gatekeeper or Kyverno to reject FenceAgentsRemediation objects containing --ssh-path or --telnet-path arguments
  • Temporarily scale the FAR operator deployment to zero replicas in environments where remediation is not actively required
bash
# Kyverno policy fragment: block ssh-path/telnet-path arguments on FAR resources
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: block-far-path-injection
spec:
  validationFailureAction: Enforce
  rules:
    - name: deny-ssh-telnet-path
      match:
        any:
          - resources:
              kinds:
                - FenceAgentsRemediation
      validate:
        message: "--ssh-path and --telnet-path arguments are not permitted"
        deny:
          conditions:
            any:
              - key: "{{ request.object.spec.sharedparameters.\"--ssh-path\" || '' }}"
                operator: NotEquals
                value: ""
              - key: "{{ request.object.spec.sharedparameters.\"--telnet-path\" || '' }}"
                operator: NotEquals
                value: ""

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.