Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[BugFix] PowerShell - Fixuser.name,user.domain, andscript_block_signature#15834

Merged
w0rk3r merged 5 commits intomainfrom
posh_fixes
Nov 7, 2025
Merged

[BugFix] PowerShell - Fixuser.name,user.domain, andscript_block_signature#15834
w0rk3r merged 5 commits intomainfrom
posh_fixes

Conversation

@w0rk3r
Copy link
Contributor

@w0rk3rw0rk3r commentedOct 31, 2025
edited
Loading

Proposed commit message

Fixes the ingest pipeline to correctly populate the `user.name`, `user.domain`, and `script_block_signature` fields.

Summary

User Fields

Currently, the Windows integration doesn’t populateuser.name anduser.domain for most PowerShell events, except for a few 4103 events (but not the majority). This PR proposes using thewinlog.user.* fields to populate them, as these values appear to remain consistent across events.

Screenshotsimageimageimageimage

script_block_signature

This field has never been populated in my events, and the reason might be thatdissect is looking only for the signature, while the script is usually included in the same script block.

image

So I'm suggesting using gsub to remove the non-signature content before using dissect:

image

Another point is that most PowerShell scripts with signatures end up having them truncated, since PowerShell logs have size limits, the signature often gets split across two events (Example).

Checklist

  • I have reviewedtips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package'schangelog.yml file.
  • I have verified that Kibana version constraints are current according toguidelines.
  • I have verified that any added dashboard complies with Kibana'sDashboard good practices

@w0rk3rw0rk3r self-assigned thisOct 31, 2025
@w0rk3rw0rk3r requested review froma team ascode ownersOctober 31, 2025 19:54
@w0rk3rw0rk3r added the bugfixPull request that fixes a bug issue labelOct 31, 2025
@w0rk3rw0rk3r added the Team:Security-Service IntegrationsSecurity Service Integrations team [elastic/security-service-integrations] labelOct 31, 2025
@elasticmachine
Copy link

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

@andrewkrohandrewkroh added Integration:windowsWindows Team:Security-Windows PlatformSecurity Windows Platform team [elastic/sec-windows-platform] labelsOct 31, 2025
@elasticmachine
Copy link

Pinging @elastic/sec-windows-platform (Team:Security-Windows Platform)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Replacing these with the events frompackages\windows\data_stream\powershell\_dev\test\pipeline\test-events.json as the ones we had here before are PowerShell Operational events.

marc-gr reacted with thumbs up emoji
Comment on lines -151 to +160
"ScriptBlockText": "# SIG # Begin signature block\n# MIIbDQYJKoZIhvcNAQcCoIIa/jCCGvoCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUxKaXN7doWq+mq18IrzABoXMr\n# 4l6gghXyMIIEoDCCA4igAwIBAgIKYRr16gAAAAAAajANBgkqhkiG9w0BAQUFADB5\n# MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVk\n# bW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSMwIQYDVQQDExpN\n# aWNyb3NvZnQgQ29kZSBTaWduaW5nIFBDQTAeFw0xMTExMDEyMjM5MTdaFw0xMzAy\n# MDEyMjQ5MTdaMIGDMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQ\n# MA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9u\n# SIG # End signature block\n\n.\\patata.ps1",
"ScriptBlockText": "###\n# ==++==\n#\n# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n###\n@{\n GUID = \"4ae9fd46-338a-459c-8186-07f910774cb8\"\n Author = \"Microsoft Corporation\"\n CompanyName = \"Microsoft Corporation\"\n Copyright = \"(C) Microsoft Corporation. All rights reserved.\"\n HelpInfoUri = \"https://go.microsoft.com/fwlink/?linkid=2113634\"\n ModuleVersion = \"1.4.8.1\"\n PowerShellVersion = \"3.0\"\n ClrVersion = \"4.0\"\n RootModule = \"PackageManagement.psm1\"\n\tDescription = 'PackageManagement (a.k.a. OneGet) is a new way to discover and install software packages from around the web.\n It is a manager or multiplexor of existing package managers (also called package providers) that unifies Windows package management with a single Windows PowerShell interface. With PackageManagement, you can do the following.\n - Manage a list of software repositories in which packages can be searched, acquired and installed\n - Discover software packages\n - Seamlessly install, uninstall, and inventory packages from one or more software repositories'\n\n CmdletsToExport = @(\n 'Find-Package',\n 'Get-Package',\n 'Get-PackageProvider',\n 'Get-PackageSource',\n 'Install-Package',\n 'Import-PackageProvider'\n 'Find-PackageProvider'\n 'Install-PackageProvider'\n 'Register-PackageSource',\n 'Set-PackageSource',\n 'Unregister-PackageSource',\n 'Uninstall-Package'\n 'Save-Package'\n\t)\n\n\tFormatsToProcess = @('PackageManagement.format.ps1xml')\n\n\tPrivateData = @{\n PSData = @{\n Tags = @('PackageManagement', 'PSEdition_Core', 'PSEdition_Desktop', 'Linux', 'Mac')\n ProjectUri = 'https://oneget.org'\n ReleaseNotes = @'\n## 1.4.8.1\n- Update PackageManagement's strong name signing\n\n## 1.4.8\n- Add NuGet as a source when generating nuget.config file for user in the NuGet Provider\n\n## 1.4.7\n- Update security protocol to use TLS 1.2\n- Remove catalog file\n\n## 1.4.6\n- Update `HelpInfoUri` to point to the latest content\n\n## 1.4.5\n- Bug fix for deadlock when getting parameters in an event\n\n## 1.4.4\n- Bug fix when installing modules from private feeds\n\n ## 1.4.3\n- Another bug fix when registering repositories with PowerShellGet\n\n## 1.4.2\n- Bug fix for passing credentials from PowerShellGet when registering repositories\n\n## 1.4.1\n- Bug fix for using credential provider installed in Visual Studio\n\n## 1.4\n- Allow credential persistance for registering private repositories and finding or installing packages from those repositories\n\n## 1.3.2\n- Enable bootstrap on PSCore\n- Bug fix to run on .NET Core 3.0\n\n## 1.3.1\n- Targets net452 and netstandard2.0 instead of net451, netcoreapp2.0, and netstandard1.6\n \n## Previous releases are not included in this Changelog\n'@\n }\n }\n}\n\n# SIG # Begin signature block\n# MIInoQYJKoZIhvcNAQcCoIInkjCCJ44CAQExDzANBglghkgBZQMEAgEFADB5Bgor\n# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG\n# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCANw97w1D+bi5LY\n# 8ZEuubcA0tI0Z0h+CImFRYop+IIqQaCCDYEwggX/MIID56ADAgECAhMzAAACUosz\n# qviV8znbAAAAAAJSMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD\n# +nC4D7IMA1+6smM7fbSJa7o4BHfyje8PHB3w9GF223mZTG0EhBlultQkMSpV/c88\n# 9hsbwx16Cr5sY9M/lSRt4oC3qzSuTmYd6VYJ/ILt9ptrpOkaYCiXXRx8Cfz7w53w\n# Au/J8xJjNWvrKxkcc8XiUXPfGGTXujyiS2MqvztBkg6wCduFKqogmvOtQiiwQQxE\n# G6lU/rss27omoTUc41EawOr1km5y+fUS9aoYX9K8NNhFH6TSni3dp/+Hiyif1T7X\n# g0cBy4yHuYxMmRrFcmGeplW3KhXHfkJjbHaVs1QgnRfkgFuypwF5YoFWrW7Xgj+a\n# ZCDKSoYq45E4v0ryIvyu0shBoHQXREAzpBv3L9h5A9vEFQG4alCI57oSbdqJ1YIa\n# ggkTQHR2CWdB7FnQilCqqZjSnAtXYZh/RD+PX6fg1UyUUQf5ohnw951pQeKYTYHm\n# Fwut+RibzdbHEF/kLZr6SZsDupCv\n# SIG # End signature block",
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Using a common event that contains both the script and the signature (I had to strip most of the signature content to keep it small here.)

