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

problem encountered with loki when search for a hash #95

Closed
moloch57 opened this issue Jan 9, 2018 · 4 comments
Closed

problem encountered with loki when search for a hash #95

moloch57 opened this issue Jan 9, 2018 · 4 comments
Labels

Comments

@moloch57
Copy link

moloch57 commented Jan 9, 2018

Hello,

I encountered a problem when I used loki with an unconventional researsh for hashes (MD5, SHA1, SHA 256)

I explain :
for some reason, I don't want search for a hash (for instance a MD5 one) with a full hash. So, I used a partial hash. (e.g. 10 fisrt characteres of the MD5 instead of 32)
Hence, I can't used the usefull raw file .\loki\signature-base\iocs\hash-iocs.txt . So, I try to use a yara rule for this aim like this one :

import "hash"

rule md5_<10 first char>{
conditions:
hash.md5(0,filesize) contains "<10 first char>"
}

The problem is loki generate an error during the initializing phase and the rule is not valid :
'SyntaxError: : invalid field name "md5" '
Nevertheless, the rule is valid and work well when I use it with yara in versions from 3.4 to 3.7 (import "hash" is not supported in versions prior to 3.4)
The problem with loki is the same in windows and linux environnements and when I use, for both of them, the executable version of loki and the python version (python 2.7 and 3.6, with yara-python module installed).

Do you know this problem ? Is it a bug ?
How can I fix this problem ?

Thank you.
Regards.

@Neo23x0
Copy link
Owner

Neo23x0 commented Jan 10, 2018

Yes, it's a bug in yara-python.
Since version 3.6.3 it's compiled without the "hash" feature. I have no idea how this is possible since "pe.imphash" is available and also dependant on openssl. (as far as I know)

See the issue that I've opened here:
VirusTotal/yara#757

@Neo23x0 Neo23x0 added the bug label Mar 22, 2018
@dssink
Copy link

dssink commented Sep 5, 2018

I was able to get the hash errors to stop on kali-rolling after installing libssl-dev. After that, constructing the virtualenv and running loki seems to work just fine with no warnings.

apt-get install libssl-dev
virtualenv --prompt="[loki]" .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install colorama pycrypto

At this point, Loki seems to be happy and runs with python2 loki.py <parameters> and reports 377 yara rules instead of the 319 when it was throwing hash errors.

I was chasing github issues and managed to find a lead at TheHive-Project/Cortex-Analyzers#62 that pointed towards the missing package.

@R34rvi3w
Copy link

R34rvi3w commented Jul 8, 2019

Is there any workaround with this? libssl-dev is not available on macOS and openssl is 1.0.2s

@Neo23x0
Copy link
Owner

Neo23x0 commented Jul 9, 2019 via email

@Neo23x0 Neo23x0 closed this as completed Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants