Skip to content

Commit 409db5a

Browse files
committed
ascanrules: SQLi Oracle rename scan rule (all timing based)
Signed-off-by: kingthorin <kingthorin@users.noreply.github.com>
1 parent dc2e143 commit 409db5a

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

addOns/ascanrules/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1111
### Added
1212
- Rules (as applicable) have been tagged in relation to HIPAA and PCI DSS.
1313
- The Cloud Metadata Potentially Exposed scan rules now has a CWE reference.
14+
- The SQL Injection - Oracle scan rule and alerts have been renamed to clarify that they're timing based (Issue 7341).
1415

1516
## [72] - 2025-06-20
1617
### Added
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
/**
3939
* TODO: maybe implement a more specific UNION based check for Oracle (with table names)
4040
*
41-
* <p>The SqlInjectionOracleScanRule identifies Oracle specific SQL Injection vulnerabilities using
42-
* Oracle specific syntax. If it doesn't use Oracle specific syntax, it belongs in the generic
41+
* <p>The SqlInjectionOracleTimingScanRule identifies Oracle specific SQL Injection vulnerabilities
42+
* using Oracle specific syntax. If it doesn't use Oracle specific syntax, it belongs in the generic
4343
* SQLInjection class! Note the ordering of checks, for efficiency is : 1) Error based (N/A) 2)
4444
* Boolean Based (N/A - uses standard syntax) 3) UNION based (TODO) 4) Stacked (N/A - uses standard
4545
* syntax) 5) Blind/Time Based (Yes)
@@ -60,7 +60,7 @@
6060
*
6161
* @author 70pointer
6262
*/
63-
public class SqlInjectionOracleScanRule extends AbstractAppParamPlugin
63+
public class SqlInjectionOracleTimingScanRule extends AbstractAppParamPlugin
6464
implements CommonActiveScanRuleInfo {
6565

6666
private int expectedDelayInMs = 5000;
@@ -156,7 +156,8 @@ public class SqlInjectionOracleScanRule extends AbstractAppParamPlugin
156156
CommonAlertTag.OWASP_2017_A01_INJECTION,
157157
CommonAlertTag.WSTG_V42_INPV_05_SQLI,
158158
CommonAlertTag.HIPAA,
159-
CommonAlertTag.PCI_DSS));
159+
CommonAlertTag.PCI_DSS,
160+
CommonAlertTag.TEST_TIMING));
160161
alertTags.put(PolicyTag.DEV_FULL.getTag(), "");
161162
alertTags.put(PolicyTag.QA_STD.getTag(), "");
162163
alertTags.put(PolicyTag.QA_FULL.getTag(), "");
@@ -166,7 +167,8 @@ public class SqlInjectionOracleScanRule extends AbstractAppParamPlugin
166167
}
167168

168169
/** for logging. */
169-
private static final Logger LOGGER = LogManager.getLogger(SqlInjectionOracleScanRule.class);
170+
private static final Logger LOGGER =
171+
LogManager.getLogger(SqlInjectionOracleTimingScanRule.class);
170172

171173
@Override
172174
public int getId() {

addOns/ascanrules/src/main/resources/org/zaproxy/zap/extension/ascanrules/resources/Messages.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ ascanrules.sqlinjection.mssql.alert.timebased.extrainfo = The query time is cont
185185
ascanrules.sqlinjection.mssql.name = SQL Injection - MsSQL
186186
ascanrules.sqlinjection.mysql.name = SQL Injection - MySQL
187187
ascanrules.sqlinjection.name = SQL Injection
188-
ascanrules.sqlinjection.oracle.name = SQL Injection - Oracle
188+
ascanrules.sqlinjection.oracle.name = SQL Injection - Oracle (Time Based)
189189
ascanrules.sqlinjection.postgres.name = SQL Injection - PostgreSQL
190190
ascanrules.sqlinjection.refs = https://cheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html
191191
ascanrules.sqlinjection.soln = Do not trust client side input, even if there is client side validation in place.\nIn general, type check all data on the server side.\nIf the application uses JDBC, use PreparedStatement or CallableStatement, with parameters passed by '?'\nIf the application uses ASP, use ADO Command Objects with strong type checking and parameterized queries.\nIf database Stored Procedures can be used, use them.\nDo *not* concatenate strings into queries in the stored procedure, or use 'exec', 'exec immediate', or equivalent functionality!\nDo not create dynamic SQL queries using simple string concatenation.\nEscape all data received from the client.\nApply an 'allow list' of allowed characters, or a 'deny list' of disallowed characters in user input.\nApply the principle of least privilege by using the least privileged database user possible.\nIn particular, avoid using the 'sa' or 'db-owner' database users. This does not eliminate SQL injection, but minimizes its impact.\nGrant the minimum database access that is necessary for the application.
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@
3636
import org.zaproxy.zap.model.TechSet;
3737
import org.zaproxy.zap.testutils.NanoServerHandler;
3838

39-
/** Unit test for {@link SqlInjectionOracleScanRule}. */
40-
class SqlInjectionOracleScanRuleUnitTest extends ActiveScannerTest<SqlInjectionOracleScanRule> {
39+
/** Unit test for {@link SqlInjectionOracleTimingScanRule}. */
40+
class SqlInjectionOracleTimingScanRuleUnitTest
41+
extends ActiveScannerTest<SqlInjectionOracleTimingScanRule> {
4142

4243
@Override
43-
protected SqlInjectionOracleScanRule createScanner() {
44-
return new SqlInjectionOracleScanRule();
44+
protected SqlInjectionOracleTimingScanRule createScanner() {
45+
return new SqlInjectionOracleTimingScanRule();
4546
}
4647

4748
@Test
@@ -145,7 +146,7 @@ void shouldReturnExpectedMappings() {
145146
// Then
146147
assertThat(cwe, is(equalTo(89)));
147148
assertThat(wasc, is(equalTo(19)));
148-
assertThat(tags.size(), is(equalTo(10)));
149+
assertThat(tags.size(), is(equalTo(11)));
149150
assertThat(
150151
tags.containsKey(CommonAlertTag.OWASP_2021_A03_INJECTION.getTag()),
151152
is(equalTo(true)));
@@ -156,6 +157,7 @@ void shouldReturnExpectedMappings() {
156157
tags.containsKey(CommonAlertTag.WSTG_V42_INPV_05_SQLI.getTag()), is(equalTo(true)));
157158
assertThat(tags.containsKey(CommonAlertTag.HIPAA.getTag()), is(equalTo(true)));
158159
assertThat(tags.containsKey(CommonAlertTag.PCI_DSS.getTag()), is(equalTo(true)));
160+
assertThat(tags.containsKey(CommonAlertTag.TEST_TIMING.getTag()), is(equalTo(true)));
159161
assertThat(tags.containsKey(PolicyTag.DEV_FULL.getTag()), is(equalTo(true)));
160162
assertThat(tags.containsKey(PolicyTag.QA_STD.getTag()), is(equalTo(true)));
161163
assertThat(tags.containsKey(PolicyTag.QA_FULL.getTag()), is(equalTo(true)));

0 commit comments

Comments
 (0)