Open-Source Security Intelligence

Know every vulnerability
before it knows you.

DevGuard continuously monitors your dependencies and alerts you when CVEs like this one affect your stack — with real-time threat intelligence built for developers.

Search

GHSA-cfqx-f43m-vfh7

MediumCVSS 4.9 / 10
Published Oct 3, 2024·Last modified Oct 3, 2024
Affected Components(0)

No affected components available

Description

Summary

A user with admin permission can read arbitrary file and directory names on the filesystem by calling the admin/build-mobile-app/result?build_dir_name= endpoint. The build_dir_name parameter is not properly validated and it's then used to construct the buildDir that is read. The file/directory names under the buildDir will be returned.

Details

  • file: https://github.com/saltcorn/saltcorn/blob/v1.0.0-beta.13/packages/server/routes/admin.js#L2884-L2893
router.get(
  "/build-mobile-app/result",
  isAdmin,
  error_catcher(async (req, res) => {
    const { build_dir_name } = req.query; // [1] source
    const rootFolder = await File.rootFolder();
    const buildDir = path.join(
      rootFolder.location,
      "mobile_app",
      build_dir_name // [2]
    );
    const files = await Promise.all(
      fs
        .readdirSync(buildDir) // [3] sink
        .map(async (outFile) => await File.from_file_on_disk(outFile, buildDir))
    );
    [...]
  })
);

PoC

  • log into the application as an admin user
  • visit the following url: http://localhost:3000/admin/build-mobile-app/result?build_dir_name=/../../../../../../../../

NOTE: it's possible to only see file and directory names but not to download their content.

Impact

Information disclosure

Recommended Mitigation

Resolve the buildDir and check if it starts with ${rootFolder.location}/mobile_app.

Risk Scores
Base Score
4.9

The vulnerability can be exploited over the network without needing physical access. It is easy for an attacker to exploit this vulnerability. An attacker needs high-level or administrative privileges. No user interaction is needed for the attacker to exploit this vulnerability. The impact is confined to the system where the vulnerability exists. There is a high impact on the confidentiality of the information.

Threat Intelligence
4.5

Exploitation attempts have been detected. Elevated vigilance and prompt remediation are advised.

EPSS
N/A

Probability that this vulnerability will be exploited in the wild within the next 30 days.

Exploit
Not available

We did not find any exploit available. Neither in GitHub repositories nor in the Exploit-Database.

Browse More

Scan your project

Continuously monitor your dependencies and get alerted when vulnerabilities like this one affect your stack.

Checkout DevGuard