Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2022-51020 Overview
CVE-2022-51020 is a Cross-Site Request Forgery (CSRF) vulnerability [CWE-352] in Flower, the web-based monitoring tool for Celery distributed task queues. Versions before 2.2.0 disable Tornado's xsrf_cookies protection and issue OAuth session cookies without a SameSite attribute. An attacker can lure an authenticated Flower user to a malicious page that silently issues POST requests to control-plane endpoints. These requests can shut down Celery workers, resize process pools, and revoke queued tasks, disrupting any workload orchestrated through Flower.
Critical Impact
Authenticated Flower sessions can be abused across origins to shut down Celery workers via /api/worker/shutdown, restart pools via /api/worker/pool/restart, and cancel tasks via /api/task/revoke, causing denial of service to downstream task processing.
Affected Products
- Flower (Celery monitoring web application) versions prior to 2.2.0
- Deployments using OAuth or cookie-based authentication in Flower
- Celery clusters monitored by vulnerable Flower instances
Discovery Timeline
- 2026-10-12 - CVE-2022-51020 published to NVD
- 2026-10-16 - Last updated in NVD database
Technical Details for CVE-2022-51020
Vulnerability Analysis
Flower exposes a Tornado-based HTTP API for monitoring and controlling Celery workers. The control API handlers in flower/api/control.py accept state-changing POST requests but do not require any CSRF token. Tornado offers built-in CSRF protection through its xsrf_cookies setting, but Flower leaves this disabled in its application configuration prior to version 2.2.0.
Compounding the issue, the OAuth session cookie is set without a SameSite attribute. Modern browsers therefore attach the cookie to cross-site POST requests, allowing a malicious page to perform authenticated actions on behalf of the victim. Any logged-in Flower administrator who visits attacker-controlled content can trigger worker shutdown, pool resize, or task revocation.
Root Cause
The root cause is a combination of two configuration defects. First, the Tornado application was instantiated without xsrf_cookies=True, so no synchronizer token was required on state-changing requests. Second, Flower's set_secure_cookie call did not specify samesite or httponly, leaving the session cookie eligible for cross-site transmission and accessible to JavaScript. See the Flower control API code and the VulnCheck advisory for Flower for additional context.
Attack Vector
An attacker crafts an HTML page containing an auto-submitting form or fetch() call that targets a Flower endpoint such as /api/worker/shutdown. When an authenticated administrator loads the page, the browser attaches the Flower session cookie and the request is processed as legitimate. The attacker needs no credentials, only knowledge of the Flower URL and a method of luring the victim.
# Patch: flower/urls.py - Enable Tornado XSRF protection
cookie_secret=gen_cookie_secret(),
static_url_prefix='/static/',
login_url='/login',
+ xsrf_cookies=True,
)
Source: GitHub Flower Commit a14408b1
# Patch: flower/views/__init__.py - Harden session cookie attributes
return
super().check_xsrf_cookie()
+def set_secure_cookie(self, name, value, expires_days=30, version=None, **kwargs):
+ kwargs.setdefault('httponly', True)
+ kwargs.setdefault('samesite', 'Lax')
+ super().set_secure_cookie(name, value, expires_days, version, **kwargs)
+
def log_exception(self, typ, value, tb):
# OAuth failures are user errors, not server faults
if isinstance(value, tornado.auth.AuthError):
Source: GitHub Flower Commit 3b2115af
Detection Methods for CVE-2022-51020
Indicators of Compromise
- Unexpected POST requests to /api/worker/shutdown, /api/worker/pool/restart, or /api/task/revoke in Flower access logs.
- HTTP Referer or Origin headers on Flower control requests that do not match the Flower server's own hostname.
- Celery worker processes terminating without a corresponding administrator action in change-management records.
- Sudden spikes in revoked tasks or pool restart events that align with user web browsing activity.
Detection Strategies
- Parse Flower and reverse proxy logs for state-changing requests whose Origin or Referer headers reference external domains.
- Correlate Celery worker lifecycle events with authenticated user sessions to identify requests that originate from a browser context rather than operator tooling.
- Flag any Flower control-plane POST request that arrives without an X-XSRFToken header after the patch is deployed.
Monitoring Recommendations
- Forward Flower application logs and upstream reverse proxy logs into a centralized logging platform for retention and query.
- Alert on anomalous rates of /api/worker/* and /api/task/* activity, particularly outside normal operations hours.
- Monitor Celery broker metrics (queue depth, worker count) for abrupt changes that may indicate task revocation or worker shutdown abuse.
How to Mitigate CVE-2022-51020
Immediate Actions Required
- Upgrade Flower to version 2.2.0 or later, which enables xsrf_cookies=True and sets HttpOnly and SameSite=Lax on session cookies.
- Restrict network exposure of the Flower UI to trusted management networks or VPN segments.
- Terminate active Flower sessions and require re-authentication after upgrading to invalidate cookies issued without SameSite.
Patch Information
The fix landed in two upstream commits. Commit a14408b1 enables Tornado's XSRF protection and updates the client-side JavaScript to attach X-XSRFToken headers on non-idempotent requests. Commit 3b2115af sets HttpOnly and SameSite=Lax on secure cookies. Both are included in Flower 2.2.0. See Flower issue #1217 for background.
Workarounds
- Place Flower behind a reverse proxy that enforces strict Origin and Referer header validation for state-changing requests.
- Require an additional authentication layer such as mutual TLS or an identity-aware proxy in front of Flower.
- Block external access to /api/worker/shutdown, /api/worker/pool/restart, and /api/task/revoke at the proxy layer when operator automation does not require them.
# nginx example: enforce same-origin for Flower control API
location ~ ^/api/(worker|task)/ {
if ($request_method !~ ^(GET|HEAD|OPTIONS)$) {
if ($http_origin !~ "^https://flower\.internal\.example\.com$") {
return 403;
}
}
proxy_pass http://flower_upstream;
}
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

