EXPLORE
← Back to Explore
elasticmediumTTP

GenAI Prompt Contains Cryptographic Hash String

Detects hex-encoded hash strings (MD5, SHA-1, SHA-256, SHA-512) within GenAI prompt or completion text. The security_ai ML model has identified one or more candidate strings whose character distribution matches a cryptographic digest. Attackers may pass hashes in prompts to exfiltrate credentials for offline cracking, to reference stolen data without sending plaintext, or as part of prompt injection payloads that encode malicious instructions as hex data.

MITRE ATT&CK

credential-access

Detection Query

data_stream.dataset : (
    "aws_bedrock.invocation" or
    "openai_chatgpt_enterprise.codex_log" or
    "openai_chatgpt_enterprise.conversation_message" or
    "openai_chatgpt_enterprise.custom_agents_log"
) and (security_ai.hash_string.input_messages.strings : * or security_ai.hash_string.output_messages.strings : *)

Author

Elastic

Created

2026/08/18

Data Sources

AWS BedrockOpenAI ChatGPT Enterpriselogs-aws_bedrock.invocation-*logs-openai_chatgpt_enterprise.codex_log-*logs-openai_chatgpt_enterprise.conversation_message-*logs-openai_chatgpt_enterprise.custom_agents_log-*

Tags

Domain: GenAIUse Case: Security for AITactic: Credential AccessTactic: ExfiltrationMitre Atlas: AML.T0057Data Source: AWS BedrockData Source: OpenAI ChatGPT EnterprisePlatform: AWSPlatform: OpenAIService: AWS BedrockService: OpenAI ChatGPT EnterpriseRule Type: Custom Query (KQL)Resources: Investigation Guide
Raw Content
[metadata]
creation_date = "2026/08/18"
integration = ["security_ai", "aws_bedrock", "openai_chatgpt_enterprise"]
maturity = "production"
min_stack_comments = "Detection rules for the security_ai integration package are supported in v9.6.0 and above"
min_stack_version = "9.6.0"
updated_date = "2026/11/06"

