CVE-2013-10013 (published 2023-01-17T16:15Z)

A vulnerability was found in Bricco Authenticator Plugin. It has been declared as critical. This vulnerability affects the function authenticate/compare of the file src/java/talentum/escenic/plugins/authenticator/authenticators/DBAuthenticator.java. The manipulation leads to sql injection. Upgrading to version 1.39 is able to address this issue. The name of the patch is a5456633ff75e8f13705974c7ed1ce77f3f142d5. It is recommended to upgrade the affected component. The identifier of this vulnerability is VDB-218428.

CVSS v3 base score: 9.8, CRITICAL (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-89
cwe_name: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
description: The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.
extended_description: 
            
            
         
         

Fix information:
repo_url: https://github.com/Bricco/authenticator-plugin
commit_details: repo_url: https://github.com/Bricco/authenticator-plugin
author: samuel.eriksson
author_date: 2013-09-04 05:09:30+00:00
msg: Prevent SQL-injection
repository: repo_url: https://github.com/Bricco/authenticator-plugin
repo_name: Bricco/authenticator-plugin
description: Escenic plugin for authenticating web users.
repo_language: Java
owner: Bricco
file_changes: filename: DBAuthenticator.java
change_type: ModificationType.MODIFY
diff: @@ -1,11 +1,9 @@
 package talentum.escenic.plugins.authenticator.authenticators;
 
-import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
-import java.sql.Statement;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.HashMap;
@@ -67,20 +65,16 @@ public class DBAuthenticator extends Authenticator {
 		}
 		try {
 
+
 			ContentManager contentManager = ContentManager.getContentManager();
 			List result = new ArrayList();
 			String sql = "SELECT * FROM " + table + " WHERE "
 					+ columns.get("username") + "= ? AND "
-					+ columns.get("password") + "= '?'";
-			
-			String[] preparedVariables = new String[] {username, password};
-			
-			
-			
+					+ columns.get("password") + "= ?";
 			if(log.isDebugEnabled()) {
 				log.debug(sql);
 			}
-			contentManager.doQuery(new Query(sql, preparedVariables, result));
+			contentManager.doQuery(new Query(sql, new String[] { username, password },  result));
 			
 			if(log.isDebugEnabled()) {
 				log.debug("found " + result.size() + " records");
@@ -140,20 +134,21 @@ public class DBAuthenticator extends Authenticator {
 	
 	private static class Query implements TransactionOperation {
 		private String query;
+		private String[] args;
 		private List list;
-		private String[] variables;
 
-		public Query(String query, String[] variables, List list) {
+		public Query(String query, String[] args, List list) {
 			this.query = query;
-			this.variables = variables;
+			this.args = args;
 			this.list = list;
 		}
 
 		public void execute(Transaction t) throws SQLException {
-			//Statement st = t.getConnection().createStatement();
-			Statement st = t.getConnection().prepareStatement(query, variables);
+			PreparedStatement prepStmt = t.getConnection().prepareStatement(query);
+			prepStmt.setString(1, args[0]);
+			prepStmt.setString(2, args[1]);
 			try {
-				ResultSet rs = st.executeQuery(query);
+				ResultSet rs = prepStmt.executeQuery();
 				ResultSetMetaData metaData = rs.getMetaData();
 				while (rs.next()) {
 					Map map = new HashMap();
@@ -163,7 +158,7 @@ public class DBAuthenticator extends Authenticator {
 					list.add(map);
 				}
 	        } finally {
-	            st.close();
+	        	prepStmt.close();
 	        }
 		}
 	}

programming_language: Java