Detection rules › Elastic

Persistence via GenAI Tool

Time window
1m
Sequence by
process.entity_id
Source
github.com/elastic/protections-artifacts

Detects when a GenAI process or descendant attempts to modify commonly abused file persistence entries. This activity could be the result of exploiting a prompt injection vulnerability or compromised external dependency.

MITRE ATT&CK coverage

Telemetry coverage

Rule body

[rule]
description = """
Detects when a GenAI process or descendant attempts to modify commonly abused file persistence entries. This activity
could be the result of exploiting a prompt injection vulnerability or compromised external dependency.
"""
id = "1a2e350a-4f4b-411b-af91-b1555eebe17f"
license = "Elastic License v2"
name = "Persistence via GenAI Tool"
os_list = ["macos", "windows"]
reference = [
    "https://cymulate.com/blog/cve-2025-547954-54795-claude-inverseprompt/",
    "https://specterops.io/blog/2025/11/21/an-evening-with-claude-code/",
    "https://www.straiker.ai/blog/nomshub-cursor-remote-tunneling-sandbox-breakout",
]
version = "1.0.7"

query = '''
sequence by process.entity_id with maxspan=1m
[process where event.type == "start" and event.action in ("exec", "start") and
 (
  process.parent.name in ("claude", "claude.exe", "cursor.exe", "cursor", "Cursor", "codex", "codex.exe", "sandbox-exec",
  "openai", "openai.exe", "ollama.exe", "ollama", "textgen.exe", "textgen", "lmstudio.exe", "lmstudio",
  "copilot.exe", "copilot", "gemini-cli.exe", "llm", "windsurf", "windsurf.exe", "Windsurf.exe", "Windsurf Helper", "Windsurf Helper (Plugin)", "Windsurf Helper (Renderer)", "Windsurf Helper (GPU)") or

  descendant of [process where event.action in ("exec", "start") and
                 process.parent.name in ("claude", "claude.exe", "cursor.exe", "cursor", "codex", "codex.exe", "sandbox-exec",
                 "openai", "openai.exe", "ollama.exe", "ollama", "textgen.exe", "textgen", "lmstudio.exe", "lmstudio", "copilot.exe",
                 "copilot", "gemini-cli.exe", "llm", "windsurf", "windsurf.exe", "Windsurf.exe", "Windsurf Helper", "Windsurf Helper (Plugin)", "Windsurf Helper (Renderer)", "Windsurf Helper (GPU)")]
 ) and
 not process.Ext.effective_parent.executable == "/opt/jc/bin/jumpcloud-agent" and
 not (process.executable like ("/opt/homebrew/Library/Homebrew/vendor/portable-ruby/*/bin/ruby",
                               "/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/*/bin/ruby") and
      process.args in ("/opt/homebrew/Library/Homebrew/brew.rb",
                       "/usr/local/Homebrew/Library/Homebrew/brew.rb") and
      process.args == "services")]
[file where not event.action in ("deletion", "open", "rename") and
  file.path : ("/private/etc/rc.local",
               "/etc/rc.local",
               "/etc/sudoers",
               "/System/Library/LaunchAgents/*.plist",
               "/Library/LaunchAgents/*.plist",
               "/Users/*/Library/LaunchAgents/*.plist",
               "/System/Library/LaunchDaemons/*.plist",
               "/Library/LaunchDaemons/*.plist",
               "?:\\Users\\*\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\*",
               "?:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\*") and
  not file.name : "com.github.facebook.watchman.plist" and
  not process.code_signature.subject_name == "Ollama Inc."]
'''

min_endpoint_version = "8.10.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1037"
name = "Boot or Logon Initialization Scripts"
reference = "https://attack.mitre.org/techniques/T1037/"
[[threat.technique.subtechnique]]
id = "T1037.004"
name = "RC Scripts"
reference = "https://attack.mitre.org/techniques/T1037/004/"


[[threat.technique]]
id = "T1543"
name = "Create or Modify System Process"
reference = "https://attack.mitre.org/techniques/T1543/"
[[threat.technique.subtechnique]]
id = "T1543.001"
name = "Launch Agent"
reference = "https://attack.mitre.org/techniques/T1543/001/"

