Headline
CVE-2022-36065: Secure file uploads when NODE_ENV=dev by jdorn · Pull Request #487 · growthbook/growthbook
GrowthBook is an open-source platform for feature flagging and A/B testing. With some self-hosted configurations in versions prior to 2022-08-29, attackers can register new accounts and upload files to arbitrary directories within the container. If the attacker uploads a Python script to the right location, they can execute arbitrary code within the container. To be affected, ALL of the following must be true: Self-hosted deployment (GrowthBook Cloud is unaffected); using local file uploads (as opposed to S3 or Google Cloud Storage); NODE_ENV set to a non-production value and JWT_SECRET set to an easily guessable string like dev. This issue is patched in commit 1a5edff8786d141161bf880c2fd9ccbe2850a264 (2022-08-29). As a workaround, set JWT_SECRET environment variable to a long random string. This will stop arbitrary file uploads, but the only way to stop attackers from registering accounts is by updating to the latest build.
If a user fails to set NODE_ENV=production, our built-in security checks are disabled and it’s possible to misconfigure GrowthBook and leave the file upload API endpoint open to attack.
To be affected, ALL of the following must be true
- Self-hosted (GrowthBook Cloud is unaffected)
- GrowthBook API exposed to the internet
- Using local file uploads (as opposed to S3 or Google Cloud Storage)
- NODE_ENV set to a non-production value
- JWT_SECRET set to the default “dev” string
To solve these security vulnerabilities, this PR makes 3 changes:
- Add more protection around the fileUpload API endpoint (protect against directory traversal, etc.)
- Only disable built-in security checks if the domain is still localhost (in case someone forgets to update NODE_ENV)
- Add an extra sanity check to the first-time register API endpoint
What should you do if you are potentially affected:
- Update to the latest GrowthBook version
- Make sure NODE_ENV is set to “production”
- Set the JWT_SECRET environment variable to a long random string