# OffSet7: Potential Tampering With RDP Related Registry Keys Via Reg.EXE

> 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:Potential Tampering With RDP Related Registry Ke:selection_main_img (match)
Any of the groups matches (OR): build one BB per group and a parent BB "when an event matches any of" them.
- when **Process Path / Process Name** ends with: `\reg.exe`
- when **Filename** is equal to (case-insensitive): `reg.exe`

### BB:OffSet7:Potential Tampering With RDP Related Registry Ke:selection_main_cli (match)
All test lines must match (AND).
- when **Command** contains: ` add`, `\CurrentControlSet\Control\Terminal Server`, `REG_DWORD`, ` /f`

### BB:OffSet7:Potential Tampering With RDP Related Registry Ke:selection_values_1 (match)
All test lines must match (AND).
- when **Command** contains: `Licensing Core`, `EnableConcurrentSessions`

### BB:OffSet7:Potential Tampering With RDP Related Registry Ke:selection_values_2 (match)
All test lines must match (AND).
- when **Command** contains: `AllowTSConnections`, `fDenyTSConnections`, `fEnableWinStation`, `fSingleSessionPerUser`, `IdleWinStationPoolCount`, `MaxInstanceCount`, `SecurityLayer`, `TSAdvertise`, `TSAppCompat`, `TSEnabled`, `TSUserEnabled`, `WinStations\RDP-Tcp`

### BB:OffSet7:Potential Tampering With RDP Related Registry Ke:filter_main_values_tls (exclusion)
All test lines must match (AND).
- when **Command** contains: `SecurityLayer`, `02`

## 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: `(ALL of [BB:OffSet7:Potential Tampering With RDP Related Registry Ke:selection_main_img, BB:OffSet7:Potential Tampering With RDP Related Registry Ke:selection_main_cli]) AND (ANY of [BB:OffSet7:Potential Tampering With RDP Related Registry Ke:selection_values_1, BB:OffSet7:Potential Tampering With RDP Related Registry Ke:selection_values_2]) AND NOT (ANY of [BB:OffSet7:Potential Tampering With RDP Related Registry Ke:filter_main_values_tls])`

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

1. when the event matches this AQL filter query: `devicetype=12 AND (((LOWER("Process Path") LIKE '%\reg.exe' OR LOWER("Process Name") LIKE '%\reg.exe') OR Filename='reg.exe') AND (LOWER(Command) LIKE '% add %' AND LOWER(Command) LIKE '%\currentcontrolset\control\terminal server%' AND LOWER(Command) LIKE '%reg_dword%' AND LOWER(Command) LIKE '% /f%')) AND ((LOWER(Command) LIKE '%licensing core%' AND LOWER(Command) LIKE '%enableconcurrentsessions%') OR (LOWER(Command) LIKE '%allowtsconnections%' OR LOWER(Command) LIKE '%fdenytsconnections%' OR LOWER(Command) LIKE '%fenablewinstation%' OR LOWER(Command) LIKE '%fsinglesessionperuser%' OR LOWER(Command) LIKE '%idlewinstationpoolcount%' OR LOWER(Command) LIKE '%maxinstancecount%' OR LOWER(Command) LIKE '%securitylayer%' OR LOWER(Command) LIKE '%tsadvertise%' OR LOWER(Command) LIKE '%tsappcompat%' OR LOWER(Command) LIKE '%tsenabled%' OR LOWER(Command) LIKE '%tsuserenabled%' OR LOWER(Command) LIKE '%winstations\rdp-tcp%')) AND (NOT((LOWER(Command) LIKE '%securitylayer%' AND Command LIKE '%02%')))`

## 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: Potential Tampering With RDP Related Registry Keys Via Reg.EXE (0d5675be-bc88-4172-86d3-1e96a4476536). Author: pH-T (Nextron Systems), @Kostastsale, TheDFIRReport. Licence: DRL-1.1.
