CVE-2020-5256: Remote Code Execution Through Image Uploads in BookStack
Impact
A user could upload PHP files through image upload functions, which would allow them to execute code on the host system remotely. They would then have the permissions of the PHP process.
This most impacts scenarios where non-trusted users are given permission to upload images in any area of the application.
Patches
The issue was addressed in a series of patches: v0.25.3, v0.25.4 and v0.25.5. Users should upgrade to at least v0.25.5 to avoid this patch but ideally the latest BookStack version as previous versions are un-supported.
Workarounds
Depending on BookStack version, you could use the localsecure image storage option, or use s3 or a similar compatible service.
Preventing direct execution of any php files, apart from the public/index.php file, though web-server configuration would also prevent this.
References
BookStack Beta v0.25.3 BookStack Beta v0.25.4 BookStack Beta v0.25.5
For more information
If you have any questions or comments about this advisory: Open an issue in the BookStack GitHub repository. Ask on the BookStack Discord chat. Follow the BookStack Security advise to contact someone privately.
Other sources
BookStack before version 0.25.5 has a vulnerability where a user could upload PHP files through image upload functions, which would allow them to execute code on the host system remotely. They would then have the permissions of the PHP process. This most impacts scenarios where non-trusted users are given permission to upload images in any area of the application. The issue was addressed in a series of patches in versions 0.25.3, 0.25.4 and 0.25.5. Users should upgrade to at least v0.25.5 to avoid this vulnerability.
— MITRE
Remote Code Execution Through Image Uploads in BookStack
— Packagist
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
composer/ssddanbrown/bookstackto a version that resolves this vulnerability.Fixed in 0.25.3 - Upgrade
Upgrade
composer/ssddanbrown/bookstackto a version that resolves this vulnerability.Fixed in 0.25.5 - Upgrade
Upgrade
BookStackto a version that resolves this vulnerability.Fixed in 0.25.5 - Configuration
Use the local_secure image storage option, or an S3-compatible storage service, depending on the BookStack version.
BookStack image storage image storage option = local_secure - Compensating control
Configure the web server to prevent direct execution of PHP files except public/index.php.
Event History
Frequently Asked Questions
What is CVE-2020-5256?
CVE-2020-5256 is a vulnerability in BookStack before version 0.25.5 that allows users to upload PHP files through image upload functions, enabling them to execute remote code on the host system.
What is the severity of CVE-2020-5256?
CVE-2020-5256 has a severity rating of critical with a CVSS score of 8.8.
How does CVE-2020-5256 impact non-trusted users?
CVE-2020-5256 most impacts scenarios where non-trusted users are present, as they have the potential to execute malicious code on the host system.
What is the affected software version for CVE-2020-5256?
BookStack versions up to and excluding 0.25.3 are affected by CVE-2020-5256.
How can I mitigate CVE-2020-5256?
To mitigate CVE-2020-5256, it is recommended to update BookStack to version 0.25.5 or above.