-
Notifications
You must be signed in to change notification settings - Fork 521
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
[New Rules] Azure OpenAI #3701
base: main
Are you sure you want to change the base?
[New Rules] Azure OpenAI #3701
Changes from 4 commits
7c159d1
5c5643f
cc48be4
068bead
60c1e0d
8504d57
5fd0819
94c67c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,50 @@ | ||||||
[metadata] | ||||||
creation_date = "2024/05/05" | ||||||
maturity = "production" | ||||||
updated_date = "2024/05/05" | ||||||
min_stack_comments = "ES|QL rule type is still in technical preview as of 8.13, however this rule was tested successfully; integration in tech preview" | ||||||
min_stack_version = "8.13.0" | ||||||
|
||||||
[rule] | ||||||
author = ["Elastic"] | ||||||
description = """ | ||||||
Detects patterns indicative of Denial of Service attacks on ML models, focusing on unusually high volume and frequency | ||||||
of requests or patterns of requests that are known to cause performance degradation or service disruption, such as | ||||||
large input sizes or rapid API calls. | ||||||
""" | ||||||
false_positives = ["Unexpected system errors", "Legitimate spikes in usage due to business processes"] | ||||||
from = "now-60m" | ||||||
interval = "10m" | ||||||
language = "esql" | ||||||
license = "Elastic License v2" | ||||||
name = "Potential Denial of Azure OpenAI ML Service" | ||||||
references = [ | ||||||
"https://genai.owasp.org/llmrisk/llm04-model-denial-of-service", | ||||||
"https://atlas.mitre.org/techniques/AML.T0029" | ||||||
] | ||||||
risk_score = 47 | ||||||
rule_id = "b0450411-46e5-46d2-9b35-8b5dd9ba763e" | ||||||
setup = """## Setup | ||||||
|
||||||
For more information on streaming events, see the Azure OpenAI documentation: | ||||||
|
||||||
https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/stream-monitoring-data-event-hubs | ||||||
""" | ||||||
severity = "medium" | ||||||
tags = [ | ||||||
"Domain: LLM", | ||||||
"Data Source: Azure OpenAI", | ||||||
"Data Source: Azure Event Hubs", | ||||||
"Use Case: Denial of Service", | ||||||
"Mitre Atlas: T0029" | ||||||
] | ||||||
timestamp_override = "event.ingested" | ||||||
type = "esql" | ||||||
|
||||||
query = ''' | ||||||
from logs-azure_openai.logs-* | ||||||
| where azure.open_ai.operation_name == "ChatCompletions_Create" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to Self azure.open_ai.properties.operation_id == "ChatCompletions_Create" in the latest Mappings of the integration azure.open_ai.operation_name is mapped to "Microsoft.ApiManagement/GatewayLogs" azure.open_ai.properties.request_length is not mapped but we do have azure.open_ai.properties.response_length in the document mapping. |
||||||
| stats count = count(), avg_request_size = avg(azure.open_ai.properties.request_length) by azure.resource.id | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ++ also helps with FP from collisions/RC 1001 users making 1 request each in an hour may be normal |
||||||
| where count > 1000 OR avg_request_size > 5000 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer lowercase, but its purely stylistic at this point, but at a minimum, we should be consistent where possible
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion : add a comment to explain the size is it in kb or bytes, also use |
||||||
| sort count desc | ||||||
''' |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,48 @@ | ||||||
[metadata] | ||||||
creation_date = "2024/05/22" | ||||||
maturity = "production" | ||||||
updated_date = "2024/05/22" | ||||||
min_stack_comments = "ES|QL rule type is still in experimental as of 8.13, however this rule was tested successfully; integration in experimental" | ||||||
min_stack_version = "8.13.0" | ||||||
|
||||||
[rule] | ||||||
author = ["Elastic"] | ||||||
description = """ | ||||||
Detects when Azure OpenAI requests result in zero response length, potentially indicating issues in output handling | ||||||
that might lead to security exploits such as data leaks or code execution. This can occur in cases where the API fails | ||||||
to handle outputs correctly under certain input conditions. | ||||||
""" | ||||||
false_positives = ["Queries that are designed to expect empty responses or benign system errors"] | ||||||
from = "now-60m" | ||||||
interval = "10m" | ||||||
language = "esql" | ||||||
license = "Elastic License v2" | ||||||
name = "Azure OpenAI Insecure Output Handling Detection" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
references = [ | ||||||
"https://genai.owasp.org/llmrisk/llm02-insecure-output-handling" | ||||||
] | ||||||
risk_score = 21 | ||||||
rule_id = "fb16f9ef-cb03-4234-adc2-44641f3b71ee" | ||||||
setup = """## Setup | ||||||
|
||||||
For more information on streaming events, see the Azure OpenAI documentation: | ||||||
|
||||||
https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/stream-monitoring-data-event-hubs | ||||||
""" | ||||||
severity = "low" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if this behavior is rare than maybe bump up severity |
||||||
tags = [ | ||||||
"Domain: LLM", | ||||||
"Data Source: Azure OpenAI", | ||||||
"Data Source: Azure Event Hubs", | ||||||
"Use Case: Insecure Output Handling" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any specific MITRE ATLAS tag here? |
||||||
] | ||||||
timestamp_override = "event.ingested" | ||||||
type = "esql" | ||||||
|
||||||
query = ''' | ||||||
from logs-azure_openai.logs-* | ||||||
| where azure.open_ai.properties.response_length == 0 and azure.open_ai.result_signature == "200" and azure.open_ai.operation_name == "ChatCompletions_Create" | ||||||
| stats count = count() by azure.resource.id, azure.open_ai.operation_name | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there a field that can be used in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also are there ECS compatible alternatives for any of these? Can you share some data / docs of these events There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also are there ECS compatible alternatives for any of these? Can you share some data / docs of these events |
||||||
| where count > 10 | ||||||
| sort count desc | ||||||
''' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
[metadata] | ||
creation_date = "2024/05/05" | ||
maturity = "production" | ||
updated_date = "2024/05/05" | ||
min_stack_comments = "ES|QL rule type is still in technical preview as of 8.13, however this rule was tested successfully; integration in tech preview" | ||
min_stack_version = "8.13.0" | ||
|
||
[rule] | ||
author = ["Elastic"] | ||
description = """ | ||
Monitors for suspicious activities that may indicate theft or unauthorized duplication of ML models, such as | ||
shashank-elastic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
unauthorized API calls, atypical access patterns, or large data transfers that are unusual during model interactions. | ||
""" | ||
false_positives = ["Authorized model training", "Legitimate high volume data exchanges during scheduled updates"] | ||
from = "now-60m" | ||
interval = "10m" | ||
language = "esql" | ||
license = "Elastic License v2" | ||
name = "Potential Azure OpenAI Model Theft Detection" | ||
shashank-elastic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
references = [ | ||
"https://genai.owasp.org/llmrisk/llm10-model-theft", | ||
"https://atlas.mitre.org/techniques/AML.T0044" | ||
] | ||
risk_score = 47 | ||
rule_id = "4021e78d-5293-48d3-adee-a70fa4c18fab" | ||
setup = """## Setup | ||
|
||
For more information on | ||
streaming events, see the Azure OpenAI documentation: | ||
|
||
https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/stream-monitoring-data-event-hubs | ||
""" | ||
severity = "medium" | ||
tags = [ | ||
"Domain: LLM", | ||
"Data Source: Azure OpenAI", | ||
"Data Source: Azure Event Hubs", | ||
"Use Case: Model Theft", | ||
"Mitre Atlas: T0044" | ||
] | ||
timestamp_override = "event.ingested" | ||
type = "esql" | ||
|
||
query = ''' | ||
from logs-azure_openai.logs-* | ||
| where azure.open_ai.operation_name == "ListKey" and azure.open_ai.category == "Audit" | ||
| stats count = count(), max_data_transferred = max(azure.open_ai.properties.response_length) by azure.open_ai.properties.model_name | ||
shashank-elastic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| where count > 100 OR max_data_transferred > 1000000 | ||
shashank-elastic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| sort count desc | ||
''' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.