CVE-2024-32888: Insufficient Information (NVD-CWE-noinfo)
value: The Amazon JDBC Driver for Redshift is a Type 4 JDBC driver that provides database connectivity through the standard JDBC application program interfaces (APIs) available in the Java Platform, Enterprise Editions. Prior to version 2.1.0.28, SQL injection is possible when using the non-default connection property `preferQueryMode=simple` in combination with application code which has a vulnerable SQL that negates a parameter value. There is no vulnerability in the driver when using the default, extended query mode. Note that `preferQueryMode` is not a supported parameter in Redshift JDBC driver, and is inherited code from Postgres JDBC driver. Users who do not override default settings to utilize this unsupported query mode are not affected. This issue is patched in driver version 2.1.0.28. As a workaround, do not use the connection property `preferQueryMode=simple`. (NOTE: Those who do not explicitly specify a query mode use the default of extended query mode and are not affected by this issue.)
CWE description: There is insufficient information about the issue to classify it; details are unkown or unspecified.
Published: 2024-05-15T03:15Z
Repository: https://github.com/aws/amazon-redshift-jdbc-driver
Language: Java
Files changed: src/main/java/com/amazon/redshift/core/v3/SimpleParameterList.java
Commit date: 2024-05-14 16:15:56 -0700
Commit message: More security improvements.

Diff: diff --git a/src/main/java/com/amazon/redshift/core/v3/SimpleParameterList.java b/src/main/java/com/amazon/redshift/core/v3/SimpleParameterList.java
index 932f408..8f14a10 100644
--- a/src/main/java/com/amazon/redshift/core/v3/SimpleParameterList.java
+++ b/src/main/java/com/amazon/redshift/core/v3/SimpleParameterList.java
@@ -282,31 +282,68 @@ class SimpleParameterList implements V3ParameterList {
       }
     } else {
       textValue = paramValues[index].toString();
       int paramType = paramTypes[index];
 
-      if (paramType == Oid.TIMESTAMP) {
-        type = "timestamp";
-      } else if (paramType == Oid.TIMESTAMPTZ) {
-        type = "timestamp with time zone";
-      } else if (paramType == Oid.TIME) {
-        type = "time";
-      } else if (paramType == Oid.TIMETZ) {
-        type = "time with time zone";
-      } else if (paramType == Oid.DATE) {
-        type = "date";
-      } else if (paramType == Oid.INTERVAL) {
-        type = "interval";
-      } else if (paramType == Oid.INTERVALY2M) {
-        type = "interval year to month";
-      } else if (paramType == Oid.INTERVALD2S) {
-        type = "interval day to second";
-      } else if (paramType == Oid.NUMERIC) {
-        type = "numeric";
-      }
-      else {
-        type = null;
+      switch (paramTypes[index])
+      {
+        case Oid.INT2:
+          type = "int2";
+          break;
+        case Oid.INT4:
+          type = "int4";
+          break;
+        case Oid.INT8:
+          type = "int8";
+          break;
+        case Oid.FLOAT4:
+          type = "real";
+          break;
+        case Oid.FLOAT8:
+          type = "double precision";
+          break;
+        case Oid.TIMESTAMP:
+          type = "timestamp";
+          break;
+        case Oid.TIMESTAMPTZ:
+          type = "timestamp with time zone";
+          break;
+        case Oid.TIME:
+          type = "time";
+          break;
+        case Oid.TIMETZ:
+          type = "time with time zone";
+          break;
+        case Oid.DATE:
+          type = "date";
+          break;
+        case Oid.INTERVAL:
+          type = "interval";
+          break;
+        case Oid.INTERVALY2M:
+          type = "interval year to month";
+          break;
+        case Oid.INTERVALD2S:
+          type = "interval day to second";
+          break;
+        case Oid.NUMERIC:
+          type = "numeric";
+          break;
+        case Oid.UUID:
+          type = "uuid";
+          break;
+        case Oid.BOOL:
+          type = "boolean";
+          break;
+        case Oid.BOX:
+          type = "box";
+          break;
+        case Oid.POINT:
+          type = "point";
+          break;
+        default:
+          type = null;
       }
     }
     return quoteAndCast(textValue, type, standardConformingStrings);
   }
 

Vulnerable code:       if (paramType == Oid.TIMESTAMP) {
        type = "timestamp";
      } else if (paramType == Oid.TIMESTAMPTZ) {
        type = "timestamp with time zone";
      } else if (paramType == Oid.TIME) {
        type = "time";
      } else if (paramType == Oid.TIMETZ) {
        type = "time with time zone";
      } else if (paramType == Oid.DATE) {
        type = "date";
      } else if (paramType == Oid.INTERVAL) {
        type = "interval";
      } else if (paramType == Oid.INTERVALY2M) {
        type = "interval year to month";
      } else if (paramType == Oid.INTERVALD2S) {
        type = "interval day to second";
      } else if (paramType == Oid.NUMERIC) {
        type = "numeric";
      }
      else {
        type = null;
Fixed code:       switch (paramTypes[index])
      {
        case Oid.INT2:
          type = "int2";
          break;
        case Oid.INT4:
          type = "int4";
          break;
        case Oid.INT8:
          type = "int8";
          break;
        case Oid.FLOAT4:
          type = "real";
          break;
        case Oid.FLOAT8:
          type = "double precision";
          break;
        case Oid.TIMESTAMP:
          type = "timestamp";
          break;
        case Oid.TIMESTAMPTZ:
          type = "timestamp with time zone";
          break;
        case Oid.TIME:
          type = "time";
          break;
        case Oid.TIMETZ:
          type = "time with time zone";
          break;
        case Oid.DATE:
          type = "date";
          break;
        case Oid.INTERVAL:
          type = "interval";
          break;
        case Oid.INTERVALY2M:
          type = "interval year to month";
          break;
        case Oid.INTERVALD2S:
          type = "interval day to second";
          break;
        case Oid.NUMERIC:
          type = "numeric";
          break;
        case Oid.UUID:
          type = "uuid";
          break;
        case Oid.BOOL:
          type = "boolean";
          break;
        case Oid.BOX:
          type = "box";
          break;
        case Oid.POINT:
          type = "point";
          break;
        default:
          type = null;