Skip to content

cursor panthergen rule#1538

Merged
ben-githubs merged 2 commits intodevelopfrom
jn/cursor-rules
Mar 11, 2025
Merged

cursor panthergen rule#1538
ben-githubs merged 2 commits intodevelopfrom
jn/cursor-rules

Conversation

@jacknagz
Copy link
Contributor

Background

Add best practices for rule gen!

Changes

  • Add a Cursor Rule for rule gen

Testing

  • Wrote an osquery rule successfully using this!
def rule(event):
    # Check if this is from the apps table query
    if "apps" not in event.get("name", ""):
        return False

    # Check if this is a new app being added
    if event.get("action") != "added":
        return False

    # Check if the app name contains Cursor
    app_name = event.deep_get("columns", "name", default="").lower()
    return "cursor" in app_name


def title(event):
    hostname = event.get("hostIdentifier", "UNKNOWN_HOST")
    return f"Cursor IDE installation detected on [{hostname}]"


def alert_context(event):
    return {
        "hostname": event.get("hostIdentifier"),
        "app_name": event.deep_get("columns", "name"),
        "bundle_name": event.deep_get("columns", "bundle_name"),
        "bundle_version": event.deep_get("columns", "bundle_version"),
        "path": event.deep_get("columns", "path")
    } 
AnalysisType: rule
Filename: osquery_cursor_installation.py
RuleID: "Osquery.Mac.CursorInstallation"
DisplayName: "Cursor IDE Installation Detected"
Enabled: true
LogTypes:
  - Osquery.Differential
Tags:
  - Osquery
  - MacOS
  - Software Installation
  - Initial Access:Valid Accounts
Reports:
  MITRE ATT&CK:
    - TA0001:T1078
Severity: Medium
Description: >
  Detects when the Cursor IDE is installed on a MacOS system. Cursor is an AI-powered code editor
  that should be monitored as it may have access to sensitive code and development environments.
Runbook: >
  1. Verify if the installation was authorized and performed by the user
  2. Check if the installation complies with organization's software policies
  3. If unauthorized, remove the application and investigate how it was installed
Reference: https://cursor.sh/
SummaryAttributes:
  - name
  - hostIdentifier
  - action
Tests:
  - Name: Cursor Installation Detected
    ExpectedResult: true
    Log:
      {
        "name": "pack_apps_macos_apps",
        "action": "added",
        "hostIdentifier": "test-mac.local",
        "columns": {
          "name": "Cursor",
          "bundle_name": "sh.cursor.Cursor",
          "bundle_version": "1.0.0",
          "path": "/Applications/Cursor.app"
        }
      }
  - Name: Non-Cursor App Installation
    ExpectedResult: false
    Log:
      {
        "name": "pack_apps_macos_apps",
        "action": "added",
        "hostIdentifier": "test-mac.local",
        "columns": {
          "name": "Visual Studio Code",
          "bundle_name": "com.microsoft.VSCode",
          "bundle_version": "1.80.0",
          "path": "/Applications/Visual Studio Code.app"
        }
      }
  - Name: Wrong Query Name
    ExpectedResult: false
    Log:
      {
        "name": "pack_processes_running",
        "action": "added",
        "hostIdentifier": "test-mac.local",
        "columns": {
          "name": "Cursor",
          "path": "/Applications/Cursor.app/Contents/MacOS/Cursor"
        }
      } 

@jacknagz jacknagz requested a review from a team as a code owner March 11, 2025 20:38
Copy link
Contributor

@ben-githubs ben-githubs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks cool!

@ben-githubs ben-githubs added this pull request to the merge queue Mar 11, 2025
Merged via the queue into develop with commit 23081d5 Mar 11, 2025
9 checks passed
@ben-githubs ben-githubs deleted the jn/cursor-rules branch March 11, 2025 21:06
@arielkr256 arielkr256 added the enhancement New feature or request label Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants