Skip to content

Commit

Permalink
protect against accessing undefined variables in sysmon module (#22236)
Browse files Browse the repository at this point in the history
Closes #22219
  • Loading branch information
leehinman authored Oct 28, 2020
1 parent 2474f5b commit cffc81d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Fix invalid IP addresses in DNS query results from Sysmon data. {issue}18432[18432] {pull}18436[18436]
- Fields from Winlogbeat modules were not being included in index templates and patterns. {pull}18983[18983]
- Add source.ip validation for event ID 4778 in the Security module. {issue}19627[19627]
- Protect against accessing undefined variables in Sysmon module. {issue}22219[22219] {pull}22236[22236]

*Functionbeat*

Expand Down
12 changes: 11 additions & 1 deletion x-pack/winlogbeat/module/sysmon/config/winlogbeat-sysmon.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ var sysmon = (function () {
return;
}
var exe = evt.Get(pathField);
if (!exe) {
return;
}
evt.Put(nameField, path.basename(exe));
};

Expand All @@ -327,7 +330,11 @@ var sysmon = (function () {
};

var addUser = function (evt) {
var userParts = evt.Get("winlog.event_data.User").split("\\");
var userParts = evt.Get("winlog.event_data.User");
if (!userParts) {
return;
}
userParts = userParts.split("\\");
if (userParts.length === 2) {
evt.Delete("user");
evt.Put("user.domain", userParts[0]);
Expand Down Expand Up @@ -406,6 +413,9 @@ var sysmon = (function () {
// in the specified namespace. It also adds all the hashes to 'related.hash'.
var addHashes = function (evt, namespace, hashField) {
var hashes = evt.Get(hashField);
if (!hashes) {
return;
}
evt.Delete(hashField);
hashes.split(",").forEach(function (hash) {
var parts = hash.split("=");
Expand Down

0 comments on commit cffc81d

Please sign in to comment.