CVE-2020-5256: Ssddanbrown/bookstack Remote Code Execution Vulnerability
HIGHCVE-2020-5256 is a HIGH (CVSS 7.9) remote code execution vulnerability (CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection')) affecting Ssddanbrown/bookstack libraries in the Packagist ecosystem. The issue involves remote code execution through image uploads in bookstack. Remediation is available by upgrading affected packages to version 0.25.5.
CVE-2020-5256 at a Glance
Security Impact
CVSS: 7.9
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:L).
How to Fix CVE-2020-5256
To remediate this vulnerability, upgrade all affected Ssddanbrown/bookstack dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade ssddanbrown/bookstack to 0.25.5
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for ssddanbrown/bookstack
How to Check if You Are Affected
To determine whether your application is affected by CVE-2020-5256, inspect your project dependencies for Ssddanbrown/bookstack:
inspect dependencies for ssddanbrown/bookstack
Analyze the terminal output to locate any version of Ssddanbrown/bookstack in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.25.5), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection'), where the product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes code syntax before using the input in a dynamic evaluation call (e.g. "eval"). In Ssddanbrown/bookstack, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2020-5256 Affected Ssddanbrown/bookstack Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
ssddanbrown/bookstack
|
Packagist |
< 0.25.5
|
0.25.5
|
References
Frequently Asked Questions
What is CVE-2020-5256?
Which Ssddanbrown/bookstack versions are affected?
What version fixes CVE-2020-5256?
Is ssddanbrown/bookstack affected?
What is the CVSS score of CVE-2020-5256?
What CWE is associated with CVE-2020-5256?
How can I check Packagist dependencies for CVE-2020-5256?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-g9rq-x4fj-f5hx",
"modified" : "2021-01-08T21:18:55Z",
"published" : "2020-03-13T20:21:27Z",
"aliases" : [ "CVE-2020-5256" ],
"summary" : "Remote Code Execution Through Image Uploads in BookStack",
"details" : "### Impact\n\nA 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.\n\nThis most impacts scenarios where non-trusted users are given permission to upload images in any area of the application. \n\n### Patches\n\nThe issue was addressed in a series of patches: v0.25.3, v0.25.4 and v0.25.5.\nUsers should upgrade to at least v0.25.5 to avoid this patch but ideally the latest BookStack version as previous versions are un-supported.\n\n### Workarounds\n\nDepending on BookStack version, you could use the [local_secure](https://www.bookstackapp.com/docs/admin/upload-config/#local-secure) image storage option, or use s3 or a similar compatible service.\n\nPreventing direct execution of any `php` files, apart from the `public/index.php` file, though web-server configuration would also prevent this.\n\n### References\n\n[BookStack Beta v0.25.3](https://github.com/BookStackApp/BookStack/releases/tag/v0.25.3)\n[BookStack Beta v0.25.4](https://github.com/BookStackApp/BookStack/releases/tag/v0.25.4)\n[BookStack Beta v0.25.5](https://github.com/BookStackApp/BookStack/releases/tag/v0.25.5)\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Open an issue in [the BookStack GitHub repository](BookStackApp/BookStack/issues).\n* Ask on the [BookStack Discord chat](https://discord.gg/ztkBqR2).\n* Follow the [BookStack Security advise](https://github.com/BookStackApp/BookStack#-security) to contact someone privately.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "ssddanbrown/bookstack"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.25.5"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "< 0.25.3"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/BookStackApp/BookStack/security/advisories/GHSA-g9rq-x4fj-f5hx"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-5256"
}, {
"type" : "WEB",
"url" : "https://github.com/BookStackApp/BookStack/releases/tag/v0.25.3"
}, {
"type" : "WEB",
"url" : "https://github.com/BookStackApp/BookStack/releases/tag/v0.25.4"
}, {
"type" : "WEB",
"url" : "https://github.com/BookStackApp/BookStack/releases/tag/v0.25.5"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-95" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2020-03-13T20:20:25Z",
"nvd_published_at" : null
}
}