From: Bhagyashree Bantwal Date: Thu, 8 Jan 2015 15:57:18 +0000 (-0500) Subject: Http Inspect Profile changes to Snort++ X-Git-Tag: 3.0.0-233~1092 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0fd9654492ca2cb2da037dccebeb60cc66b0553;p=thirdparty%2Fsnort3.git Http Inspect Profile changes to Snort++ --- diff --git a/lua/snort_defaults.lua b/lua/snort_defaults.lua index d827c3ed9..2ff570e09 100644 --- a/lua/snort_defaults.lua +++ b/lua/snort_defaults.lua @@ -211,6 +211,136 @@ http_methods = -- build from default_http_methods 'RPC_IN_DATA', 'RPC_OUT_DATA', 'RPC_ECHO_DATA' } +all = +{ + profile_value = 'all', + server_flow_depth = 300, + client_flow_depth = 300, + post_depth = -1, + chunk_length = 500000, + ascii = true, + multiple_slash = true, + directory = true, + webroot = true, + double_decoding = true, + u_encoding = true, + bare_byte = true, + iis_unicode = true, + iis_backslash = true, + iis_delimiter = true, + apache_whitespace = true, + non_strict = true, + normalize_utf = true, + normalize_javascript = false, + max_hdr_len = 0, + max_headers = 0, + max_spaces = 200, + max_javascript_whitespaces = 200 +} + +apache = +{ + profile_value = 'apache', + server_flow_depth = 300, + client_flow_depth = 300, + post_depth = -1, + chunk_length = 500000, + ascii = true, + multiple_slash = true, + directory = true, + webroot = true, + utf_8 = true, + apache_whitespace = true, + non_strict = true, + normalize_utf = true, + normalize_javascript = false, + max_hdr_len = 0, + max_headers = 0, + max_spaces = 200, + max_javascript_whitespaces = 200 +} + +iis = +{ + profile_value = 'iis', + server_flow_depth = 300, + client_flow_depth = 300, + post_depth = -1, + chunk_length = 500000, + ascii = true, + multiple_slash = true, + directory = true, + webroot = true, + double_decoding = false, + u_encoding = true, + bare_byte = true, + iis_unicode = true, + iis_backslash = true, + iis_delimiter = true, + apache_whitespace = true, + non_strict = true, + normalize_utf = true, + normalize_javascript = false, + max_hdr_len = 0, + max_headers = 0, + max_spaces = 200, + max_javascript_whitespaces = 200 +} + +iis_40 = +{ + profile_value = 'iis_40', + server_flow_depth = 300, + client_flow_depth = 300, + post_depth = -1, + chunk_length = 500000, + ascii = true, + multiple_slash = true, + directory = true, + webroot = true, + double_decoding = true, + u_encoding = true, + bare_byte = true, + iis_unicode = true, + iis_backslash = true, + iis_delimiter = true, + apache_whitespace = true, + non_strict = true, + normalize_utf = true, + normalize_javascript = false, + max_hdr_len = 0, + max_headers = 0, + max_spaces = 200, + max_javascript_whitespaces = 200 +} + +iis_50 = +{ + profile_value = 'iis_50', + server_flow_depth = 300, + client_flow_depth = 300, + post_depth = -1, + chunk_length = 500000, + ascii = true, + multiple_slash = true, + directory = true, + webroot = true, + double_decoding = true, + u_encoding = true, + bare_byte = true, + iis_unicode = true, + iis_backslash = true, + iis_delimiter = true, + apache_whitespace = true, + non_strict = true, + normalize_utf = true, + normalize_javascript = false, + max_hdr_len = 0, + max_headers = 0, + max_spaces = 200, + max_javascript_whitespaces = 200 +} + ftp_commands = -- build from ftp_default_commands { 'ABOR', 'ACCT', 'ADAT', 'ALLO', 'APPE', 'AUTH', 'CCC', 'CDUP', 'CEL', diff --git a/src/service_inspectors/http_inspect/hi_module.cc b/src/service_inspectors/http_inspect/hi_module.cc index 5cdad582c..0710a71ac 100644 --- a/src/service_inspectors/http_inspect/hi_module.cc +++ b/src/service_inspectors/http_inspect/hi_module.cc @@ -267,11 +267,8 @@ bool HttpInspectModule::end(const char* fqn, int, SnortConfig*) // different profiles (like above) and use those. rename existing profile // to profile_type. -static const Parameter hi_server_params[] = +static const Parameter hi_profile_server_params[] = { - { "allow_proxy_use", Parameter::PT_BOOL, nullptr, "false", - "don't alert on proxy use for this server" }, - { "apache_whitespace", Parameter::PT_BOOL, nullptr, "false", "don't alert if tab is used in lieu of space characters" }, @@ -294,6 +291,69 @@ static const Parameter hi_server_params[] = { "double_decode", Parameter::PT_BOOL, nullptr, "false", "iis specific extra decoding" }, + { "iis_backslash", Parameter::PT_BOOL, nullptr, "false", + "normalize directory slashes" }, + + { "iis_delimiter", Parameter::PT_BOOL, nullptr, "false", + "allow use of non-standard delimiter" }, + + { "iis_unicode", Parameter::PT_BOOL, nullptr, "false", + "enable unicode code point mapping using unicode_map settings" }, + + { "iis_unicode_map", Parameter::PT_TABLE, hi_umap_params, nullptr, + "server unicode map configuration" }, + + { "max_header_length", Parameter::PT_INT, "0:65535", "750", + "maximum allowed client request header field" }, + + { "max_headers", Parameter::PT_INT, "0:1024", "100", + "maximum allowed client request headers" }, + + { "max_spaces", Parameter::PT_INT, "0:65535", "200", + "maximum allowed whitespaces when folding" }, + + { "multi_slash", Parameter::PT_BOOL, nullptr, "false", + "normalize out consecutive slashes in URI" }, + + { "non_strict", Parameter::PT_BOOL, nullptr, "true", + "allows HTTP 0.9 processing" }, + + { "max_javascript_whitespaces", Parameter::PT_INT, "0:", "200", + "maximum number of consecutive whitespaces" }, + + { "normalize_utf", Parameter::PT_BOOL, nullptr, "true", + "normalize response bodies with UTF content-types" }, + + { "post_depth", Parameter::PT_INT, "-1:65535", "65495", + "amount of POST data to inspect" }, + + { "profile_value", Parameter::PT_ENUM, profiles, "none", + "set defaults appropriate for selected server" }, + + { "server_flow_depth", Parameter::PT_INT, "-1:65535", "0", + "response payload to inspect; includes headers with extended_response_inspection" }, + + { "u_encode", Parameter::PT_BOOL, nullptr, "true", + "decode %uXXXX character sequences" }, + + { "utf_8", Parameter::PT_BOOL, nullptr, "false", + "decode UTF-8 unicode sequences in URI" }, + + { "webroot", Parameter::PT_BOOL, nullptr, "false", + "alert on directory traversals past the top level (web server root)" }, + + { "whitespace_chars", Parameter::PT_BIT_LIST, "255", nullptr, + "allowed white space characters" }, + + { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr } +}; + + +static const Parameter hi_server_params[] = +{ + { "allow_proxy_use", Parameter::PT_BOOL, nullptr, "false", + "don't alert on proxy use for this server" }, + { "enable_cookies", Parameter::PT_BOOL, nullptr, "true", "extract cookies" }, @@ -309,18 +369,6 @@ static const Parameter hi_server_params[] = { "http_methods", Parameter::PT_STRING, nullptr, default_methods, "request methods allowed in addition to GET and POST" }, - { "iis_backslash", Parameter::PT_BOOL, nullptr, "false", - "normalize directory slashes" }, - - { "iis_delimiter", Parameter::PT_BOOL, nullptr, "false", - "allow use of non-standard delimiter" }, - - { "iis_unicode", Parameter::PT_BOOL, nullptr, "false", - "enable unicode code point mapping using unicode_map settings" }, - - { "iis_unicode_map", Parameter::PT_TABLE, hi_umap_params, nullptr, - "server unicode map configuration" }, - { "inspect_gzip", Parameter::PT_BOOL, nullptr, "true", "enable gzip decompression of compressed bodies" }, @@ -333,27 +381,12 @@ static const Parameter hi_server_params[] = { "log_uri", Parameter::PT_BOOL, nullptr, "false", "enable logging of URI with unified2 alerts as extra data" }, - { "max_header_length", Parameter::PT_INT, "0:65535", "750", - "maximum allowed client request header field" }, - - { "max_headers", Parameter::PT_INT, "0:1024", "100", - "maximum allowed client request headers" }, - - { "max_spaces", Parameter::PT_INT, "0:65535", "200", - "maximum allowed whitespaces when folding" }, - - { "multi_slash", Parameter::PT_BOOL, nullptr, "false", - "normalize out consecutive slashes in URI" }, - { "no_pipeline_req", Parameter::PT_BOOL, nullptr, "false", "don't inspect pipelined requests after first (still does general detection)" }, { "non_rfc_chars", Parameter::PT_BIT_LIST, "255", default_non_rfc_chars, "alert on given non-RFC chars being present in the URI" }, - { "non_strict", Parameter::PT_BOOL, nullptr, "true", - "allows HTTP 0.9 processing" }, - { "normalize_cookies", Parameter::PT_BOOL, nullptr, "false", "normalize cookies similar to URI" }, @@ -363,24 +396,12 @@ static const Parameter hi_server_params[] = { "normalize_javascript", Parameter::PT_BOOL, nullptr, "true", "normalize javascript between