| 1 |
From 1a5ce6467756e92f42f89c53f0f370dc0f0206d7 Mon Sep 17 00:00:00 2001 |
| 2 |
From: TJ Saunders <[email protected]> |
| 3 |
Date: Tue, 19 May 2026 08:01:11 -0700 |
| 4 |
Subject: [PATCH] Issue #2052: Address another avenue for SQL injection, via |
| 5 |
custom SQLUserInfo queries. |
| 6 |
|
| 7 |
--- |
| 8 |
contrib/mod_sql.c | 5 ++++- |
| 9 |
1 file changed, 4 insertions(+), 1 deletion(-) |
| 10 |
|
| 11 |
diff --git a/contrib/mod_sql.c b/contrib/mod_sql.c |
| 12 |
index b90725942..d28b483d1 100644 |
| 13 |
--- a/contrib/mod_sql.c |
| 14 |
+++ b/contrib/mod_sql.c |
| 15 |
@@ -1999,8 +1999,11 @@ static struct passwd *sql_getpasswd(cmd_rec *cmd, struct passwd *p) { |
| 16 |
} |
| 17 |
|
| 18 |
} else { |
| 19 |
+ /* The username has been escaped according to the backend database' rules |
| 20 |
+ * at this point. |
| 21 |
+ */ |
| 22 |
mr = sql_lookup(sql_make_cmd(cmd->tmp_pool, 3, MOD_SQL_DEF_CONN_NAME, |
| 23 |
- cmap.usercustom, realname ? realname : "NULL")); |
| 24 |
+ cmap.usercustom, username ? username : "NULL")); |
| 25 |
|
| 26 |
if (check_response(mr, 0) < 0) { |
| 27 |
return NULL; |