CVE-2018-25097 (published 2024-01-02T16:15Z)

A vulnerability, which was classified as problematic, was found in Acumos Design Studio up to 2.0.7. Affected is an unknown function. The manipulation leads to cross site scripting. It is possible to launch the attack remotely. Upgrading to version 2.0.8 is able to address this issue. The name of the patch is 0df8a5e8722188744973168648e4c74c69ce67fd. It is recommended to upgrade the affected component. The identifier of this vulnerability is VDB-249420.

CVSS v3 base score: 6.1, MEDIUM (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N)

Weakness information:
cwe_id: CWE-79
cwe_name: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
description: The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
extended_description: 
            Cross-site scripting (XSS) vulnerabilities occur when:
            
               Untrusted data enters a web application, typically from a web request.
               The web application dynamically generates a web page that contains this untrusted data.
               During page generation, the application does not prevent the data from containing content that is executable by a web browser, such as JavaScript, HTML tags, HTML attributes, mouse events, Flash, ActiveX, etc.
               A victim visits the generated web page through a web browser, which contains malicious script that was injected using the untrusted data.
               Since the script comes from a web page that was sent by the web server, the victim's web browser executes the malicious script in the context of the web server's domain.
               This effectively violates the intention of the web browser's same-origin policy, which states that scripts in one domain should not be able to access resources or run code in a different domain.
            
            There are three main kinds of XSS:
            
               
                  Type 1: Reflected XSS (or Non-Persistent) - 
         			The server reads data directly from the HTTP request and reflects it back in the HTTP response. Reflected XSS exploits occur when an attacker causes a victim to supply dangerous content to a vulnerable web application, which is then reflected back to the victim and executed by the web browser. The most common mechanism for delivering malicious content is to include it as a parameter in a URL that is posted publicly or e-mailed directly to the victim. URLs constructed in this manner constitute the core of many phishing schemes, whereby an attacker convinces a victim to visit a URL that refers to a vulnerable site. After the site reflects the attacker's content back to the victim, the content is executed by the victim's browser.
               
                  Type 2: Stored XSS (or Persistent) - 
               The application stores dangerous data in a database, message forum, visitor log, or other trusted data store. At a later time, the dangerous data is subsequently read back into the application and included in dynamic content. From an attacker's perspective, the optimal place to inject malicious content is in an area that is displayed to either many users or particularly interesting users. Interesting users typically have elevated privileges in the application or interact with sensitive data that is valuable to the attacker. If one of these users executes malicious content, the attacker may be able to perform privileged operations on behalf of the user or gain access to sensitive data belonging to the user. For example, the attacker might inject XSS into a log message, which might not be handled properly when an administrator views the logs.
            
               
                  Type 0: DOM-Based XSS - 
               In DOM-based XSS, the client performs the injection of XSS into the page; in the other types, the server performs the injection. DOM-based XSS generally involves server-controlled, trusted script that is sent to the client, such as Javascript that performs sanity checks on a form before the user submits it. If the server-supplied script processes user-supplied data and then injects it back into the web page (such as with dynamic HTML), then DOM-based XSS is possible.
            
            
            Once the malicious script is injected, the attacker can perform a variety of malicious activities. The attacker could transfer private information, such as cookies that may include session information, from the victim's machine to the attacker. The attacker could send malicious requests to a web site on behalf of the victim, which could be especially dangerous to the site if the victim has administrator privileges to manage that site. Phishing attacks could be used to emulate trusted web sites and trick the victim into entering a password, allowing the attacker to compromise the victim's account on that web site. Finally, the script could exploit a vulnerability in the web browser itself possibly taking over the victim's machine, sometimes referred to as "drive-by hacking."
            In many cases, the attack can be launched without the victim even being aware of it. Even with careful users, attackers frequently use a variety of methods to encode the malicious portion of the attack, such as URL encoding or Unicode, so the request looks less suspicious.
         
         

Fix information:
repo_url: https://github.com/acumos/design-studio
commit_details: repo_url: https://github.com/acumos/design-studio
author: Ramanaiah Pirla
author_date: 2018-11-13 20:04:07+05:30
msg: Senitization for CSS Vulnerability

