Stored Command Injection Affecting celery package, versions [,5.2.2)



    Attack Complexity High
    Privileges Required High
    Confidentiality High
    Integrity High
    Availability High

    Threat Intelligence

    Exploit Maturity Proof of concept
    EPSS 0.12% (45th percentile)
Expand this section
7.5 high
Expand this section
Red Hat
8 high

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-PYTHON-CELERY-2314953
  • published 29 Dec 2021
  • disclosed 9 Dec 2021
  • credit Calum Hutton from Snyk Research Team

How to fix?

Upgrade celery to version 5.2.2 or higher.


Affected versions of this package are vulnerable to Stored Command Injection. It by default trusts the messages and metadata stored in backends (result stores). When reading task metadata from the backend, the data is deserialized. Given that an attacker can gain access to, or somehow manipulate the metadata within a celery backend, they could trigger a stored command injection vulnerability and potentially gain further access to the system.


Example of modified metadata as stored in the result stores:

'status': 'FAILURE',
'result': json.dumps({
  'exc_module': 'os',
  'exc_type': 'system',
  'exc_message': 'id'

Reproduction steps in a Python shell:

from celery.backends.base import Backend
from celery import Celery
b = Backend(Celery())
exc = {'exc_module':'os',  'exc_type':'system', 'exc_message':'id'}

The result would be an output of os.system('id').