isLOLDriver interacts with the loldrivers client to determine whether the loaded/dropped driver is malicious or vulnerable.
(f fields.Field, e *event.Event)
| 38 | // isLOLDriver interacts with the loldrivers client to determine |
| 39 | // whether the loaded/dropped driver is malicious or vulnerable. |
| 40 | func isLOLDriver(f fields.Field, e *event.Event) (params.Value, error) { |
| 41 | var filename string |
| 42 | |
| 43 | if e.Category == event.File { |
| 44 | filename = e.GetParamAsString(params.FilePath) |
| 45 | } else { |
| 46 | filename = e.GetParamAsString(params.ModulePath) |
| 47 | } |
| 48 | |
| 49 | isDriver := filepath.Ext(filename) == ".sys" || e.Params.TryGetBool(params.FileIsDriver) |
| 50 | if !isDriver { |
| 51 | return nil, nil |
| 52 | } |
| 53 | ok, driver := loldrivers.GetClient().MatchHash(filename) |
| 54 | if !ok { |
| 55 | return nil, nil |
| 56 | } |
| 57 | if (f == fields.FileIsDriverVulnerable || f == fields.ImageIsDriverVulnerable) && driver.IsVulnerable { |
| 58 | return true, nil |
| 59 | } |
| 60 | if (f == fields.FileIsDriverMalicious || f == fields.ImageIsDriverMalicious) && driver.IsMalicious { |
| 61 | return true, nil |
| 62 | } |
| 63 | return false, nil |
| 64 | } |
| 65 | |
| 66 | // initLOLDriversClient initializes the loldrivers client if the filter expression |
| 67 | // contains any of the relevant fields. |
no test coverage detected