CVE-2015-10039 (published 2023-01-11T19:15Z)

A vulnerability was found in dobos domino. It has been rated as critical. Affected by this issue is some unknown functionality in the library src/Complex.Domino.Lib/Lib/EntityFactory.cs. The manipulation leads to sql injection. Upgrading to version 0.1.5524.38553 is able to address this issue. The name of the patch is 16f039073709a21a76526110d773a6cce0ce753a. It is recommended to upgrade the affected component. The identifier of this vulnerability is VDB-218024.

CVSS v3 base score: 8.0, HIGH (CVSS:3.1/AV:A/AC:L/PR:L/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/dobos/domino
commit_details: repo_url: https://github.com/dobos/domino
author: Laszlo Dobos
author_date: 2015-02-15 18:16:37+01:00
msg: Validate order by to prevent SQL injection
repository: repo_url: https://github.com/dobos/domino
repo_name: dobos/domino
description: Domino
repo_language: C#
owner: dobos
file_changes: filename: EntityFactory.cs
change_type: ModificationType.MODIFY
diff: @@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 using System.Data;
 using System.Data.SqlClient;
@@ -11,6 +12,8 @@ namespace Complex.Domino.Lib
     public abstract class EntityFactory<T> : ContextObject
         where T : IDatabaseTableObject, new()
     {
+        private static readonly Regex OrderByRegex = new Regex(@"[a-z]+\s*(asc|desc){0,1}", RegexOptions.IgnoreCase | RegexOptions.Compiled);
+
         private string name;
         private bool? readOnly;
         private bool? hidden;
@@ -70,6 +73,12 @@ SELECT COUNT(*) FROM {0} AS entities
 
         public IEnumerable<T> Find(int max, int from, string orderBy)
         {
+            // Prevent any injection attacks
+            if (!OrderByRegex.Match(orderBy).Success)
+            {
+                Error.AccessDenied();
+            }
+
             using (var cmd = Context.CreateCommand())
             {
                 string sql = @"

programming_language: C#
filename: PageBase.cs
change_type: ModificationType.MODIFY
diff: @@ -97,7 +97,7 @@ namespace Complex.Domino.Web
 
             if (!bypassAuthentication)
             {
-                // If the user hold a valid cookie but the session is new
+                // If the user holds a valid cookie but the session is new
                 // we need to look up user details from the database
                 if (this.User.Identity.IsAuthenticated && Session[Constants.SessionUser] == null)
                 {

programming_language: C#