policy/protocols/http/detect-sql-injection.zeek
- HTTP
SQL injection attack detection in HTTP.
The script annotates the notices it generates with an associated $uid connection identifier; always provides an attacker IP address in the $src field; and always provides a victim IP address in the $dst field.
- Namespace:
HTTP
- Imports:
base/frameworks/notice, base/frameworks/sumstats, base/protocols/http
Summary
Redefinable Options
Regular expression is used to match URI based SQL injections. |
|
Interval at which to watch for the
|
|
Defines the threshold that determines if an SQL injection attack is ongoing based on the number of requests that appear to be SQL injection attacks. |
Redefinitions
|
|
|
|
|
Hooks
A hook that can be used to prevent specific requests from being counted as an injection attempt. |
Detailed Interface
Redefinable Options
- HTTP::match_sql_injection_uri
- Type:
- Attributes:
- Default:
/^?((^?((^?((^?((^?(((?i:^?([\?&][^[:blank:]\x00-\x1f\|\+]+?=[\-[:alnum:]%]+([[:blank:]\x00-\x1f\+]|\/\*.*?\*\/)*'?([[:blank:]\x00-\x1f\+]|\/\*.*?\*\/|\)?;)+.*?(having|union|exec|select|delete|drop|declare|create|insert)([[:blank:]\x00-\x1f\+]|\/\*.*?\*\/)+)$?))|((?i:^?([\?&][^[:blank:]\x00-\x1f\|\+]+?=[\-0-9%]+([[:blank:]\x00-\x1f\+]|\/\*.*?\*\/)*'?([[:blank:]\x00-\x1f\+]|\/\*.*?\*\/|\)?;)+(x?or|n?and)([[:blank:]\x00-\x1f\+]|\/\*.*?\*\/)+'?(([^a-zA-Z&]+)?=|exists))$?)))$?)|((?i:^?([\?&][^[:blank:]\x00-\x1f\+]+?=[\-0-9%]*([[:blank:]\x00-\x1f\+]|\/\*.*?\*\/)*'([[:blank:]\x00-\x1f]|\/\*.*?\*\/)*(-|=|\+|\|\|)([[:blank:]\x00-\x1f\+]|\/\*.*?\*\/)*([0-9]|\(?convert|cast))$?)))$?)|((?i:^?([\?&][^[:blank:]\x00-\x1f\|\+]+?=([[:blank:]\x00-\x1f\+]|\/\*.*?\*\/)*'([[:blank:]\x00-\x1f\+]|\/\*.*?\*\/|;)*(x?or|n?and|having|union|exec|select|delete|drop|declare|create|regexp|insert)([[:blank:]\x00-\x1f\+]|\/\*.*?\*\/|[\[(])+[a-zA-Z&]{2,})$?)))$?)|((?i:^?([\?&][^[:blank:]\x00-\x1f\+]+?=[^\.]*?(char|ascii|substring|truncate|version|length)\()$?)))$?)|(^?(\/\*![[:digit:]]{5}.*?\*\/)$?))$?/
Regular expression is used to match URI based SQL injections.
- HTTP::sqli_requests_interval
-
Interval at which to watch for the
HTTP::sqli_requests_thresholdvariable to be crossed. At the end of each interval the counter is reset.
- HTTP::sqli_requests_threshold
-
Defines the threshold that determines if an SQL injection attack is ongoing based on the number of requests that appear to be SQL injection attacks.
Hooks
- HTTP::sqli_policy
- Type:
hook(c:connection, method:string, unescaped_URI:string) :bool
A hook that can be used to prevent specific requests from being counted as an injection attempt. Use a ‘break’ statement to exit the hook early and ignore the request.