CVE-2021-37937 Overview
CVE-2021-37937 is a privilege escalation vulnerability discovered in Elastic Elasticsearch's Fleet-Server service account API key creation mechanism. The flaw allows API keys created with a service account to potentially be assigned higher privileges than intended. A compromised Fleet-Server service account could exploit this vulnerability to escalate privileges to super-user level, granting full administrative control over the Elasticsearch cluster.
Critical Impact
A compromised Fleet-Server service account can escalate privileges to super-user, potentially gaining complete control over the Elasticsearch cluster, including access to all indices, cluster settings, and security configurations.
Affected Products
- Elastic Elasticsearch (versions prior to 7.14.1)
Discovery Timeline
- 2023-11-22 - CVE-2021-37937 published to NVD
- 2024-11-21 - Last updated in NVD database
Technical Details for CVE-2021-37937
Vulnerability Analysis
This vulnerability stems from improper privilege management (CWE-269) in how Elasticsearch handles API key creation when initiated by the Fleet-Server service account. The core issue lies in the authorization logic that fails to properly constrain the privilege level of newly created API keys to match the permissions of the requesting service account.
When the Fleet-Server service account requests the creation of an API key through Elasticsearch's security API, the system does not adequately validate or restrict the privilege scope being assigned to that key. This allows an attacker who has compromised a Fleet-Server service account to craft API key creation requests that result in keys with elevated permissions—potentially achieving super-user access.
The attack requires initial access to a compromised Fleet-Server service account, making this a post-compromise escalation technique rather than an initial access vector.
Root Cause
The root cause is improper privilege management in the API key creation workflow for service accounts. The authorization boundary enforcement mechanism fails to ensure that service accounts can only create API keys with privileges equal to or lesser than their own assigned permissions. This architectural oversight allows privilege escalation through the API key subsystem.
Attack Vector
The attack is network-accessible and requires low-privilege authentication (a compromised Fleet-Server service account). An attacker with access to a Fleet-Server service account can interact with the Elasticsearch API over the network to create API keys with escalated privileges.
The exploitation flow involves:
- Attacker compromises a Fleet-Server service account through various means (credential theft, configuration exposure, etc.)
- Using the compromised service account credentials, the attacker makes API requests to create new API keys
- Due to the privilege validation flaw, the attacker can request and receive an API key with super-user privileges
- The attacker uses the elevated API key to perform administrative actions across the entire Elasticsearch cluster
Detection Methods for CVE-2021-37937
Indicators of Compromise
- Unusual API key creation activity from Fleet-Server service accounts
- API keys with super-user or elevated cluster privileges associated with service accounts
- Unexpected administrative operations performed using service account-derived API keys
- Audit log entries showing privilege escalation patterns from Fleet-Server contexts
Detection Strategies
- Monitor Elasticsearch audit logs for API key creation events from service accounts with elevated privilege requests
- Implement alerting on any API key creation that grants superuser role or cluster-admin privileges from non-admin accounts
- Review API key assignments periodically to identify keys with privileges exceeding their associated service account scope
- Enable Elasticsearch security logging and correlate with SIEM for anomalous service account behavior
Monitoring Recommendations
- Enable comprehensive audit logging for Elasticsearch security events including API key lifecycle operations
- Configure alerts for privilege escalation indicators such as service accounts creating administrative API keys
- Implement behavioral baselines for Fleet-Server service account activity to detect anomalies
- Monitor cluster security settings and role mappings for unauthorized modifications
How to Mitigate CVE-2021-37937
Immediate Actions Required
- Upgrade Elastic Stack to version 7.14.1 or later immediately
- Audit existing API keys associated with Fleet-Server service accounts for unexpected privilege levels
- Revoke and regenerate any potentially compromised API keys
- Review Fleet-Server service account configurations and limit network exposure
Patch Information
Elastic has addressed this vulnerability in Elastic Stack version 7.14.1. Organizations should upgrade to this version or later to remediate the privilege escalation issue. Detailed patch information is available in the Elastic Stack 7.14.1 Security Update Discussion. Additional security resources are available at the Elastic Community Security Portal.
Workarounds
- Restrict network access to Fleet-Server and Elasticsearch API endpoints using firewall rules or network segmentation
- Implement strict role-based access control (RBAC) and minimize service account privileges following the principle of least privilege
- Enable and monitor audit logging to detect potential exploitation attempts
- Consider temporarily disabling or rotating Fleet-Server service account credentials if compromise is suspected
# Example: Restrict API access via Elasticsearch configuration
# Add to elasticsearch.yml to limit allowed API paths for service accounts
xpack.security.authc.api_key.enabled: true
xpack.security.audit.enabled: true
xpack.security.audit.logfile.events.include: ["authentication_success", "authentication_failed", "access_granted", "access_denied", "run_as_granted", "run_as_denied"]
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


