Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ASM] Update fingerprint rules #6133

Merged
merged 3 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ namespace Datadog.Trace.AppSec.AttackerFingerprint;
internal static class AttackerFingerprintHelper
{
private static readonly IDatadogLogger Log = DatadogLogging.GetLoggerFor(typeof(AttackerFingerprintHelper));
private static readonly Dictionary<string, object> _fingerprintRequest = new() { { AddressesConstants.WafContextProcessor, new Dictionary<string, object> { { "fingerprint", true } } } };
private static bool _warningLogged = false;

public static void AddSpanTags(Span span)
public static void AddSpanTags(Span span, IResult result)
{
if (span.IsFinished || span.Type != SpanTypes.Web)
if (result?.FingerprintDerivatives is null || span.IsFinished || span.Type != SpanTypes.Web)
{
return;
}
Expand All @@ -33,8 +32,7 @@ public static void AddSpanTags(Span span)
return;
}

var result = securityCoordinator.RunWaf(_fingerprintRequest);
AddSpanTags(result?.FingerprintDerivatives, span);
AddSpanTags(result.FingerprintDerivatives, span);
}

private static void AddSpanTags(Dictionary<string, object?>? fingerPrintDerivatives, ISpan span)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ internal void TryReport(IResult result, bool blocked, int? status = null)
traceContext.AddWafSecurityEvents(result.Data);
}

AttackerFingerprintHelper.AddSpanTags(_localRootSpan);
AttackerFingerprintHelper.AddSpanTags(_localRootSpan, result);

var clientIp = _localRootSpan.GetTag(Tags.HttpClientIp);
if (!string.IsNullOrEmpty(clientIp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,23 @@
],
"processors": [
{
"id": "processor-001",
"id": "http-endpoint-fingerprint",
"generator": "http_endpoint_fingerprint",
"conditions": [
{
"operator": "equals",
"operator": "exists",
"parameters": {
"inputs": [
{
"address": "waf.context.processor",
"key_path": [
"fingerprint"
]
"address": "waf.context.event"
},
{
"address": "server.business_logic.users.login.failure"
},
{
"address": "server.business_logic.users.login.success"
}
],
"value": true,
"type": "boolean"
]
}
}
],
Expand Down Expand Up @@ -62,26 +63,27 @@
}
]
},
"evaluate": true,
"evaluate": false,
"output": true
},
{
"id": "processor-002",
"id": "http-header-fingerprint",
"generator": "http_header_fingerprint",
"conditions": [
{
"operator": "equals",
"operator": "exists",
"parameters": {
"inputs": [
{
"address": "waf.context.processor",
"key_path": [
"fingerprint"
]
"address": "waf.context.event"
},
{
"address": "server.business_logic.users.login.failure"
},
{
"address": "server.business_logic.users.login.success"
}
],
"value": true,
"type": "boolean"
]
}
}
],
Expand All @@ -97,26 +99,27 @@
}
]
},
"evaluate": true,
"evaluate": false,
"output": true
},
{
"id": "processor-003",
"id": "http-network-fingerprint",
"generator": "http_network_fingerprint",
"conditions": [
{
"operator": "equals",
"operator": "exists",
"parameters": {
"inputs": [
{
"address": "waf.context.processor",
"key_path": [
"fingerprint"
]
"address": "waf.context.event"
},
{
"address": "server.business_logic.users.login.failure"
},
{
"address": "server.business_logic.users.login.success"
}
],
"value": true,
"type": "boolean"
]
}
}
],
Expand All @@ -132,26 +135,27 @@
}
]
},
"evaluate": true,
"evaluate": false,
"output": true
},
{
"id": "processor-004",
"id": "session-fingerprint",
"generator": "session_fingerprint",
"conditions": [
{
"operator": "equals",
"operator": "exists",
"parameters": {
"inputs": [
{
"address": "waf.context.processor",
"key_path": [
"fingerprint"
]
"address": "waf.context.event"
},
{
"address": "server.business_logic.users.login.failure"
},
{
"address": "server.business_logic.users.login.success"
}
],
"value": true,
"type": "boolean"
]
}
}
],
Expand All @@ -177,7 +181,7 @@
}
]
},
"evaluate": true,
"evaluate": false,
"output": true
}
],
Expand Down Expand Up @@ -456,6 +460,35 @@
"block"
]
},
{
"id": "ua0-600-12x",
"name": "Arachni",
"tags": {
"type": "attack_tool",
"category": "attack_attempt",
"cwe": "200",
"capec": "1000/118/169",
"tool_name": "Arachni",
"confidence": "1"
},
"conditions": [
{
"parameters": {
"inputs": [
{
"address": "server.request.headers.no_cookies",
"key_path": [
"user-agent"
]
}
],
"regex": "^Arachni\\/v"
},
"operator": "match_regex"
}
],
"transformers": []
},
{
"id": "rasp-932-400",
"name": "New exploit",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,23 @@
],
"processors": [
{
"id": "processor-001",
"id": "http-endpoint-fingerprint",
"generator": "http_endpoint_fingerprint",
"conditions": [
{
"operator": "equals",
"operator": "exists",
"parameters": {
"inputs": [
{
"address": "waf.context.processor",
"key_path": [
"fingerprint"
]
"address": "waf.context.event"
},
{
"address": "server.business_logic.users.login.failure"
},
{
"address": "server.business_logic.users.login.success"
}
],
"value": true,
"type": "boolean"
]
}
}
],
Expand Down Expand Up @@ -62,26 +63,27 @@
}
]
},
"evaluate": true,
"evaluate": false,
"output": true
},
{
"id": "processor-002",
"id": "http-header-fingerprint",
"generator": "http_header_fingerprint",
"conditions": [
{
"operator": "equals",
"operator": "exists",
"parameters": {
"inputs": [
{
"address": "waf.context.processor",
"key_path": [
"fingerprint"
]
"address": "waf.context.event"
},
{
"address": "server.business_logic.users.login.failure"
},
{
"address": "server.business_logic.users.login.success"
}
],
"value": true,
"type": "boolean"
]
}
}
],
Expand All @@ -97,26 +99,27 @@
}
]
},
"evaluate": true,
"evaluate": false,
"output": true
},
{
"id": "processor-003",
"id": "http-network-fingerprint",
"generator": "http_network_fingerprint",
"conditions": [
{
"operator": "equals",
"operator": "exists",
"parameters": {
"inputs": [
{
"address": "waf.context.processor",
"key_path": [
"fingerprint"
]
"address": "waf.context.event"
},
{
"address": "server.business_logic.users.login.failure"
},
{
"address": "server.business_logic.users.login.success"
}
],
"value": true,
"type": "boolean"
]
}
}
],
Expand All @@ -132,26 +135,27 @@
}
]
},
"evaluate": true,
"evaluate": false,
"output": true
},
{
"id": "processor-004",
"id": "session-fingerprint",
"generator": "session_fingerprint",
"conditions": [
{
"operator": "equals",
"operator": "exists",
"parameters": {
"inputs": [
{
"address": "waf.context.processor",
"key_path": [
"fingerprint"
]
"address": "waf.context.event"
},
{
"address": "server.business_logic.users.login.failure"
},
{
"address": "server.business_logic.users.login.success"
}
],
"value": true,
"type": "boolean"
]
}
}
],
Expand All @@ -177,7 +181,7 @@
}
]
},
"evaluate": true,
"evaluate": false,
"output": true
}
],
Expand Down
Loading
Loading