Skip to content

Windows registry fieldset #671

@rw-access

Description

@rw-access

We need to add a fieldset for Windows registry event. Both Sysmon/winlogbeat and Endgame/Elastic endpoint can collect these. I'm less focused on the creation of registry keys, but thinking more about the creation/modification of values. For more background on how the registry works, here's the wikipedia page.

Here's an example event collected from Endgame

{
  "bytes_written": "QwA6AFwAcgB0AGEAXAByAGUAZABfAHQAdABwAFwAYgBpAG4AXABtAHkAYQBwAHAALgBlAHgAZQAAAA==",
  "bytes_written_count": 58,
  "bytes_written_string": "C:\\rta\\red_ttp\\bin\\myapp.exe",
  "event_subtype_full": "registry_modify_event",
  "event_type_full": "registry_event",
  "hostname": "RTA-TESTING",
  "key_path": "\\REGISTRY\\MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\normalprogram.exe\\Debugger",
  "key_type": "sz",
  "opcode": 1,
  "pid": 9108,
  "process_name": "python.exe",
  "process_path": "C:\\Python27\\python.exe",
  "serial_event_id": 77803,
  "timestamp": 131762384629155140,
  "timestamp_utc": "2018-07-16 18:14:22Z",
  "unique_pid": 77788,
  "user_name": "tester",
  "user_sid": "S-1-5-21-4215045029-3277270250-148079304-1004"
}

Some of the keys worth adding to the field set:

  • hive: If we stick with the abbreviated names, the values are HKLM, HKCC, HKCR, HKCU, HKU. if we go unabbreviated names, this means HKEY_LOCAL_MACHINE, HKEY_CURRENT_CONFIG, etc. in the above example, this is HKLM / HKEY_LOCAL_MACHINE
  • key: the hive relative path to the key. this doesn't include the value name. this is somewhat analogous to a directory path in na file system. in the above example this is SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\normalprogram.exe
  • value: the name of the value written to. this is somewhat analogous to a file name. in the above example, this is Debugger
  • path: the full path, including hive, key, and value. essentially key_path in the above example

It also may be worth nesting a field set at registry.data which contains

  • type: the representation of the data. basically tells you how to interpret the bytes written. possible values are: REG_NONE, REG_SZ, REG_EXPAND_SZ, REG_DWORD, etc. in the above example, this is REG_SZ.
  • int_value: open for naming suggestions, but we could store (+/- careful casting) DWORD/QWORD as i64, or long within ES
  • string_values: type: array[string] again, open for a better name, but this would store the strings for any string types -- REG_SZ, REG_EXPAND_SZ, REG_LINNK, REG_MULTI_SZ. in the above example, we would store ["C:\\rta\\red_ttp\\bin\\myapp.exe"]
  • num_strings: type: long. this would be the number of strings for REG_MULTI_SZ. I'm not sure how often this would need to be queried over, so this could be derived with length(string_values)
  • original_bytes: type string - I'm not sure the best representation, but this could be base64 to store arbitrary bytes without worrying about unicode. this would be most used for REG_BINARY, but could be stored for any data type.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions