CVE-2023-40028 (published 2023-08-15T18:15Z)

Ghost is an open source content management system. Versions prior to 5.59.1 are subject to a vulnerability which allows authenticated users to upload files that are symlinks. This can be exploited to perform an arbitrary file read of any file on the host operating system. Site administrators can check for exploitation of this issue by looking for unknown symlinks within Ghost's `content/` folder. Version 5.59.1 contains a fix for this issue. All users are advised to upgrade. There are no known workarounds for this vulnerability.

CVSS v3 base score: 6.5, MEDIUM (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N)

Weakness information:
cwe_id: CWE-59
cwe_name: Improper Link Resolution Before File Access ('Link Following')
description: The product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource.
extended_description: 
            
            
         
         

Fix information:
repo_url: https://github.com/TryGhost/Ghost
commit_details: repo_url: https://github.com/TryGhost/Ghost
author: Simon Backx
author_date: 2023-08-15 12:59:45+02:00
msg: 🔒 Fixed arbitrary file read via symlinks in content import

refs https://github.com/TryGhost/Product/issues/3726
refs https://github.com/TryGhost/Ghost/security/advisories/GHSA-9c9v-w225-v5rg

- credits to https://github.com/ixSly
repository: repo_url: https://github.com/TryGhost/Ghost
repo_name: TryGhost/Ghost
description: Independent technology for modern publishing, memberships, subscriptions and newsletters.
repo_language: JavaScript
owner: TryGhost
file_changes: filename: package.json
change_type: ModificationType.MODIFY
diff: @@ -160,7 +160,7 @@
     "@tryghost/verification-trigger": "0.0.0",
     "@tryghost/version": "0.1.22",
     "@tryghost/webmentions": "0.0.0",
-    "@tryghost/zip": "1.1.34",
+    "@tryghost/zip": "1.1.37",
     "amperize": "0.6.1",
     "analytics-node": "6.2.0",
     "bluebird": "3.7.2",

programming_language: JavaScript
filename: db.test.js
change_type: ModificationType.MODIFY
diff: @@ -377,6 +377,15 @@ describe('DB API', function () {
         yearlyPrice.get('stripe_price_id').should.equal('price_d04baebb73');
         yearlyPrice.get('stripe_product_id').should.equal('prod_d2c1708c21');
     });
+
+    it('Can not import a ZIP-file with symlinks', async function () {
+        await request.post(localUtils.API.getApiQuery('db/'))
+            .set('Origin', config.get('url'))
+            .set('Accept', 'application/json')
+            .expect('Content-Type', /json/)
+            .attach('importfile', path.join(__dirname, '/../../../utils/fixtures/import/symlinks.zip'))
+            .expect(415);
+    });
 });
 
 // The following tests will create a new clean database for every test

programming_language: JavaScript
filename: yarn.lock
change_type: ModificationType.MODIFY
diff: @@ -7173,15 +7173,6 @@
   dependencies:
     p-wait-for "3.2.0"
 
-"@tryghost/zip@1.1.34":
-  version "1.1.34"
-  resolved "https://registry.yarnpkg.com/@tryghost/zip/-/zip-1.1.34.tgz#c8ab1ac3bb5bc780f29c63723d3933f345f0ec65"
-  integrity sha512-tfv1Lcd46/W0AkbBj/ttZLCdqI1LQppvkVQ7l5+gSx2ZOHqnZmkoKwMOB0J/LxEEC1TzhqrW0Vzx+ZYtoPACzA==
-  dependencies:
-    archiver "^5.0.0"
-    extract-zip "^2.0.1"
-    fs-extra "^10.0.0"
-
 "@tryghost/zip@1.1.35":
   version "1.1.35"
   resolved "https://registry.yarnpkg.com/@tryghost/zip/-/zip-1.1.35.tgz#654239d0b48f2baac5679cec2930937b825c2f84"
@@ -7191,6 +7182,16 @@
     extract-zip "^2.0.1"
     fs-extra "^10.0.0"
 
+"@tryghost/zip@1.1.37":
+  version "1.1.37"
+  resolved "https://registry.yarnpkg.com/@tryghost/zip/-/zip-1.1.37.tgz#55ca424a42615d0e53aa12b2b108e7f20ac36b42"
+  integrity sha512-L+MKGsbIgHgEeoiq6lLpirNflp8CX89xDSwBRucHR/T+QLwVgnof+aiTTuaTrrF+pOWetBDTvB/gN5t94+k6hA==
+  dependencies:
+    "@tryghost/errors" "^1.2.26"
+    archiver "^5.0.0"
+    extract-zip "^2.0.1"
+    fs-extra "^11.0.0"
+
 "@trysound/sax@0.2.0":
   version "0.2.0"
   resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad"

programming_language: Markdown