FACT_core icon indicating copy to clipboard operation
FACT_core copied to clipboard

About yara matching software component version

Open gaohang opened this issue 1 year ago • 3 comments

The FACT version you are using

No response

Your question

how does ghidra extract version format string? Could you give some guidence? thank you.

gaohang avatar Mar 02 '23 07:03 gaohang

FACT uses mostly YARA to directly match the version. Some programs store the version in a separate string and use string formatting for their version output (e.g. "xxx version %s" or "yyy version %d.%d.%d"). Matching the version directly is usually not robust enough because of too many false positives. We use Ghidra in these cases to try to find the string (or number) that is formatted into the string.

The key_strings are the format strings from the signature (only the signatures where format_string = true is set in the meta data). The idea is to find the basic block where these strings are used and look for the version strings from there.

jstucke avatar Mar 02 '23 07:03 jstucke

why version strings are in xref basic block?

FACT uses mostly YARA to directly match the version. Some programs store the version in a separate string and use string formatting for their version output (e.g. "xxx version %s" or "yyy version %d.%d.%d"). Matching the version directly is usually not robust enough because of too many false positives. We use Ghidra in these cases to try to find the string (or number) that is formatted into the string.

The key_strings are the format strings from the signature (only the signatures where format_string = true is set in the meta data). The idea is to find the basic block where these strings are used and look for the version strings from there.

gaohang avatar Mar 02 '23 13:03 gaohang

To be more precise we look for the call that prints the version string (and not only the basic block where it happens). And then we follow the other parameters to that call (which correspond to the version numbers in e.g. "yyy version %d.%d.%d") back to their sources using the xrefs of Ghidra.

Enkelmann avatar Mar 03 '23 12:03 Enkelmann