[rule]
author = ["Elastic"]
description = """
Detects hex-encoded hash strings (MD5, SHA-1, SHA-256, SHA-512) within GenAI
prompt or completion text. The security_ai ML model has identified
one or more candidate strings whose character distribution matches a cryptographic
digest. Attackers may pass hashes in prompts to exfiltrate credentials for
offline cracking, to reference stolen data without sending plaintext, or as part
of prompt injection payloads that encode malicious instructions as hex data.
"""
false_positives = [
    """
    Security or forensics workflows that send file hashes to a model for threat
    intelligence lookup or malware triage. Review the surrounding context and
    verify the hash does not correspond to a credential or sensitive artifact.
    """,
    """
    Development tooling that includes git commit SHAs, Docker image digests, or
    package checksums in prompts for CI/CD automation.
    """,
]
from = "now-6m"
index = [
    "logs-aws_bedrock.invocation-*",
    "logs-openai_chatgpt_enterprise.codex_log-*",
    "logs-openai_chatgpt_enterprise.conversation_message-*",
    "logs-openai_chatgpt_enterprise.custom_agents_log-*",
]
language = "kuery"
license = "Elastic License v2"
name = "GenAI Prompt Contains Cryptographic Hash String"
note = """
## Triage and Analysis

### Investigating GenAI Prompt Contains Cryptographic Hash String

The `security_ai` ML integration has flagged one or more hex digest
strings in a GenAI prompt or completion. Hash strings in LLM context can indicate
credential theft (passing NTLM/password hashes for cracking), data exfiltration
via digest fingerprints, or encoded prompt injection payloads.

### Possible investigation steps

- Examine `security_ai.hash_string.input_messages.strings` for hashes in the user input,
  and `security_ai.hash_string.output_messages.strings` for hashes in the model response.
  Note the length to infer the algorithm:
  - 32 chars → MD5
  - 40 chars → SHA-1
  - 64 chars → SHA-256
  - 128 chars → SHA-512
- Check the corresponding `.probabilities` arrays — higher values indicate stronger
  model confidence.
- The `input_messages` scope covers the last user turn in `gen_ai.input.messages`; the
  `output_messages` scope covers the last assistant turn in `gen_ai.output.messages`. A hit
  in `output_messages` means the hash appeared in the model's own response.
- Review `gen_ai.input.messages` or `gen_ai.output.messages` for the full conversation context:
  - Is the hash referenced alongside a username or credential field? May indicate
    pass-the-hash or credential exfiltration.
  - Is the hash part of a sequence of encoded values? May indicate a structured
    exfiltration payload.
  - Is the hash a known-bad IOC? Query threat intelligence feeds.
- Identify the originating user or application (`user.id`, `source.ip`,
  `user_agent.original`) and assess whether this is expected behavior.
- Examine the model's response (`gen_ai.output.messages`) — did the model decode,
  describe, or act on the hash in a way that reveals additional context?

### False positive analysis

- Security tooling that passes file hashes or commit SHAs to LLMs for threat
  intel enrichment is common. If the hash is a known benign artifact (git SHA,
  package checksum), this is likely a false positive.
- Tune with an exception for automation accounts or pipelines that regularly
  include hashes in prompts.

### Response and remediation

- If the hash corresponds to a credential or sensitive artifact, treat as a
  potential data exfiltration incident. Revoke affected credentials immediately.
- If the hash is part of a prompt injection payload, treat as an active attack.
  Revoke the API key or session and notify the account owner.
- Correlate with authentication logs to determine whether any pass-the-hash or
  lateral movement activity followed.
"""
references = [
    "https://owasp.org/www-project-top-10-for-large-language-model-applications/",
    "https://attack.mitre.org/techniques/T1110/002/",
]
risk_score = 47
rule_id = "aa3daae8-d479-46ce-a63f-6a695a8e28e5"
setup = """This rule requires the security_ai Fleet integration. Install the
integration and ensure that the ML model pipeline is enriching invocation events before
enabling this rule. For setup instructions, refer to the [Security for AI integration documentation](https://www.elastic.co/docs/reference/integrations/security_ai)."""
severity = "medium"
tags = [
    "Domain: GenAI",
    "Use Case: Security for AI",
    "Tactic: Credential Access",
    "Tactic: Exfiltration",
    "Mitre Atlas: AML.T0057",
    "Data Source: AWS Bedrock",
    "Data Source: OpenAI ChatGPT Enterprise",
    "Platform: AWS",
    "Platform: OpenAI",
    "Service: AWS Bedrock",
    "Service: OpenAI ChatGPT Enterprise",
    "Rule Type: Custom Query (KQL)",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
to = "now"
type = "query"

query = '''
data_stream.dataset : (
    "aws_bedrock.invocation" or
    "openai_chatgpt_enterprise.codex_log" or
    "openai_chatgpt_enterprise.conversation_message" or
    "openai_chatgpt_enterprise.custom_agents_log"
) and (security_ai.hash_string.input_messages.strings : * or security_ai.hash_string.output_messages.strings : *)
'''

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1110"
name = "Brute Force"
reference = "https://attack.mitre.org/techniques/T1110/"

[[rule.threat.technique.subtechnique]]
id = "T1110.002"
name = "Password Cracking"
reference = "https://attack.mitre.org/techniques/T1110/002/"

[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"

[[rule.threat_mappings]]
framework = "MITRE ATLAS"
version = "2026.08"

[[rule.threat_mappings.threat]]
framework = "MITRE ATLAS"

[[rule.threat_mappings.threat.technique]]
id = "AML.T0057"
name = "LLM Data Leakage"
reference = "https://atlas.mitre.org/techniques/AML.T0057/"

[rule.threat_mappings.threat.tactic]
id = "AML.TA0010"
name = "Exfiltration"
reference = "https://atlas.mitre.org/tactics/AML.TA0010/"