VirusTotal / yara

The pattern matching swiss knife
https://virustotal.github.io/yara/
BSD 3-Clause "New" or "Revised" License
8.34k stars 1.45k forks source link

feat: memory module #1991

Closed secDre4mer closed 6 months ago

secDre4mer commented 1 year ago

A small YARA module (inspired by https://twitter.com/NinjaParanoid/status/1712743509961380325) that allows rules to query memory protection for live process memory. This allows writing conditions like for any i in (1..#a) : ( memory.Protection(@a[i]) & memory.EXECUTE == memory.EXECUTE) for strings that should only match on executable memory.

klabksec commented 1 year ago

in addition to mem RWX permissions and region size and all, it would be useful to describe/access characteristics of the current process - dll(s) loaded and their associated file path, any particular port listening or named pipes, number of threads, etc

plusvic commented 1 year ago

I see the utility of this new module, but I'm worried about its maintenance and testability. One of the problem with process memory scanning in general is that it's poorly tested, and this adds up to the already existing problem. Testing process scanning is hard, I never put too much effort on that, and I regret it. But at this point I don't want to make this issue bigger than it is.

Also, I prefer not adding new modules to YARA in general, given that YARA-X is probably the future.