marc-gr reacted with thumbs up emoji
@elastic-vault-github-plugin-prod

🚀 Benchmarks report

To see the full report comment with/test benchmark fullreport

@pierrehilbertpierrehilbert added the Team:Elastic-Agent-Data-PlaneAgent Data Plane team [elastic/elastic-agent-data-plane] labelNov 2, 2025
@elasticmachine
Copy link

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

Copy link
Contributor

@marc-grmarc-gr left a comment

Choose a reason for hiding this comment

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

LGTM just a small comment

w0rk3r reacted with hooray emoji
Comment on lines +15 to +17
- description: |
Add powershell.file.script_block_entropy_bits, powershell.file.script_block_surprisal_stdev,
powershell.file.script_block_length, and powershell.file.script_block_unique_symbols fields to improve context.
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Fixing an outdated description of the changes I did on#15698

@elasticmachine
Copy link

💚 Build Succeeded

History

cc@w0rk3r

@w0rk3rw0rk3r merged commitca5f737 intomainNov 7, 2025
7 checks passed
@w0rk3rw0rk3r deleted the posh_fixes branchNovember 7, 2025 13:51
@elastic-vault-github-plugin-prod

Package windows - 3.2.1 containing this change is available athttps://epr.elastic.co/package/windows/3.2.1/

tehbooom pushed a commit to tehbooom/integrations that referenced this pull requestNov 19, 2025
…ck_signature` (elastic#15834)* [BugFix] PowerShell - Fix `user.name`, `user.domain`, and `script_block_signature`* Update packages/windows/changelog.yml* add related.hosts* ++
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@marc-grmarc-grmarc-gr approved these changes

@orestisflorestisflAwaiting requested review from orestisflorestisfl is a code owner automatically assigned from elastic/elastic-agent-data-plane

@khushijain21khushijain21Awaiting requested review from khushijain21khushijain21 is a code owner automatically assigned from elastic/elastic-agent-data-plane

Assignees

@w0rk3rw0rk3r

Labels

bugfixPull request that fixes a bug issueIntegration:windowsWindowsTeam:Elastic-Agent-Data-PlaneAgent Data Plane team [elastic/elastic-agent-data-plane]Team:Security-Service IntegrationsSecurity Service Integrations team [elastic/security-service-integrations]Team:Security-Windows PlatformSecurity Windows Platform team [elastic/sec-windows-platform]

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@w0rk3r@elasticmachine@marc-gr@pierrehilbert@andrewkroh

Comments


[8]ページ先頭

©2009-2026 Movatter.jp