CVE-2020-6950 (published 2021-06-02T16:15Z)

Directory traversal in Eclipse Mojarra before 2.3.14 allows attackers to read arbitrary files via the loc parameter or con parameter.

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

Weakness information:
cwe_id: CWE-22
cwe_name: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
description: 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.
extended_description: 
            Many file operations are intended to take place within a restricted directory. By using special elements such as ".." and "/" separators, attackers can escape outside of the restricted location to access files or directories that are elsewhere on the system. One of the most common special elements is the "../" sequence, which in most modern operating systems is interpreted as the parent directory of the current location. This is referred to as relative path traversal. Path traversal also covers the use of absolute pathnames such as "/usr/local/bin" to access unexpected files. This is referred to as absolute path traversal.
         
         

Fix information:
repo_url: https://github.com/eclipse-ee4j/mojarra
commit_details: repo_url: https://github.com/eclipse-ee4j/mojarra
author: ruolli
author_date: 2019-09-05 16:12:40+08:00
msg: Multiple Path Traversal security issues
repository: repo_url: https://github.com/eclipse-ee4j/mojarra
repo_name: eclipse-ee4j/mojarra
description: Mojarra, a Jakarta Faces implementation
repo_language: Java
owner: eclipse-ee4j
file_changes: filename: ClasspathResourceHelper.java
change_type: ModificationType.MODIFY
diff: @@ -355,7 +355,7 @@ public class ClasspathResourceHelper extends ResourceHelper {
         } else if (root == null) {
             String contractName = ctx.getExternalContext().getRequestParameterMap()
                   .get("con");
-            if (null != contractName && 0 < contractName.length()) {
+            if (null != contractName && 0 < contractName.length() && !ResourceManager.nameContainsForbiddenSequence(contractName)) {
                 contracts = new ArrayList<>();
                 contracts.add(contractName);
             } else {

programming_language: Java
filename: ResourceManager.java
change_type: ModificationType.MODIFY
diff: @@ -351,7 +351,7 @@ public class ResourceManager {
         }
     }
     
-    private static boolean nameContainsForbiddenSequence(String name) {
+    static boolean nameContainsForbiddenSequence(String name) {
         boolean result = false;
         if (name != null) {
             name = name.toLowerCase();
@@ -567,6 +567,8 @@ public class ResourceManager {
         
         if(localePrefix != null && !nameContainsForbiddenSequence(localePrefix)){
             return localePrefix;
+        } else {
+            localePrefix = null; 
         }
         
         String appBundleName = context.getApplication().getMessageBundle();

programming_language: Java
filename: WebappResourceHelper.java
change_type: ModificationType.MODIFY
diff: @@ -315,7 +315,7 @@ public class WebappResourceHelper extends ResourceHelper {
         } else if (root == null) {
             String contractName = ctx.getExternalContext().getRequestParameterMap()
                   .get("con");
-            if (null != contractName && 0 < contractName.length()) {
+            if (null != contractName && 0 < contractName.length() && !ResourceManager.nameContainsForbiddenSequence(contractName)) {
                 contracts = new ArrayList<>();
                 contracts.add(contractName);
             } else {

programming_language: Java