8000 Issue running proc_yara() plugin in 0.7.1 · Issue #3225 · Velocidex/velociraptor · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Issue running proc_yara() plugin in 0.7.1 #3225

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

Closed
mgreen27 opened this issue Jan 20, 2024 · 8 comments
Closed

Issue running proc_yara() plugin in 0.7.1 #3225

mgreen27 opened this issue Jan 20, 2024 · 8 comments

Comments

@mgreen27
Copy link
Collaborator

Im getting a repeatable exception running proc_yara() plugin in 0.7.1.

image

replicate with in artifact or notebook: SELECT * FROM proc_yara(pid=TargetPid,rules=YaraRule)

Im testing this plugin as the standard yara(accessor='process'...) is causing some false negatives in some advanced rules due to block scanning and I want to test this older plugin performs as expected. We can then update Windows.Detection.Yara.Process and other artifacts as needed.

@mgreen27
Copy link
Collaborator Author

This issue appears to be resolved in #3226
Will keep the issue open until I update Windows.Detection.Yara.Process

@mgreen27
Copy link
Collaborator Author

Windows.Detection.Yara.Process - #3233

Testing proc_yara under linux seems to error out with: proc_yara: pid 0: could not attach to process

@scudette
Copy link
Contributor

That is expected there is no pid 0

@mgreen27
Copy link
Collaborator Author
mgreen27 commented Jan 22, 2024

I thought this may be a generic error in linux as I specified a pid (and a name regex).
image

Here is targeting yara(accessor='process....

image

here is same artifact using proc_yara() in linux
image

Both targeting is the same, im not filtering out pid via self exclusions.

@scudette
Copy link
Contributor

This works for me

--- a/artifacts/definitions/Linux/Detection/Yara/Process.yaml
+++ b/artifacts/definitions/Linux/Detection/Yara/Process.yaml
@@ -92,13 +92,13 @@ sources:
                     file='String.Data',
                     name=format(format="%v-%v_%v_%v",
                     args=[ ProcessName, Pid, String.Offset, ContextBytes ]
                         )) as HitContext
-             FROM yara(files=format(format="/%d", args=Pid),
-                       accessor='process',rules=yara_rules,
+             FROM proc_yara(pid=Pid,
+                       rules=yara_rules,
                        context=ContextBytes, number=NumberOfHits )
           })

Write secret in vi and check the pid

< 8000 pre class="notranslate">velociraptor-v0.7.1-1-linux-amd64 -v artifacts collect Linux.Detection.Yara.Process --args PidRegex=3145944 --args YaraRule="ascii wide: secret"

@mgreen27
Copy link
Collaborator Author

this makes sense as in my artifact I was running int(int=Pid) - if this has failed it would explain why the 0 was being scanned.

@scudette
Copy link
Contributor

Interesting - running explain on the query shows

[DEBUG] 2024-01-22T06:29:47Z   arg parsing: &functions.IntArgs{Int: int32(3145944)}

So maybe int() function is not handling int32 properly

@mgreen27
Copy link
Collaborator Author

Confirmed working in head release - thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0