CVE-2021-29506 (published 2021-05-13T19:15Z)

GraphHopper is an open-source Java routing engine. In GrassHopper from version 2.0 and before version 2.4, there is a regular expression injection vulnerability that may lead to Denial of Service. This has been patched in 2.4 and 3.0 See this pull request for the fix: https://github.com/graphhopper/graphhopper/pull/2304

Severity: MEDIUM
CVSS v2 base score: 4.0 (AV:N/AC:L/Au:S/C:N/I:N/A:P)
CVSS v3 base score: 6.5, MEDIUM (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H)

Weakness information:
cwe_id: CWE-400
cwe_name: Uncontrolled Resource Consumption
description: The product does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
extended_description: 
            Limited resources include memory, file system storage, database connection pool entries, and CPU. If an attacker can trigger the allocation of these limited resources, but the number or size of the resources is not controlled, then the attacker could cause a denial of service that consumes all available resources. This would prevent valid users from accessing the product, and it could potentially have an impact on the surrounding environment. For example, a memory exhaustion attack against an application could slow down the application as well as its host operating system.
            There are at least three distinct scenarios which can commonly lead to resource exhaustion:
               
                  Lack of throttling for the number of allocated resources
                  Losing all references to a resource before reaching the shutdown stage
                  Not closing/returning a resource after processing
               
            Resource exhaustion problems are often result due to an incorrect implementation of the following situations:
               
                  Error conditions and other exceptional circumstances.
                  Confusion over which part of the program is responsible for releasing the resource.
               
         
         

Fix information:
repo_url: https://github.com/graphhopper/graphhopper
commit_details: repo_url: https://github.com/graphhopper/graphhopper
author: Peter
author_date: 2021-05-04 20:03:31+02:00
msg: avoid regex in navigate module (#2304)

* replace two regexs with one indexOf

* make check stricter

* use @easbar's suggestion
repository: repo_url: https://github.com/graphhopper/graphhopper
repo_name: graphhopper/graphhopper
description: Open source routing engine for OpenStreetMap. Use it as Java library or standalone web server.
repo_language: Java
owner: graphhopper
file_changes: filename: NavigateResource.java
change_type: ModificationType.MODIFY
diff: @@ -188,13 +188,11 @@ public class NavigateResource {
      * The url looks like: ".../{profile}/1.522438,42.504606;1.527209,42.504776;1.526113,42.505144;1.527218,42.50529?.."
      */
     private List<GHPoint> getPointsFromRequest(HttpServletRequest httpServletRequest, String profile) {
-
         String url = httpServletRequest.getRequestURI();
-        url = url.replaceFirst("/navigate/directions/v5/gh/" + profile + "/", "");
-        url = url.replaceAll("\\?[*]", "");
-
+        String urlStart = "/navigate/directions/v5/gh/" + profile + "/";
+        if (!url.startsWith(urlStart)) throw new IllegalArgumentException("Incorrect URL " + url);
+        url = url.substring(urlStart.length());
         String[] pointStrings = url.split(";");
-
         List<GHPoint> points = new ArrayList<>(pointStrings.length);
         for (int i = 0; i < pointStrings.length; i++) {
             points.add(GHPoint.fromStringLonLat(pointStrings[i]));

programming_language: Java