mirror of
https://github.com/fabriziosalmi/patterns.git
synced 2025-12-17 17:55:48 +00:00
28 lines
2.1 KiB
Plaintext
28 lines
2.1 KiB
Plaintext
# Nginx WAF rules for SQL
|
|
# Automatically generated from OWASP rules.
|
|
# Include this file in your server or location block.
|
|
|
|
map $request_uri $waf_block_sql {
|
|
default 0;
|
|
"~*(?i)Exception (?:condition )?d+. Transaction rollback." 1;
|
|
"~*(?i)(?:System.Data.OleDb.OleDbException|[Microsoft][ODBC SQL Server Driver]|[Macromedia][SQLServer JDBC Driver]|[SqlException|System.Data.SqlClient.SqlException|Unclosed quotation mark after the character string|'80040e14'|mssql_query()|Microsoft OLE DB Provider for ODBC Drivers|Microsoft OLE DB Provider for SQL Server|Incorrect syntax near|Sintaxis incorrecta cerca de|Syntax error in string in query expression|Procedure or function .* expects parameter|Unclosed quotation mark before the character string|Syntax error .* in query expression|Data type mismatch in criteria expression.|ADODB.Field (0x800A0BCD)|the used select statements have different number of columns|OLE DB.*SQL Server|Warning.*mssql_.*|Driver.*SQL[ _-]*Server|SQL Server.*Driver|SQL Server.*[0-9a-fA-F]{8}|Exception.*WSystem.Data.SqlClient.|Conversion failed when converting the varchar value .*? to data type int.)" 1;
|
|
"~*(?i)org.hsqldb.jdbc" 1;
|
|
"~*(?i:An illegal character has been found in the statement|com.informix.jdbc|Exception.*Informix)" 1;
|
|
"~*(?i:Warning.*ingres_|Ingres SQLSTATE|IngresW.*Driver)" 1;
|
|
"~*(?i:[DM_QUERY_E_SYNTAX]|has occurred in the vicinity of:)" 1;
|
|
"~*(?i:ORA-[0-9][0-9][0-9][0-9]|java.sql.SQLException|Oracle error|Oracle.*Driver|Warning.*oci_.*|Warning.*ora_.*)" 1;
|
|
"~*(?i:SQL error.*POS[0-9]+.*|Warning.*maxdb.*)" 1;
|
|
"~*(?i:JET Database Engine|Access Database Engine|[Microsoft][ODBC Microsoft Access Driver])" 1;
|
|
"~*(?i)(?:Sybase message:|Warning.{2,20}sybase|Sybase.*Server message.*)" 1;
|
|
"~*(?i)(?:Warning.*sqlite_.*|Warning.*SQLite3::|SQLite/JDBCDriver|SQLite.Exception|System.Data.SQLite.SQLiteException)" 1;
|
|
"~*(?i:<b>Warning</b>: ibase_|Unexpected end of command in statement)" 1;
|
|
"~*(?i)Dynamic SQL Error" 1;
|
|
}
|
|
|
|
if ($waf_block_sql) {
|
|
return 403;
|
|
# Log the blocked request (optional)
|
|
# access_log /var/log/nginx/waf_blocked.log;
|
|
}
|
|
|