CVE-2024-51998: Changedetection.io Path Traversal Vulnerability

HIGH
Advisory Identifier: GHSA-6jrf-rcjf-245r
CVSS 8.6
CWE-22
Published
Advisory Summary

CVE-2024-51998 is a HIGH (CVSS 8.6) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Changedetection.io libraries in the PyPI ecosystem. The issue involves changedetection.io path traversal using file uri scheme without supplying hostname. Remediation is available by upgrading affected packages to version 0.47.6.

CVE-2024-51998 at a Glance

CVE Identifier CVE-2024-51998
GHSA Identifier GHSA-6jrf-rcjf-245r
Severity HIGH
CVSS v3.1 Base Score 8.6
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Changedetection.io
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.6

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2024-51998

To remediate this vulnerability, upgrade all affected Changedetection.io dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

changedetection.io fixed: 0.47.6
pip install changedetection.io>=0.47.6
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show changedetection.io

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2024-51998, inspect your installed packages using pip:

pip show changedetection.io

Analyze the terminal output to locate any version of Changedetection.io in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.47.6), your application is affected.

Note: The pip show changedetection.io command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Changedetection.io, 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

### Summary The validation for the file URI scheme falls short, and results in an attacker being able to read any file on the system. This issue only affects instances with a webdriver enabled, and `ALLOW_FILE_URI` false or not defined. ### Details The check used for URL protocol, `is_safe_url`, allows `file:` as a URL scheme: https://github.com/dgtlmoon/changedetection.io/blob/e0abf0b50507a8a3d0c1d8522ab23519b3e4cdf4/changedetectionio/model/Watch.py#L11-L13 It later checks if local files are permitted, but one of the preconditions for the check is that the URL starts with `file://`. The issue comes with the fact that the file URI scheme is not required to have double slashes. > A valid file URI must therefore begin with either `file:/path` (no hostname), `file:///path` (empty hostname), or `file://hostname/path`. > — [Wikipedia](https://en.wikipedia.org/wiki/File_URI_scheme#Number_of_slash_characters) https://github.com/dgtlmoon/changedetection.io/blob/e0abf0b50507a8a3d0c1d8522ab23519b3e4cdf4/changedetectionio/processors/__init__.py#L37-L41 ### PoC 1. Open up a changedetection.io instance with a webdriver configured 2. Create a new watch: `file:/etc/passwd` or a similar path for your operating system. Enable webdriver mode 3. Wait for it to be checked 4. Open preview 5. Notice contents of the file

CVE-2024-51998 Affected Changedetection.io Versions

1 component(s)
Fixed Versions:
0.47.6
Product / Package Ecosystem Affected Versions Fixed Version
changedetection.io
PyPI
< 0.47.6
0.47.6

References

Frequently Asked Questions

What is CVE-2024-51998?
CVE-2024-51998 is a security vulnerability in Changedetection.io involving changedetection.io path traversal using file URI scheme without supplying hostname under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Changedetection.io versions are affected?
Affected versions include releases prior to 0.47.6 across affected packages: changedetection.io.
What version fixes CVE-2024-51998?
Upgrading to 0.47.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is changedetection.io affected?
Yes, changedetection.io is affected in releases prior to 0.47.6. Upgrade your dependency to 0.47.6 or later.
What is the CVSS score of CVE-2024-51998?
CVE-2024-51998 has a CVSS v3.1 base score of 8.6 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N.
What CWE is associated with CVE-2024-51998?
CVE-2024-51998 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check PyPI dependencies for CVE-2024-51998?
Run the dependency tree command: 'pip show changedetection.io'. 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-6jrf-rcjf-245r",
  "modified" : "2024-11-08T13:55:31Z",
  "published" : "2024-11-07T22:00:58Z",
  "aliases" : [ "CVE-2024-51998" ],
  "summary" : "changedetection.io path traversal using file URI scheme without supplying hostname",
  "details" : "### Summary\n\nThe validation for the file URI scheme falls short, and results in an attacker being able to read any file on the system. This issue only affects instances with a webdriver enabled, and `ALLOW_FILE_URI` false or not defined.\n\n### Details\n\nThe check used for URL protocol, `is_safe_url`, allows `file:` as a URL scheme:\n\nhttps://github.com/dgtlmoon/changedetection.io/blob/e0abf0b50507a8a3d0c1d8522ab23519b3e4cdf4/changedetectionio/model/Watch.py#L11-L13\n\nIt later checks if local files are permitted, but one of the preconditions for the check is that the URL starts with `file://`. The issue comes with the fact that the file URI scheme is not required to have double slashes.\n\n> A valid file URI must therefore begin with either `file:/path` (no hostname), `file:///path` (empty hostname), or `file://hostname/path`.\n> — [Wikipedia](https://en.wikipedia.org/wiki/File_URI_scheme#Number_of_slash_characters)\n\nhttps://github.com/dgtlmoon/changedetection.io/blob/e0abf0b50507a8a3d0c1d8522ab23519b3e4cdf4/changedetectionio/processors/__init__.py#L37-L41\n\n### PoC\n\n1. Open up a changedetection.io instance with a webdriver configured\n2. Create a new watch: `file:/etc/passwd` or a similar path for your operating system. Enable webdriver mode\n3. Wait for it to be checked\n4. Open preview\n5. Notice contents of the file\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:H/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "changedetection.io"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.47.6"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.47.5"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/dgtlmoon/changedetection.io/security/advisories/GHSA-6jrf-rcjf-245r"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-51998"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dgtlmoon/changedetection.io/commit/49bc982c697169c98b79698889fb9d26f6b3317f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/dgtlmoon/changedetection.io"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dgtlmoon/changedetection.io/blob/e0abf0b50507a8a3d0c1d8522ab23519b3e4cdf4/changedetectionio/model/Watch.py#L11-L13"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dgtlmoon/changedetection.io/blob/e0abf0b50507a8a3d0c1d8522ab23519b3e4cdf4/changedetectionio/processors/__init__.py#L37-L41"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dgtlmoon/changedetection.io/releases/tag/0.47.06"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-11-07T22:00:58Z",
    "nvd_published_at" : "2024-11-08T00:15:15Z"
  }
}