Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gracefully handle rules containing invalid search conditions #14

Open
bradleyjkemp opened this issue Jun 19, 2022 · 1 comment
Open
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@bradleyjkemp
Copy link
Owner

Currently sigma-go panics when given a rule that looks like this:

detection:
    someCondition:
        foo: bar
    condition: nonExistentCondition

This panic happens here:

panic("invalid search identifier")

Instead this function should be extended so that it can return an error back to the caller

@bradleyjkemp bradleyjkemp added help wanted Extra attention is needed good first issue Good for newcomers labels Jun 19, 2022
@veramine
Copy link
Contributor

veramine commented Jan 5, 2023

I hit something similar on a sigma project rule with the following definition:

detection:
    selection:
        Image|endswith: '\3proxy.exe'
    selection_pe:
        Description: '3proxy - tiny proxy server'
    selection_params: # param combos seen in the wild
        CommandLine|contains: '.exe -i127.0.0.1 -p'
    condition: 1 of selection

Error was:

panic: unhandled node type sigma.OneOfIdentifier

goroutine 9 [running]:
github.com/bradleyjkemp/sigma-go/evaluator.RuleEvaluator.evaluateSearchExpression({{{0x14000639e70, 0xc}, {{0x140008de4f0, 0x10}, {0x140008de5a0, 0x7}, {0x0, 0x0}, {0x0, 0x0}, ...}, ...}, ...}, ...)
	/Users/jness/v/onprem/pkg/mod/github.com/bradleyjkemp/[email protected]/evaluator/evaluate_search.go:83 +0x314
github.com/bradleyjkemp/sigma-go/evaluator.RuleEvaluator.Matches({{{0x14000639e70, 0xc}, {{0x140008de4f0, 0x10}, {0x140008de5a0, 0x7}, {0x0, 0x0}, {0x0, 0x0}, ...}, ...}, ...}, ...)
	/Users/jness/v/onprem/pkg/mod/github.com/bradleyjkemp/[email protected]/evaluator/evaluate.go:109 +0x2e8

I'll file an issue on the Sigma project rule: https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_susp_3proxy_usage.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants