{"id":849,"cve":"CVE-2023-45813","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2023-45813","cwe":"CWE-1333 Inefficient Regular Expression Complexity","cwe_number":1333,"cwe_url":"https:\/\/cwe.mitre.org\/data\/definitions\/1333","cvss_score":7.5,"published":"2023-10-18","owasp":"A06 Vulnerable and Outdated Components","odc":"Function","cdc":"Incorrect Functionality","category":"Resource Management","subcategory":"Resource Exhaustion","scope":"Remote","impact":"Denial of Service (DoS)","summary":"Torbot Exponential regex DoS in validate_link","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2023-45813\/","description":"Torbot is an open source tor network intelligence tool. In affected versions the `torbot.modules.validators.validate_link function` uses the python-validators URL validation regex. This particular regular expression has an exponential complexity which allows an attacker to cause an application crash using a well-crafted argument. An attacker can use a well-crafted URL argument to exploit the vulnerability in the regular expression and cause a Denial of Service on the system. The validators file has been removed in version 4.0.0. Users are advised to upgrade. There are no known workarounds for this vulnerability.","solution":"Update Torbot to version 4.0.0 or higher.","affected_component":"python-validators","fixed_by_upgrading":true,"vulnerable_code":"import validators\n\ndef validate_link(url):\n    return validators.url(url)\n\nurl_to_test = \"http:\/\/example.com\"\nif validate_link(url_to_test):\n    print(\"Valid URL\")\nelse:\n    print(\"Invalid URL\")","patched_code":"import re\n\ndef validate_link(url):\n    pattern = re.compile(\n        r'^(https?:\/\/)?(www\\.)?([a-zA-Z0-9-]+(\\.[a-zA-Z]{2,})+)(:[0-9]{1,5})?(\/.*)?$'\n    )\n    return bool(pattern.match(url))\n\nurl_to_test = \"http:\/\/example.com\"\nif validate_link(url_to_test):\n    print(\"Valid URL\")\nelse:\n    print(\"Invalid URL\")","payload_needed":false,"payload":null,"payload_status":"none","published_fix":[],"references":null}