diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index f103c8239f1..d001bc58b3d 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -139,6 +139,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff] *Winlogbeat* +- Fix powershell details regexp to prevent excessive backtracking when processing command invocations. {pull}36178[36178] *Functionbeat* diff --git a/x-pack/winlogbeat/module/powershell/ingest/powershell.yml b/x-pack/winlogbeat/module/powershell/ingest/powershell.yml index 2c3a3a3e85c..34f537bce36 100644 --- a/x-pack/winlogbeat/module/powershell/ingest/powershell.yml +++ b/x-pack/winlogbeat/module/powershell/ingest/powershell.yml @@ -232,7 +232,7 @@ processors: field: param3 source: |- def parseRawDetail(String raw) { - Pattern detailRegex = /^([^:(]+)\((.+)\)\:\s*(.+)?$/; + Pattern detailRegex = /^([^:(]+)\(([^)]+)\)\:\s*(.+)?$/; Pattern parameterBindingRegex = /name\=(.+);\s*value\=(.+)$/; def matcher = detailRegex.matcher(raw); diff --git a/x-pack/winlogbeat/module/powershell/ingest/powershell_operational.yml b/x-pack/winlogbeat/module/powershell/ingest/powershell_operational.yml index cb7830ed304..db36f6aed99 100644 --- a/x-pack/winlogbeat/module/powershell/ingest/powershell_operational.yml +++ b/x-pack/winlogbeat/module/powershell/ingest/powershell_operational.yml @@ -284,7 +284,7 @@ processors: field: Payload source: |- def parseRawDetail(String raw) { - Pattern detailRegex = /^(.+)\((.+)\)\:\s*(.+)?$/; + Pattern detailRegex = /^([^:(]+)\(([^)]+)\)\:\s*(.+)?$/; Pattern parameterBindingRegex = /name\=(.+);\s*value\=(.+)$/; def matcher = detailRegex.matcher(raw);