From eae71da3534a3cbbee13346994fc0cb4009dac56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Mazeau?= Date: Mon, 20 Feb 2023 14:21:27 +0100 Subject: [PATCH] internal/appsec: update security rules to v1.5.1 (#1750) --- internal/appsec/rules.go | 4 +-- internal/appsec/rules.json | 67 ++++++++++++++++++++------------------ 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/internal/appsec/rules.go b/internal/appsec/rules.go index a8f2e07e53..f851168c8f 100644 --- a/internal/appsec/rules.go +++ b/internal/appsec/rules.go @@ -10,8 +10,8 @@ package appsec import _ "embed" -// Static recommended AppSec rule 1.5.0 -// Source: https://github.com/DataDog/appsec-event-rules/blob/1.5.0/build/recommended.json +// Static recommended AppSec rule 1.5.1 +// Source: https://github.com/DataDog/appsec-event-rules/blob/1.5.1/build/recommended.json // //go:embed rules.json var staticRecommendedRules string diff --git a/internal/appsec/rules.json b/internal/appsec/rules.json index f1653a1252..9af17887d6 100644 --- a/internal/appsec/rules.json +++ b/internal/appsec/rules.json @@ -1,7 +1,7 @@ { "version": "2.2", "metadata": { - "rules_version": "1.5.0" + "rules_version": "1.5.1" }, "rules": [ { @@ -199,33 +199,6 @@ "lowercase" ] }, - { - "id": "crs-921-140", - "name": "HTTP Header Injection Attack via headers", - "tags": { - "type": "http_protocol_violation", - "crs_id": "921140", - "category": "attack_attempt" - }, - "conditions": [ - { - "parameters": { - "inputs": [ - { - "address": "server.request.headers.no_cookies" - } - ], - "regex": "[\\n\\r]", - "options": { - "case_sensitive": true, - "min_length": 1 - } - }, - "operator": "match_regex" - } - ], - "transformers": [] - }, { "id": "crs-921-160", "name": "HTTP Header Injection Attack via payload (CR/LF and header-name detected)", @@ -245,7 +218,7 @@ "address": "server.request.path_params" } ], - "regex": "[\\n\\r]+(?:\\s|location|refresh|(?:set-)?cookie|(?:x-)?(?:forwarded-(?:for|host|server)|host|via|remote-ip|remote-addr|originating-IP))\\s*:", + "regex": "[\\n\\r]+(?:refresh|(?:set-)?cookie|(?:x-)?(?:forwarded-(?:for|host|server)|via|remote-ip|remote-addr|originating-IP))\\s*:", "options": { "case_sensitive": true, "min_length": 3 @@ -278,7 +251,7 @@ "address": "server.request.headers.no_cookies" } ], - "regex": "(?:%(?:c(?:0%(?:[2aq]f|5c|9v)|1%(?:[19p]c|8s|af))|2(?:5(?:c(?:0%25af|1%259c)|2f|5c)|%46|f)|(?:(?:f(?:8%8)?0%8|e)0%80%a|bg%q)f|%3(?:2(?:%(?:%6|4)6|F)|5%%63)|u(?:221[56]|002f|EFC8|F025)|1u|5c)|0x(?:2f|5c)|\\/|\\x5c)(?:%(?:(?:f(?:(?:c%80|8)%8)?0%8|e)0%80%ae|2(?:(?:5(?:c0%25a|2))?e|%45)|u(?:(?:002|ff0)e|2024)|%32(?:%(?:%6|4)5|E)|c0(?:%[256aef]e|\\.))|\\.(?:%0[01]|\\?)?|\\?\\.?|0x2e){2,3}(?:%(?:c(?:0%(?:[2aq]f|5c|9v)|1%(?:[19p]c|8s|af))|2(?:5(?:c(?:0%25af|1%259c)|2f|5c)|%46|f)|(?:(?:f(?:8%8)?0%8|e)0%80%a|bg%q)f|%3(?:2(?:%(?:%6|4)6|F)|5%%63)|u(?:221[56]|002f|EFC8|F025)|1u|5c)|0x(?:2f|5c)|\\/|\\x5c)", + "regex": "(?:%(?:c(?:0%(?:[2aq]f|5c|9v)|1%(?:[19p]c|8s|af))|2(?:5(?:c(?:0%25af|1%259c)|2f|5c)|%46|f)|(?:(?:f(?:8%8)?0%8|e)0%80%a|bg%q)f|%3(?:2(?:%(?:%6|4)6|F)|5%%63)|u(?:221[56]|002f|EFC8|F025)|1u|5c)|0x(?:2f|5c)|\\/|\\x5c)(?:%(?:(?:f(?:(?:c%80|8)%8)?0%8|e)0%80%ae|2(?:(?:5(?:c0%25a|2))?e|%45)|u(?:(?:002|ff0)e|2024)|%32(?:%(?:%6|4)5|E)|c0(?:%[256aef]e|\\.))|\\.(?:%0[01])?|0x2e){2,3}(?:%(?:c(?:0%(?:[2aq]f|5c|9v)|1%(?:[19p]c|8s|af))|2(?:5(?:c(?:0%25af|1%259c)|2f|5c)|%46|f)|(?:(?:f(?:8%8)?0%8|e)0%80%a|bg%q)f|%3(?:2(?:%(?:%6|4)6|F)|5%%63)|u(?:221[56]|002f|EFC8|F025)|1u|5c)|0x(?:2f|5c)|\\/|\\x5c)", "options": { "min_length": 4 } @@ -1834,7 +1807,7 @@ "address": "server.request.path_params" } ], - "regex": "^(?i:file|ftps?|http)://.*?\\?+$", + "regex": "^(?i:file|ftps?)://.*?\\?+$", "options": { "case_sensitive": true, "min_length": 4 @@ -4452,6 +4425,36 @@ ], "transformers": [] }, + { + "id": "dog-934-001", + "name": "XXE - XML file loads external entity", + "tags": { + "type": "xxe", + "category": "attack_attempt", + "confidence": "0" + }, + "conditions": [ + { + "parameters": { + "inputs": [ + { + "address": "server.request.body" + }, + { + "address": "grpc.server.request.message" + } + ], + "regex": "(?:<\\?xml[^>]*>.*)]+SYSTEM\\s+[^>]+>", + "options": { + "case_sensitive": false, + "min_length": 24 + } + }, + "operator": "match_regex" + } + ], + "transformers": [] + }, { "id": "nfd-000-001", "name": "Detect common directory discovery scans", @@ -5275,7 +5278,7 @@ "address": "grpc.server.request.message" } ], - "regex": "^(jar:)?(http|https):\\/\\/([0-9oq]{1,5}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}|[0-9]{1,10})(:[0-9]{1,5})?(\\/.*|)$" + "regex": "^(jar:)?(http|https):\\/\\/([0-9oq]{1,5}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}|[0-9]{1,10})(:[0-9]{1,5})?(\\/[^:@]*)?$" }, "operator": "match_regex" }