Issue-Id : ACUMOS-1650
Description : Senitization for CSS Vulnerability - Design Studio

Change-Id: If8fd4b9b06f884219d93881f7922421870de8e3d
Signed-off-by: Ramanaiah Pirla <RP00490596@techmahindra.com>
repository: repo_url: https://github.com/acumos/design-studio
repo_name: acumos/design-studio
repo_language: Java
owner: acumos
file_changes: filename: release-notes.rst
change_type: ModificationType.MODIFY
diff: @@ -27,6 +27,7 @@ repository as a jar file.
 1.40.3-SNAPSHOT, 2018-11-13
 ---------------------------
 * ACUMOS-1969 : Default CDS startup check interval too short, attempts too few; pls increase
+* ACUMOS-1650 : Senitization for CSS Vulnerability
 
 1.40.2-SNAPSHOT, 2018-10-12
 ---------------------------

programming_language: Markdown
filename: pom.xml
change_type: ModificationType.MODIFY
diff: @@ -145,7 +145,12 @@
 			<groupId>com.github.docker-java</groupId>
 			<artifactId>docker-java</artifactId>
 			<version>3.0.10</version>
-		</dependency>		
+		</dependency>
+		<dependency>
+		 	<groupId>com.googlecode.owasp-java-html-sanitizer</groupId>
+		 	<artifactId>owasp-java-html-sanitizer</artifactId>
+		 	<version>20180219.1</version>
+		</dependency>	
 	</dependencies>
 	<build>
 		<resources>

programming_language: HTML
filename: ArtfactDetailsController.java
change_type: ModificationType.MODIFY
diff: @@ -25,6 +25,7 @@ import javax.servlet.http.HttpServletResponse;
 import org.acumos.designstudio.ce.service.IAcumosCatalog;
 import org.acumos.designstudio.ce.util.EELFLoggerDelegator;
 import org.acumos.designstudio.ce.util.Properties;
