# OffSet7: PUA - Ngrok Execution

> Design for the QRadar Rule Wizard. Not an importable rule and not tested in QRadar.

- Rule type: Event rule (Local), create disabled
- Log source types: Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1

## Building blocks

### BB:OffSet7:PUA Ngrok Execution:selection1 (match)
All test lines must match (AND).
- when **Command** contains: ` tcp 139`, ` tcp 445`, ` tcp 3389`, ` tcp 5985`, ` tcp 5986`

### BB:OffSet7:PUA Ngrok Execution:selection2 (match)
All test lines must match (AND).
- when **Command** contains: ` start`, `--all`, `--config`, `.yml`

### BB:OffSet7:PUA Ngrok Execution:selection3 (match)
All test lines must match (AND).
- when **Process Path / Process Name** ends with: `ngrok.exe`
- when **Command** contains: ` tcp`, ` http`, ` authtoken`

### BB:OffSet7:PUA Ngrok Execution:selection4 (match)
All test lines must match (AND).
- when **Command** contains: `.exe authtoken`, `.exe start --all`

## Main rule — option A (building blocks)

1. when the event(s) were detected by one or more of these log source types: `Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1`
2. when an event matches the condition built from these building blocks: `(ANY of [BB:OffSet7:PUA Ngrok Execution:selection1, BB:OffSet7:PUA Ngrok Execution:selection2, BB:OffSet7:PUA Ngrok Execution:selection3, BB:OffSet7:PUA Ngrok Execution:selection4])`

## Main rule — option B (AQL filter test)

1. when the event matches this AQL filter query: `devicetype=12 AND ((LOWER(Command) LIKE '% tcp 139%' OR LOWER(Command) LIKE '% tcp 445%' OR LOWER(Command) LIKE '% tcp 3389%' OR LOWER(Command) LIKE '% tcp 5985%' OR LOWER(Command) LIKE '% tcp 5986%') OR (LOWER(Command) LIKE '% start %' AND LOWER(Command) LIKE '%--all%' AND LOWER(Command) LIKE '%--config%' AND LOWER(Command) LIKE '%.yml%') OR ((LOWER("Process Path") LIKE '%ngrok.exe' OR LOWER("Process Name") LIKE '%ngrok.exe') AND (LOWER(Command) LIKE '% tcp %' OR LOWER(Command) LIKE '% http %' OR LOWER(Command) LIKE '% authtoken %')) OR (LOWER(Command) LIKE '%.exe authtoken %' OR LOWER(Command) LIKE '%.exe start --all%'))`

## Rule response

- Severity 7, credibility 6, relevance 7
- Ensure the detected event is part of an offense; index offense on Log Source (host) and annotate with the rule title and OffSet7 rule id
- Respond no more than once per 30 minutes per Log Source (tune per environment)

## Limitations

- QRadar AQL LIKE / CRE string tests are case-sensitive unless the property is lower-cased; the AQL option uses LOWER() where the backend applied it.

Source rule: PUA - Ngrok Execution (ee37eb7c-a4e7-4cd5-8fa4-efa27f1c3f31). Author: Florian Roth (Nextron Systems). Licence: DRL-1.1.
