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

yara addfile third_party/yara-rules-full.yar: invalid field name "imphash" #63

Closed
cipriancraciun opened this issue Mar 15, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@cipriancraciun
Copy link

I've just compiled the tool as suggested in the README:

go install github.com/chainguard-dev/bincapz@latest

When running it on /bin/true it fails with:

> ~/go/bin/bincapz /bin/true 

scanning /bin/true ...
scan failed: YARA rule compilation: walk: yara addfile third_party/yara-rules-full.yar: invalid field name "imphash"

I am running OpenSUSE Tumbleweed, with the following packages:

> zypper info libyara-devel

Information for package libyara-devel:
--------------------------------------
Repository     : opensuse-oss-distribution
Name           : libyara-devel
Version        : 4.5.0-1.1
Arch           : x86_64
Vendor         : openSUSE
Installed Size : 177.3 KiB
Installed      : Yes
Status         : up-to-date
Source package : yara-4.5.0-1.1.src
> go version

go version go1.21.7 linux/amd64
@tstromberg
Copy link
Collaborator

That's really interesting! I haven't tested it in OpenSUSE, but have in Arch Linux, which appears to be on yara 4.3.2-1. I'll see about installing a Tumbleweed VM to see what might be going on: my going theory is that 4.5.0 is incompatible with one of these two dependencies:

In the meantime, if you want to try bincapz, I think this workaround will work:

bincapz --third_party=false

That will disable the YaraFORGE 3rd party rules.

@tstromberg tstromberg changed the title YARA rule compilation failure on OpenSUSE Tumbleweed yara addfile third_party/yara-rules-full.yar: invalid field name "imphash" Mar 16, 2024
@tstromberg tstromberg added the bug Something isn't working label Mar 16, 2024
@tstromberg
Copy link
Collaborator

I'm successfully using bincapz w/ yara v4.5.0 on macOS. I tried to start a Tumbleweed VM but it's not coming up for some reason, so I haven't yet been able to replicate this issue.

@tstromberg
Copy link
Collaborator

I haven't been able to duplicate this yet - but I wonder if this may be due to a missing OpenSSL dependency: VirusTotal/yara-python#179

@cipriancraciun
Copy link
Author

cipriancraciun commented Apr 17, 2024

I do have OpenSSL, the library, installed, perhaps not the *-devel package.

However, you can close this issue if you want. OpenSUSE Tumbleweed is a rolling release, thus it is a moving target.

Running the tool with the third-party flag did make it work.

(Sorry for closing and re-opening the issue... I've touched by mistake the touchpad, which had the mouse just over the "close with comment".) :)

@tstromberg
Copy link
Collaborator

I don't think it will work, but can you try installing the openssl-devel package?

My theory is that yara may only enable the imphash feature it can find the necessary library support. If it requires compile-time support, installing openssl-devel won't help, but if it determines the existence of the dependency at runtime, it should work.

One workaround I thought about is to change this from a fatal error to a warning, but it could mask a loss an unexpected loss in functionality.

@egibs
Copy link
Member

egibs commented May 3, 2024

FWIW, I ran into this when testing #181 inside of a Wolfi container. Installing openssl-dev (apk add openssl-dev) resolved the error.

For anyone searching around on how to resolve the error, installing openssl-dev/openssl-devel/libssl-dev/libopenssl-devel (depending on your distribution) should resolve the error; Arch seems to work with just openssl.

@egibs
Copy link
Member

egibs commented May 10, 2024

Cross-posting from the closed PR

OpenSSL's libraries are required for Yara (depending on the platform being used).

A non-exhaustive list of Linux distributions and their respectie package names can be found below:

  • Debian, Ubuntu
    • libssl-dev
  • CentOS, Fedora, RHEL, Rocky:
    • openssl-devel
  • Alpine/Wolfi:
    • openssl-dev
  • Arch:
    • openssl (Arch includes the libraries)
  • OpenSUSE:
    • libopenssl-devel

@egibs egibs closed this as completed May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants