Skip to content

Commit 2705a17

Browse files
committed
ascanrules: SQLi MsSQL rename scan rule (all time based)
Signed-off-by: kingthorin <[email protected]>
1 parent 8afbdb0 commit 2705a17

File tree

5 files changed

+17
-14
lines changed

5 files changed

+17
-14
lines changed

addOns/ascanrules/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
77
### Changed
88
- Maintenance changes.
99
- Depends on an updated version of the Common Library add-on.
10+
- The SQL Injection - MsSQL scan rule and alerts have been renamed to clarify that they're time based (Issue 7341).
1011

1112
### Added
1213
- Rules (as applicable) have been tagged in relation to HIPAA and PCI DSS.
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@
4444
import org.zaproxy.zap.model.TechSet;
4545

4646
/**
47-
* The SqlInjectionMsSqlScanRule identifies MsSQL specific SQL Injection vulnerabilities using MsSQL
48-
* specific syntax. If it doesn't use MsSQL specific syntax, it belongs in the generic SQLInjection
49-
* class! Note the ordering of checks, for efficiency is : 1) Error based (N/A) 2) Boolean Based
50-
* (N/A - uses standard syntax) 3) UNION based (N/A - uses standard syntax) 4) Stacked (N/A - uses
51-
* standard syntax) 5) Blind/Time Based (Yes - uses specific syntax)
47+
* This scan rule identifies MsSQL specific SQL Injection vulnerabilities using MsSQL specific
48+
* syntax. If it doesn't use MsSQL specific syntax, it belongs in the generic SQLInjection class!
49+
* Note the ordering of checks, for efficiency is : 1) Error based (N/A) 2) Boolean Based (N/A -
50+
* uses standard syntax) 3) UNION based (N/A - uses standard syntax) 4) Stacked (N/A - uses standard
51+
* syntax) 5) Blind/Time Based (Yes - uses specific syntax)
5252
*
5353
* <p>See the following for some great MySQL specific tricks which could be integrated here
5454
* http://www.websec.ca/kb/sql_injection#MSSQL_Stacked_Queries
5555
* http://pentestmonkey.net/cheat-sheet/sql-injection/mssql-sql-injection-cheat-sheet
5656
*/
57-
public class SqlInjectionMsSqlScanRule extends AbstractAppParamPlugin
57+
public class SqlInjectionMsSqlTimingScanRule extends AbstractAppParamPlugin
5858
implements CommonActiveScanRuleInfo {
5959

6060
/** MSSQL one-line comment */
@@ -134,7 +134,8 @@ public class SqlInjectionMsSqlScanRule extends AbstractAppParamPlugin
134134
private static final double TIME_SLOPE_ERROR_RANGE = 0.30;
135135

136136
/** for logging. */
137-
private static final Logger LOGGER = LogManager.getLogger(SqlInjectionMsSqlScanRule.class);
137+
private static final Logger LOGGER =
138+
LogManager.getLogger(SqlInjectionMsSqlTimingScanRule.class);
138139

139140
private static final Map<String, String> ALERT_TAGS;
140141

addOns/ascanrules/src/main/javahelp/org/zaproxy/zap/extension/ascanrules/resources/help/contents/ascanrules.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,10 +365,10 @@ <H2 id="id-40020">SQL Injection - Hypersonic (Time Based)</H2>
365365
<br>
366366
Alert ID: <a href="https://www.zaproxy.org/docs/alerts/40020/">40020</a>.
367367

368-
<H2 id="id-40027">SQL Injection - MsSQL</H2>
368+
<H2 id="id-40027">SQL Injection - MsSQL (Time Based)</H2>
369369
This active scan rule attempts to inject MsSQL specific sleep commands into parameter values and analyzes the server's response time to see if the sleep is effectively executed on the server (indicating a successful SQL injection attack).
370370
<p>
371-
Latest code: <a href="https://github.com/zaproxy/zap-extensions/blob/main/addOns/ascanrules/src/main/java/org/zaproxy/zap/extension/ascanrules/SqlInjectionMsSqlScanRule.java">SqlInjectionMsSqlScanRule.java</a>
371+
Latest code: <a href="https://github.com/zaproxy/zap-extensions/blob/main/addOns/ascanrules/src/main/java/org/zaproxy/zap/extension/ascanrules/SqlInjectionMsSqlTimingScanRule.java">SqlInjectionMsSqlTimingScanRule.java</a>
372372
<br>
373373
Alert ID: <a href="https://www.zaproxy.org/docs/alerts/40027/">40027</a>.
374374

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
@@ -182,7 +182,7 @@ ascanrules.sqlinjection.authbypass.name = SQL Injection - Authentication Bypass
182182
ascanrules.sqlinjection.desc = SQL injection may be possible.
183183
ascanrules.sqlinjection.hypersonic.name = SQL Injection - Hypersonic SQL
184184
ascanrules.sqlinjection.mssql.alert.timebased.extrainfo = The query time is controllable using parameter value [{0}], which caused the request to take [{1}] milliseconds, when the original unmodified query with value [{2}] took [{3}] milliseconds.
185-
ascanrules.sqlinjection.mssql.name = SQL Injection - MsSQL
185+
ascanrules.sqlinjection.mssql.name = SQL Injection - MsSQL (Time Based)
186186
ascanrules.sqlinjection.mysql.name = SQL Injection - MySQL
187187
ascanrules.sqlinjection.name = SQL Injection
188188
ascanrules.sqlinjection.oracle.name = SQL Injection - Oracle
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@
3838
import org.zaproxy.zap.model.TechSet;
3939
import org.zaproxy.zap.testutils.NanoServerHandler;
4040

41-
/** Unit test for {@link SqlInjectionMsSqlScanRule}. */
42-
class SqlInjectionMsSqlScanRuleUnitTest extends ActiveScannerTest<SqlInjectionMsSqlScanRule> {
41+
/** Unit test for {@link SqlInjectionMsSqlTimingScanRule}. */
42+
class SqlInjectionMsSqlTimingScanRuleUnitTest
43+
extends ActiveScannerTest<SqlInjectionMsSqlTimingScanRule> {
4344

4445
@Override
45-
protected SqlInjectionMsSqlScanRule createScanner() {
46-
return new SqlInjectionMsSqlScanRule();
46+
protected SqlInjectionMsSqlTimingScanRule createScanner() {
47+
return new SqlInjectionMsSqlTimingScanRule();
4748
}
4849

4950
@Test

0 commit comments

Comments
 (0)