(t *testing.T)
| 783 | } |
| 784 | |
| 785 | func TestSequenceExpire(t *testing.T) { |
| 786 | log.SetLevel(log.DebugLevel) |
| 787 | |
| 788 | var tests = []struct { |
| 789 | c *config.FilterConfig |
| 790 | expr string |
| 791 | evts []*event.Event |
| 792 | wants bool |
| 793 | }{ |
| 794 | { |
| 795 | &config.FilterConfig{Name: "LSASS memory dumping via legitimate or offensive tools"}, |
| 796 | `sequence |
| 797 | maxspan 2m |
| 798 | |evt.name = 'OpenProcess' and evt.arg[exe] imatches '?:\\Windows\\System32\\lsass.exe'| by ps.uuid |
| 799 | |evt.name = 'CreateFile' and file.operation = 'CREATE' and file.extension = '.dmp'| by ps.uuid |
| 800 | `, |
| 801 | []*event.Event{ |
| 802 | { |
| 803 | Type: event.OpenProcess, |
| 804 | Timestamp: time.Now(), |
| 805 | Name: "OpenProcess", |
| 806 | Tid: 2484, |
| 807 | PID: 4143, |
| 808 | PS: &pstypes.PS{ |
| 809 | Name: "cmd.exe", |
| 810 | Exe: "C:\\Windows\\system32\\rundll32.exe", |
| 811 | }, |
| 812 | Params: event.Params{ |
| 813 | params.Exe: {Name: params.Exe, Type: params.UnicodeString, Value: "C:\\Windows\\System32\\lsass.exe"}, |
| 814 | params.ProcessID: {Name: params.ProcessID, Type: params.PID, Value: uint32(2243)}, |
| 815 | params.DesiredAccess: {Name: params.DesiredAccess, Type: params.Flags, Value: uint32(0x1400), Flags: event.PsAccessRightFlags}, |
| 816 | }, |
| 817 | Metadata: map[event.MetadataKey]any{"foo": "bar", "fooz": "barzz"}, |
| 818 | }, |
| 819 | { |
| 820 | Type: event.TerminateProcess, |
| 821 | Name: "TerminateProcess", |
| 822 | Tid: 2484, |
| 823 | PID: 859, |
| 824 | PS: &pstypes.PS{ |
| 825 | Name: "cmd.exe", |
| 826 | Exe: "C:\\Windows\\system32\\svchost.exe", |
| 827 | }, |
| 828 | Params: event.Params{ |
| 829 | params.ProcessID: {Name: params.ProcessID, Type: params.PID, Value: uint32(4143)}, |
| 830 | params.ProcessName: {Name: params.ProcessName, Type: params.AnsiString, Value: "powershell.exe"}, |
| 831 | }, |
| 832 | }, |
| 833 | }, |
| 834 | true, |
| 835 | }, |
| 836 | { |
| 837 | &config.FilterConfig{Name: "System Binary Proxy Execution via Rundll32"}, |
| 838 | `sequence |
| 839 | maxspan 2m |
| 840 | |evt.name = 'CreateProcess' and ps.name = 'rundll32.exe'| by ps.pid |
| 841 | |evt.name = 'CreateProcess' and ps.name = 'connhost.exe'| by ps.parent.pid |
| 842 | `, |
nothing calls this directly
no test coverage detected