+import org.acumos.designstudio.ce.util.SanitizeUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -66,7 +67,7 @@ public class ArtfactDetailsController {
 		logger.debug(EELFLoggerDelegator.debugLogger, "fetchJsonTOSCA() : Begin");
 		String result = "";
 		try {
-			result = iacumosCatalog.readArtifact(userId, solutionId, version, props.getArtifactType().trim());
+			result = iacumosCatalog.readArtifact(userId, SanitizeUtils.sanitize(solutionId), version, props.getArtifactType().trim());
 			
 			if (result == null || result.isEmpty()) {
 				response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
@@ -102,7 +103,7 @@ public class ArtfactDetailsController {
 		String resultTemplate = "{\"protobuf_json\" : %s,\n \"success\" : \"%s\",\n \"errorMessage\" : \"%s\"}";
 		String result = "";
 		try {
-			result = iacumosCatalog.readArtifact(userId, solutionId, version, props.getProtoArtifactType().trim());
+			result = iacumosCatalog.readArtifact(userId, SanitizeUtils.sanitize(solutionId), version, props.getProtoArtifactType().trim());
 
 			if (result != null && !result.isEmpty()) {
 				resultTemplate = String.format(resultTemplate, result, true, "");

programming_language: Java
filename: SolutionController.java
change_type: ModificationType.MODIFY
diff: @@ -33,6 +33,7 @@ import org.acumos.designstudio.ce.util.ConfigurationProperties;
 import org.acumos.designstudio.ce.util.DSUtil;
 import org.acumos.designstudio.ce.util.EELFLoggerDelegator;
 import org.acumos.designstudio.ce.util.Properties;
+import org.acumos.designstudio.ce.util.SanitizeUtils;
 import org.acumos.designstudio.ce.vo.DSCompositeSolution;
 import org.acumos.designstudio.ce.vo.SuccessErrorMessage;
 import org.acumos.designstudio.ce.vo.cdump.DataConnector;
@@ -136,7 +137,7 @@ public class SolutionController {
 		try {
 			dscs.setAuthor(userId);
 			dscs.setSolutionName(solutionName);
-			dscs.setSolutionId(solutionId);
+			dscs.setSolutionId(SanitizeUtils.sanitize(solutionId));
 			dscs.setVersion(version);
 			dscs.setOnBoarder(userId);
 			dscs.setDescription(description);
@@ -226,7 +227,7 @@ public class SolutionController {
 			boolean validNode = validateNode(node);
 			if (validNode) {
 				if ((solutionId != null && version != null) || (null != cid)) {
-					results = solutionService.addNode(userId, solutionId, version, cid, node);
+					results = solutionService.addNode(userId, SanitizeUtils.sanitize(solutionId), version, cid, node);
 				} else {
 					results = "{\"error\": \"Either Cid or SolutionId and Version need to Pass\"}";
 				}
@@ -296,7 +297,7 @@ public class SolutionController {
 		logger.debug(EELFLoggerDelegator.debugLogger, " fetchJsonTOSCA()  : Begin");
 		String result;
 		try {
-			result = solutionService.readCompositeSolutionGraph(userId, solutionId, version);
+			result = solutionService.readCompositeSolutionGraph(userId, SanitizeUtils.sanitize(solutionId), version);
 		} catch (Exception e) {
 			logger.error(EELFLoggerDelegator.errorLogger, "Failed to read the ComposietSolution", e);
 			result = "";
@@ -361,7 +362,7 @@ public class SolutionController {
 					splitterMap = dataConnector.getSplitterMap();
 				}
 			}
-			result = solutionService.modifyNode(userId, solutionId, version, cid, nodeId, nodeName, ndata, fieldMap, databrokerMap, collatorMap, splitterMap);
+			result = solutionService.modifyNode(userId, SanitizeUtils.sanitize(solutionId), version, cid, nodeId, nodeName, ndata, fieldMap, databrokerMap, collatorMap, splitterMap);
 		} catch (Exception e) {
 			logger.error(EELFLoggerDelegator.errorLogger, "-------Exception in  modifyNode() -------", e);
 		}
@@ -381,7 +382,7 @@ public class SolutionController {
 		String result = null;
 		logger.debug(EELFLoggerDelegator.debugLogger, " modifyLink()  : Begin");
 		try {
-			result = solutionService.modifyLink(userId, cid, solutionId, version, linkId, linkName);
+			result = solutionService.modifyLink(userId, cid, SanitizeUtils.sanitize(solutionId), version, linkId, linkName);
 		} catch (Exception e) {
 			logger.error(EELFLoggerDelegator.errorLogger, "Exception in  modifyLink() ", e);
 		}
@@ -401,7 +402,7 @@ public class SolutionController {
 
 		try {
 
-			boolean deleted = compositeServiceImpl.deleteCompositeSolution(userId, solutionId, version);
+			boolean deleted = compositeServiceImpl.deleteCompositeSolution(userId, SanitizeUtils.sanitize(solutionId), version);
 			if (!deleted) {
 				result = String.format(resultTemplate, "false", "Requested Solution Not Found");
 			} else {
@@ -429,7 +430,7 @@ public class SolutionController {
 			result = String.format(resultTemplate, false, "Mandatory feild(s) missing");
 		} else {
 			try {
-				boolean deletedNode = solutionService.deleteNode(userId, solutionId, version, cid, nodeId);
+				boolean deletedNode = solutionService.deleteNode(userId, SanitizeUtils.sanitize(solutionId), version, cid, nodeId);
 				if (deletedNode) {
 					result = String.format(resultTemplate, true, "");
 				} else {
@@ -454,7 +455,7 @@ public class SolutionController {
 		logger.debug(EELFLoggerDelegator.debugLogger, " closeCompositeSolution(): Begin ");
 		String result = "";
 		try {
-			result = compositeServiceImpl.closeCompositeSolution(userId, solutionId, solutionVersion, cid);
+			result = compositeServiceImpl.closeCompositeSolution(userId, SanitizeUtils.sanitize(solutionId), solutionVersion, cid);
 		} catch (Exception e) {
 			logger.error(EELFLoggerDelegator.errorLogger, " Exception in closeCompositeSolution() ", e);
 		}
@@ -472,7 +473,7 @@ public class SolutionController {
 		logger.debug(EELFLoggerDelegator.debugLogger, " clearCompositeSolution(): Begin ");
 		String result = "";
 		try {
-			result = compositeServiceImpl.clearCompositeSolution(userId, solutionId, solutionVersion, cid);
+			result = compositeServiceImpl.clearCompositeSolution(userId, SanitizeUtils.sanitize(solutionId), solutionVersion, cid);
 		} catch (Exception e) {
 			logger.error(EELFLoggerDelegator.errorLogger, " Exception in clearCompositeSolution() ", e);
 		}
@@ -543,7 +544,7 @@ public class SolutionController {
 		logger.debug(EELFLoggerDelegator.debugLogger, "validateCompositeSolution() : Begin ");
 		String result = "";
 		try {
-			result = compositeServiceImpl.validateCompositeSolution(userId, solutionName, solutionId, version);
+			result = compositeServiceImpl.validateCompositeSolution(userId, solutionName, SanitizeUtils.sanitize(solutionId), version);
 			result = String.format(result);
 		} catch (Exception e) {
 			result = "{\"success\" : \"false\", \"errorDescription\" : \"Failed to Validate Composite Solution\"}";
@@ -582,7 +583,7 @@ public class SolutionController {
 					&& targetNodeCapabilityName != null) {
 
 				if (validateProperty(property)) {
-					linkAdded = solutionService.addLink(userId, solutionId, version, linkName, linkId, sourceNodeName,
+					linkAdded = solutionService.addLink(userId, SanitizeUtils.sanitize(solutionId), version, linkName, linkId, sourceNodeName,
 							sourceNodeId, targetNodeName, targetNodeId, sourceNodeRequirement, targetNodeCapabilityName,
 							cid, property);
 
@@ -684,7 +685,7 @@ public class SolutionController {
 			result = String.format(resultTemplate, false, "Mandatory feild(s) missing");
 		} else {
 			try {
-				boolean deletedLink = solutionService.deleteLink(userId, solutionId, version, cid, linkId);
+				boolean deletedLink = solutionService.deleteLink(userId, SanitizeUtils.sanitize(solutionId), version, cid, linkId);
 				if (deletedLink) {
 					result = String.format(resultTemplate, true, "");
 				} else {
@@ -711,7 +712,7 @@ public class SolutionController {
         SuccessErrorMessage successErrorMessage = null;
 		logger.debug(EELFLoggerDelegator.debugLogger, "setProbeIndicator() in SolutionController Begin");
         try {
-        	successErrorMessage = compositeServiceImpl.setProbeIndicator(userId, solutionId, version, cid,probeIndicator);
+        	successErrorMessage = compositeServiceImpl.setProbeIndicator(userId, SanitizeUtils.sanitize(solutionId), version, cid,probeIndicator);
 		}catch (Exception e) {
 			logger.error(EELFLoggerDelegator.errorLogger, "Exception in setProbeIndicator() in SolutionController", e);
 		}

programming_language: Java
filename: SanitizeUtils.java
change_type: ModificationType.ADD
diff: @@ -0,0 +1,40 @@
+/*-
+ * ===============LICENSE_START=======================================================
+ * Acumos
+ * ===================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property & Tech Mahindra. All rights reserved.
+ * ===================================================================================
+ * This Acumos software file is distributed by AT&T and Tech Mahindra
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *  
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ * This file is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ===============LICENSE_END=========================================================
+ */
+
+package org.acumos.designstudio.ce.util;
+
+import org.owasp.html.HtmlPolicyBuilder;
+import org.owasp.html.PolicyFactory;
+
+public class SanitizeUtils {
+
+	public static PolicyFactory genericPolicy = new HtmlPolicyBuilder()
+    	    .requireRelNofollowOnLinks()
+    	    .allowTextIn("@")
+    	    .toFactory();
+    	
+	public static String sanitize(String html) {
+		if(null == html){
+			return html;
+		}
+		return genericPolicy.sanitize(html);
+	}
+    	
+}

programming_language: Java