[[threat.technique.subtechnique]]
id = "T1543.004"
name = "Launch Daemon"
reference = "https://attack.mitre.org/techniques/T1543/004/"


[[threat.technique]]
id = "T1547"
name = "Boot or Logon Autostart Execution"
reference = "https://attack.mitre.org/techniques/T1547/"
[[threat.technique.subtechnique]]
id = "T1547.001"
name = "Registry Run Keys / Startup Folder"
reference = "https://attack.mitre.org/techniques/T1547/001/"



[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"

[internal]
min_endpoint_version = "8.10.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id.

Stage 1: process

[process where event.type == "start" and event.action in ("exec", "start") and
 (
  process.parent.name in ("claude", "claude.exe", "cursor.exe", "cursor", "Cursor", "codex", "codex.exe", "sandbox-exec",
  "openai", "openai.exe", "ollama.exe", "ollama", "textgen.exe", "textgen", "lmstudio.exe", "lmstudio",
  "copilot.exe", "copilot", "gemini-cli.exe", "llm", "windsurf", "windsurf.exe", "Windsurf.exe", "Windsurf Helper", "Windsurf Helper (Plugin)", "Windsurf Helper (Renderer)", "Windsurf Helper (GPU)") or

  descendant of [process where event.action in ("exec", "start") and
                 process.parent.name in ("claude", "claude.exe", "cursor.exe", "cursor", "codex", "codex.exe", "sandbox-exec",
                 "openai", "openai.exe", "ollama.exe", "ollama", "textgen.exe", "textgen", "lmstudio.exe", "lmstudio", "copilot.exe",
                 "copilot", "gemini-cli.exe", "llm", "windsurf", "windsurf.exe", "Windsurf.exe", "Windsurf Helper", "Windsurf Helper (Plugin)", "Windsurf Helper (Renderer)", "Windsurf Helper (GPU)")]
 ) and
 not process.Ext.effective_parent.executable == "/opt/jc/bin/jumpcloud-agent" and
 not (process.executable like ("/opt/homebrew/Library/Homebrew/vendor/portable-ruby/*/bin/ruby",
                               "/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/*/bin/ruby") and
      process.args in ("/opt/homebrew/Library/Homebrew/brew.rb",
                       "/usr/local/Homebrew/Library/Homebrew/brew.rb") and
      process.args == "services")]

Stage 2: file

[file where not event.action in ("deletion", "open", "rename") and
  file.path : ("/private/etc/rc.local",
               "/etc/rc.local",
               "/etc/sudoers",
               "/System/Library/LaunchAgents/*.plist",
               "/Library/LaunchAgents/*.plist",
               "/Users/*/Library/LaunchAgents/*.plist",
               "/System/Library/LaunchDaemons/*.plist",
               "/Library/LaunchDaemons/*.plist",
               "?:\\Users\\*\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\*",
               "?:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\*") and
  not file.name : "com.github.facebook.watchman.plist" and
  not process.code_signature.subject_name == "Ollama Inc."]

Exclusions

The rule actively suppresses these predicates.

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionin
  • exec
  • start
field:"EventType" kind:in
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
file.pathwildcard
  • /Library/LaunchAgents/*.plist
  • /Library/LaunchDaemons/*.plist
  • /System/Library/LaunchAgents/*.plist
  • /System/Library/LaunchDaemons/*.plist
  • /Users/*/Library/LaunchAgents/*.plist
  • /etc/rc.local
  • /etc/sudoers
  • /private/etc/rc.local
  • ?:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\*
  • ?:\Users\*\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\*
field:"TargetFilename" kind:wildcard
process.parent.namein
  • Cursor
  • Windsurf Helper
  • Windsurf Helper (GPU)
  • Windsurf Helper (Plugin)
  • Windsurf Helper (Renderer)
  • Windsurf.exe
  • claude
  • claude.exe
  • codex
  • codex.exe
  • copilot
  • copilot.exe
  • cursor
  • cursor.exe
  • gemini-cli.exe
  • llm
  • lmstudio
  • lmstudio.exe
  • ollama
  • ollama.exe
  • openai
  • openai.exe
  • sandbox-exec
  • textgen
  • textgen.exe
  • windsurf
  • windsurf.exe
field:"parent_process_name" kind:in