Critical Apache bRPC Flaw Exposes Servers to Unauthenticated Remote Command Execution (CVE-2025-60021)

CVE-2025-60021 is a critical remote command injection vulnerability in Apache bRPC, a high-performance RPC framework commonly used in backend services.

The issue exists in the built-in heap profiling HTTP service, specifically the endpoint responsible for generating jemalloc heap dumps. Due to unsafe handling of user-controlled parameters, an unauthenticated remote attacker can inject and execute arbitrary system commands on the host running the vulnerable service.

This vulnerability is especially dangerous because:

  • It is remotely exploitable
  • Requires no authentication
  • Can lead directly to full system compromise

Affected Versions

  • All Apache bRPC versions prior to 1.15.0
  • Any deployment where:
    • The built-in HTTP server is enabled
    • The heap profiler endpoint is exposed (internally or externally)

Root Cause (Technical)

The vulnerability originates from improper command construction inside the heap profiling service.

What went wrong

  • The /pprof/heap endpoint accepts a parameter (commonly extra_options)
  • This parameter is passed directly into a shell command
  • No proper sanitization or escaping is applied
  • The command is executed using system shell invocation

As a result, attackers can append shell metacharacters such as:

; | && ` $()

This transforms a legitimate profiling request into arbitrary command execution.

Why this is severe

The profiling service runs with the same privileges as the bRPC process, which in many environments means:

  • Access to internal networks
  • Access to secrets in memory
  • Ability to install persistence or lateral movement tools

Attack Flow (Step-by-Step)

  1. Attacker identifies an exposed bRPC HTTP endpoint
  2. Attacker sends a crafted request to /pprof/heap
  3. Malicious payload is injected via extra_options
  4. Backend executes the payload as part of a shell command
  5. Attacker gains command execution on the server

No authentication, tokens, or user interaction are required.


Example Exploitation Pattern (Educational Only)

For defensive understanding only. Do NOT use offensively.

Attackers abuse shell expansion, for example:

  • Injecting command separators
  • Redirecting output
  • Triggering outbound connections

This allows:

  • Reverse shells
  • File exfiltration
  • Dropping malware
  • Credential harvesting

Even a single HTTP request can be enough.


Real-World Risk Scenarios

  • Internal microservices exposed through misconfigured ingress
  • Debug endpoints accidentally exposed to the internet
  • Kubernetes services with overly permissive networking
  • Legacy bRPC services running with elevated privileges

Detection & Monitoring (Technical)

1. Network-Level Detection (HTTP)

Monitor for suspicious requests targeting profiling endpoints.

High-risk paths

/pprof/heap
/pprof/*

Suspicious indicators

  • Presence of shell metacharacters:
; | && || ` $() > <
  • URL-encoded equivalents:
%3B %7C %26 %24 %60

2. Example IDS / IPS Detection Rule (Conceptual)

alert http any any -> any any (
  msg:"Possible CVE-2025-60021 exploitation attempt";
  flow:to_server,established;
  content:"/pprof/heap";
  http_uri;
  pcre:"/(\;|\||\&\&|\|\||\`|\$\()/";
  classtype:web-application-attack;
  sid:202560021;
)

3. Web Server / Proxy Log Detection

Look for:

  • Requests to /pprof/heap from unusual IPs
  • Repeated profiling requests
  • Long or abnormal query strings
  • URL-encoded shell characters

4. Host-Based Detection

Monitor the bRPC process for:

  • Unexpected child processes
  • Execution of shell utilities (sh, bash, curl, wget, nc)
  • Outbound network connections initiated by the service

Example suspicious behavior:

  • brpc_server → /bin/sh
  • brpc_server → curl http://…
  • brpc_server → chmod /tmp/*

5. Behavioral Indicators of Compromise

  • New files in /tmp, /var/tmp
  • Unexpected cron jobs
  • Sudden CPU or memory spikes during HTTP requests
  • Jemalloc profiling files generated unusually often

Exploitation Status

  • Proof-of-concept techniques exist
  • Exploitation is trivial once endpoint is reachable
  • No exploit chaining required
  • High likelihood of silent compromise in exposed environments

Immediate Action

Upgrade Apache bRPC to version 1.15.0 or later

Patch / upgrade link (official source): https://github.com/apache/brpc/releases


Additional Hardening Steps

  • Disable heap profiling in production if not required
  • Restrict access to /pprof/* endpoints
  • Bind the profiling service to localhost only
  • Place bRPC services behind authenticated gateways
  • Run services with minimal OS privileges

Why This Vulnerability Matters

This is not a “theoretical” bug.

It is:

  • Easy to exploit
  • Hard to detect without proper logging
  • Capable of full system takeover
  • Likely to be targeted in automated scans

Any organization running bRPC should assume exploitation is possible until proven otherwise.