CVE-2020-5256: Ssddanbrown/bookstack Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-g9rq-x4fj-f5hx
CVSS 7.9
CWE-95
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2020-5256
GHSA Identifier GHSA-g9rq-x4fj-f5hx
Severity HIGH
CVSS v3.1 Base Score 7.9
CWE Classification CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection')
Affected Product Ssddanbrown/bookstack
Package Ecosystem Packagist
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability Low (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.

ssddanbrown/bookstack fixed: 0.25.5
Upgrade ssddanbrown/bookstack to 0.25.5
Verify Direct and Transitive Dependencies

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

### 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 [local_secure](https://www.bookstackapp.com/docs/admin/upload-config/#local-secure) 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](https://github.com/BookStackApp/BookStack/releases/tag/v0.25.3) [BookStack Beta v0.25.4](https://github.com/BookStackApp/BookStack/releases/tag/v0.25.4) [BookStack Beta v0.25.5](https://github.com/BookStackApp/BookStack/releases/tag/v0.25.5) ### For more information If you have any questions or comments about this advisory: * Open an issue in [the BookStack GitHub repository](BookStackApp/BookStack/issues). * Ask on the [BookStack Discord chat](https://discord.gg/ztkBqR2). * Follow the [BookStack Security advise](https://github.com/BookStackApp/BookStack#-security) to contact someone privately.

CVE-2020-5256 Affected Ssddanbrown/bookstack Versions

1 component(s)
Fixed Versions:
0.25.5
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?
CVE-2020-5256 is a security vulnerability in Ssddanbrown/bookstack involving Remote Code Execution Through Image Uploads in BookStack under CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection').
Which Ssddanbrown/bookstack versions are affected?
Affected versions include releases prior to 0.25.5 across affected packages: ssddanbrown/bookstack.
What version fixes CVE-2020-5256?
Upgrading to 0.25.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ssddanbrown/bookstack affected?
Yes, ssddanbrown/bookstack is affected in releases prior to 0.25.5. Upgrade your dependency to 0.25.5 or later.
What is the CVSS score of CVE-2020-5256?
CVE-2020-5256 has a CVSS v3.1 base score of 7.9 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:L.
What CWE is associated with CVE-2020-5256?
CVE-2020-5256 is classified under CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection') (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").).
How can I check Packagist dependencies for CVE-2020-5256?
Run the dependency tree command: 'inspect dependencies for ssddanbrown/bookstack'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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
  }
}