Skip to content

Commit 103fbd1

Browse files
committed
ascanrules: SQLi MySQL rename scan rule (all time based)
Signed-off-by: kingthorin <kingthorin@users.noreply.github.com> # Conflicts: # addOns/ascanrules/CHANGELOG.md # addOns/ascanrules/src/main/resources/org/zaproxy/zap/extension/ascanrules/resources/Messages.properties
1 parent 84469e2 commit 103fbd1

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

addOns/ascanrules/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
99
- Depends on an updated version of the Common Library add-on.
1010
- The following scan rules and their alerts have been renamed to clarify that they're time based (Issue 7341).
1111
- SQL Injection - MsSQL
12+
- SQL Injection - MySQL
1213
- SQL Injection - Hypersonic
1314

1415
### Added
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,19 @@
4444
import org.zaproxy.zap.model.TechSet;
4545

4646
/**
47-
* The SqlInjectionMySqlScanRule identifies MySQL specific SQL Injection vulnerabilities using MySQL
48-
* specific syntax. If it doesn't use MySQL 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 MySQL specific SQL Injection vulnerabilities using MySQL specific
48+
* syntax. If it doesn't use MySQL 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#MySQL_Stacked_Queries
5555
* http://pentestmonkey.net/cheat-sheet/sql-injection/mysql-sql-injection-cheat-sheet
5656
*
5757
* @author 70pointer
5858
*/
59-
public class SqlInjectionMySqlScanRule extends AbstractAppParamPlugin
59+
public class SqlInjectionMySqlTimingScanRule extends AbstractAppParamPlugin
6060
implements CommonActiveScanRuleInfo {
6161

6262
/** MySQL one-line comment */
@@ -231,7 +231,8 @@ public class SqlInjectionMySqlScanRule extends AbstractAppParamPlugin
231231
}
232232

233233
/** for logging. */
234-
private static final Logger LOGGER = LogManager.getLogger(SqlInjectionMySqlScanRule.class);
234+
private static final Logger LOGGER =
235+
LogManager.getLogger(SqlInjectionMySqlTimingScanRule.class);
235236

236237
private int timeSleepSeconds = DEFAULT_SLEEP_TIME;
237238

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ <H2 id="id-40019">SQL Injection - MySQL (Time Based)</H2>
386386
<br>
387387
Post 2.5.0 you can change the length of time used for the attack by changing the <code>rules.common.sleep</code> parameter via the Options 'Rule configuration' panel.
388388
<p>
389-
Latest code: <a href="https://github.com/zaproxy/zap-extensions/blob/main/addOns/ascanrules/src/main/java/org/zaproxy/zap/extension/ascanrules/SqlInjectionMySqlScanRule.java">SqlInjectionMySqlScanRule.java</a>
389+
Latest code: <a href="https://github.com/zaproxy/zap-extensions/blob/main/addOns/ascanrules/src/main/java/org/zaproxy/zap/extension/ascanrules/SqlInjectionMySqlTimingScanRule.java">SqlInjectionMySqlTimingScanRule.java</a>
390390
<br>
391391
Alert ID: <a href="https://www.zaproxy.org/docs/alerts/40019/">40019</a>.
392392

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ ascanrules.sqlinjection.hypersonic.name = SQL Injection - Hypersonic SQL (Time B
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.
185185
ascanrules.sqlinjection.mssql.name = SQL Injection - MsSQL (Time Based)
186186
ascanrules.sqlinjection.mysql.name = SQL Injection - MySQL
187+
187188
ascanrules.sqlinjection.name = SQL Injection
188189
ascanrules.sqlinjection.oracle.name = SQL Injection - Oracle
189190
ascanrules.sqlinjection.postgres.name = SQL Injection - PostgreSQL
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 SqlInjectionMySqlScanRule}. */
42-
class SqlInjectionMySqlScanRuleUnitTest extends ActiveScannerTest<SqlInjectionMySqlScanRule> {
41+
/** Unit test for {@link SqlInjectionMySqlTimingScanRule}. */
42+
class SqlInjectionMySqlTimingScanRuleUnitTest
43+
extends ActiveScannerTest<SqlInjectionMySqlTimingScanRule> {
4344

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

4950
@Test

0 commit comments

Comments
 (0)