Releases: vthib/boreal
v1.1.0
This releases contains primarily:
- Performance improvements on rules that uses regex or hex strings with
complex alternations (for example,{ ( AA ?? BB ) | ( CC ?? DD ) }.
This can brings up to a 50% reduction to scan duration for rule sets
that contain such rules. - A change in some parsing limits that could be used in very complex rules.
The limits have been raised and are now configurable if needed. - A compatibility with free-threaded python for
boreal-py. - A way to provide a value for the
pe.is_signedsymbol, so that this
value can be computed externally and used in yara rules.
See the complete changelog for details.
boreal-parser
Added
- Allow configuring a few previously hardcoded parsing limits. There were two
limits used to prevent stack overflows that were hardcoded. Those limits
have been raised (since they were hit in legitimate rules), and they
are additionally configurable inboreal,boreal-pyandboreal-cli
if needed. #241
Changed
- The hardcoded parsing limits used to prevent stack overflows have been
raised. #241 codespan-reportingupgraded to 0.13.
boreal
Added
- Add a way to provide a value for the
pe.is_signedsymbol. A new
PeDataobject can be used to provide this value before scanning.
#246 - Expose the new configurable parsing limits in
CompilerParams:
parse_expression_recursion_limitandparse_string_recursion_limit.
raised. #241
Changed
- Some significant scan duration improvements thanks to changes in the
atoms extraction logic. Improvements range from 0 to up to 40-50%
for some rule sets. #245 - Some dependencies upgrade:
windows-sysupgraded to 0.61mach2upgraded to 0.6 (used withprocessfeature on macos targets).tlsh2upgraded to 1.1.0codespan-reportingupgraded to 0.13objectupgraded to 0.37
Fixed
- Fix possible duplicated matches for very specific rules where the
same literal is repeated in alternatives branches of a regex. This
could impact rules that depends on a count of the number of matches
of those strings. #244 - Fix value of
process_memorywhen scanning processes: this value
was not properly set to true in this context. This could impact
a few values from theelf,pe,machoanddotnetmodules.
#245
boreal-py
Added
- Add two new parameters that were previously only settable through
the global configuration (boreal.set_config):max_match_datain the match method.max_strings_per_rulein the compile method.
This allows setting those parameters without using a global config
which impacts all invocations. #236
- Expose a few additional compile options that were available in
boreal
but not configurable inboreal-py:max_condition_depth,
parse_expression_recursion_limitandparse_string_recursion_limit.
#243
Changed
- Make the library free-threaded. It can now be used with free-threaded python
without requiring the GIL to be used. #238 pyo3upgraded to 0.27
boreal-cli
Added
- Add a few additional options that were previously configurable in
boreal
but not exposed inboreal-cli: #243--match-max-length--max-condition-lepth--disable-includes
Make the newly configurable parsing limits available inboreal-clias well.--parse-expression-recursion-limit--parse-string-recursion-limit
v1.0.0
This release marks the first stable release of Boreal as it is now entirely feature complete with YARA:
- All features available in YARA are available in boreal
- A CLI binary is available that is 100% compatible with invocations of the yara CLI binary.
- A new python library has been released, also 100% compatible with the yara python library.
Here is a list of the major features since 0.9.0:
-
Python bindings have been added, and are available through the
boreal-pythonpypi package. Those bindings provide a "yara compatibility" mode with full compatibility with the yara python bindings, allowing seamless transition from it. -
The
borealCLI tool has been reworked and completed. It now supports all options from theyaraCLI tool (except--atom-quality-table) and provides a "yara compatibility" mode through the use of theyrsubcommand, allowing seamless transition from it. -
A scanner can now be serialized into bytes (and deserialized) through the
serializefeature. This is the equivalent of the yara save/load API. This however increases the scanner size by a few percent, and has a lot of caveats linked to it. See theScanner::to_bytesfor more details. -
All scanning APIs now have a variant that uses a callback. This callback will be called on specific events: when a rule matches, when a module is imported, etc.
scanner::ScanEventfor more details. -
Several more features have been added: modifying the include callback, limiting the number of strings per rule, etc. See the changelog below for details.
-
The benchmarks have been reworked:
YARA-Xhave been added to it and benchmarks on the serialize feature have been added.
Since this is the first stable release, several breaking changes have been done to stabilize the API. See the breaking changes list just below.
Breaking changes:
- The
Compiler::into_scannermethod has been renamed toCompiler::finalize#226. - The
namespacefield for rules is now non optional, and the default namespace is named"default". This means that if you previously added rules in the default namespace and rules in a custom namespace named"default", this would now add to the same namespace and may conflict. This aligns the logic on what yara does and simplifies compatibility 4ffca07 - The
ScanResult::statisticsfield is now boxed. This reduces the size of the object greatly. - The
ScanResult::module_valuesfield has been replaced byScanResult::modules, which also returns a pointer to the modules, allowing access to their static values #225. boreal::scanner::MatchedRulehas been renamed toboreal::scanner::EvaluatedRule
979f162.boreal::Compiler::defaulthas been removed, use of theCompilerBuilderobject is mandatory to customize which modules are enabled 586be27.- Bump MSRV to 1.74 928e380.
boreal::scanner::StringMatch::datahas changed from aVec<u8>to aBox<[u8]>to reduce the memory size of this object 928e380.boreal::compiler::AddRuleErrorno longer has ato_short_descriptionmethod. Instead, this object implementsstd::fmt::Displaywhich can be used to generate the same short description 6658ebb.
Added
- Added callback based API variants for all
Scanner::scan_*methods. For example,Scanner::scan_mem_with_callback,Scanner::scan_process_with_callback. This callback can receive several type of events, and is able to abort the scan during any received event. Seeboreal::scanner::ScanEventandboreal::scanner::CallbackEventsfor more details on the types of events handled #187. - Added
serializefeature to serialize aScannerobject into bytes which can be deserialized on another computer. SeeScanner::to_bytesfor more details. #203. - Added ability to customize include behavior with a callback used during compilation. See
Compiler::set_include_callbackfor more details 637dece. - Added scan parameters to include not matched rules in results 8a951d8.
- Callback for console module can now be provided in the scanner rather than during compilation 3522484.
- Added
Scanner::rulesto iterate over the rules contained in a scanner 68ee69b. - Added
max_strings_per_rulecompilation parameter to fail compilation if a rule contains too many rules 696ce79. - Added
xor_keyfield inboreal::scanner::StringMatchto indicate which xor key was used on a given match 7c9fd27. - Added
has_xor_modifierfield inboreal::scanner::StringMatches6853938. - Implement
std::fmt::Displayandstd::error::Erroronboreal::compiler::AddRuleError. This means this is now a real Error object and theAddRuleError::to_short_descriptionmethod no longer needs to be called to generate a description for the error 6658ebb.
Updated
boreal-cli
v0.9.0
This release brings several memory optimizations and small API improvements.
Memory optimizations comes in two forms:
- Generic optimizations to reduce the memory footprint of compiled rules, useful in all
cases when theScannerobject is kept for a long time. - The introduction of a new profile that can be set in the compiler, which will compile
rules to optimize for memory usage rather than scanning speed.
boreal
Breaking changes:
-
A memory pool was introduced to greatly reduce the memory footprint of compiled rules,
notably when the same meta strings are used in all rules. This introduces two breaking
changes:- The
MetadataandMetadataValueobjects are no longer re-exported fromboreal-parser
but are new types. - To retrieve strings and byte-strings from those objects, the new
Scanner::get_bytes_symbol
andScanner::get_string_symbolmust be used.
- The
-
A new
CompilerBuilderobject is introduced, to be able to configure aCompilerbefore
any rule is added. -
Added
UnwindSafeandRefUnwindSafetrait bounds on module datas: -
MSRV is bumped from 1.65 to 1.66 825aaab
Added
- Add CompilerBuilder object to add modules and configure compiler profile: 261b11c2
- Add compiler profile to pick between memory usage or scanning speed: #167.
- Add compiler param to disable includes: #170.
- Update compatibility with YARA 4.5.2: #172.
Changed
- Add bytes intern pool to reduce memory consumption: #165.
- Guarantee
ScannerisUnwindSafeandRefUnwindSafe: #171.
- Update memory benchmarks 68a1e046
- Update windows-sys dependency to version 0.59 ff996f77
- Update tlsh2 dependency to version 0.4.0 29097dc8
Fixed
- Fix unused warning on statistics in default features config: #168.
boreal-cli
Added
- Added option
--profileto select memory or speed profile: c3a89c29.
v0.8.0
This release consists of several changes to make the library easier to use in any context
or target:
-
The dependency on OpenSSL (through the
authenticodefeature) is removed and replaced by pure-Rust dependencies, through the use of two features:- The
authenticodefeature is retained but is now enabled by default. It uses two new dependencies to parse the authenticode signatures. - A new
authenticode-verifyfeature is added to handle thepe.is_signed,pe.signatures[*].verifiedandpe.signatures[*].countersignatures[*].verifiedfields. See the dedicated documentation for details.
- The
-
The patched version of
objecthas been removed, making the use of the library much easier.
Those changes make boreal depend only on Rust libraries (except for the magic feature), which means the library can be used with any targets and is much easier to integrate.
In addition, this release brings full compatibility with YARA 4.5.1.
⚠ Breaking changes
-
The
authenticodefeature has been revamped. It is now split into two features:- The
authenticodefeature, which implements all thepe.signaturesfield except the ones related to signature verification. This feature is now enabled by default. - The
authenticode-verifyfeature, which implements thepe.is_signedand*.verifiedfields. This feature is disabled by default. See the dedicated documentation for details.
- The
-
The
CompilerAPI has been reworked to remove all the ugly workarounds that were needed due to the unsafety brought by the OpenSSL dependency. TheCompiler::new_with_pe_signaturesandCompiler::new_without_pe_modulefunctions has been removed.
Added
- add authenticode-verify feature for signature verification 9ced02bf.
Changed
- Remove
hexdependency bb46e49e - Remove
objectpatched version #159. - Replace authenticode-parser dependency with a custom impl f9521c5c
- Remove authenticode-parser dependency and clean API 21c5cd74
- Enable hash dependencies when authenticode feature is enabled b88fedb6
YARA 4.5.1 compatibility:
- only consider valid ascii bytes for pe dll names c219245e.
- add some safety checks in pe module for corrupted values 00235005
- update rva resolution in pe module 66c2d5f4
- list dotnet resources that are not located in the file b2fa436d
Fixed
v0.7.0
This release adds the last missing modules from YARA: magic, dex and cuckoo.
It also fixes some bugs related to the use of global rules.
Added:
- The
magicmodule is now available behind themagicfeature (not enabled by default). #139. - The
dexmodule is now available behind theobjectfeature (enabled by default). #141. - The
cuckoomodule is now available behind thecuckoofeature (not enabled by default). #143, #144.
Fixed:
- Fix evaluation bug when global rules were declared after non-global rules. #146.
If the global rules had any strings, it would make the evaluation of the rules that followed it invalid. - Fix application of global rules to namespaces. #147, #149.
Global rules were applied to all namespaces instead of only their own namespaces.
Changed:
v0.6.0
This release mainly adds the dotnet module and simplifies a few dependencies.
boreal
Added:
- The
dotnetmodule is now available behind theobjectfeature (enabled by default). #127, #131, #133, #135.
Fixed:
- Fixed compilation when using
--no-default-featuresand other feature combinations. #129, #130. - Fixed exposure of some optional dependencies as their own features. #128.
- Added CI jobs to ensure common combinations of features compile and run tests properly. #132.
Changed:
- The
bitmapdependency has been removed and replaced by an custom implementation for our very limited usecase. #120. - The
windowsdependency has been replaced bywindows-sys. #137. - All dependencies have been updated to their latest versions.
Thanks to @demoray for their contributions.
v0.5.0
This release mainly consists of Yara 4.5 compatibility features and fixes:
Added:
YARA 4.5 support:
- New Warning on unknown escape sequences in regexes. See PR #68.
This warning is more broad than the YARA one from YARA 4.5. - always expose
pe.is_signed97d1d11 - Do not report strings whose name starts with
_as unused 1a8a8cd - Add
pe.export_details[*].rvafield 7597d3f math.countandmath.percentagenow returns an undefined value when given a
value outside the[0; 255]range. 6a09ed2- Imported dlls are ignored if the dll name is longer than 255 bytes 28f8626
- Fix endianness issue in
macho.magicfield, see the Yara fix 50d418d - filter imported functions with invalid name in pe module 5a0cb4e
- bump limit on number of listed export symbols in pe module to 16384 98032b3
Changed:
Fixed:
- Exclude test assets in package 24ca838.
This avoids having the package be flagged by antiviruses, as unfortunately, some of the binaries copied from the yara repository
and used for testing seems trigger false positives.
v0.4.0
This release introduces process memory scanning, implemented on Windows, Linux and macOS. In addition, different modes of scanning are available, documenting the exact semantics of scanning a process memory. This allows picking a mode that is less surpresing and faster than the default mode which reproduces YARA's behavior. See FragmentedScanMode for more details, as well as the updated updated benchmarks.
In addition, an API to scan fragmented memory is now available. This is the API which is used during process scanning, and allows custom handling of which memory blocks to scan.
Finally, a few additional features have been added, including an API to mmap files to scan, and the ability to get partial results when the scanning fails, for example due to a timeout.
v0.3.1
Quick release to add a missing feature in boreal: tags and metadatas of matched rules were not available in the scan results.
Detailed changelog:
Boreal:
- Add rule metadata and tags in results of scans. Only the rule name and namespace was listed, which was an oversight.
In addition, theMetadataandMetadataValuestructs fromboreal-parserare re-exported, to avoid having to depend on it to
inspect matched rules metadatas.
See PR #85.
v0.3.0
This is a huge release containing several months of work, including:
-
Full compatibility with Yara 4.3. All the new features from Yara 4.3 are available.
-
A complete rewrite of the strings compilation algorithm. Performance has been improved dramatically when using a lot of rules or when using strings of lesser quality. See the updated benchmarks.
-
New tools to debug and improve performances of rules scanning, which new flags to display several kind of statistics.
- Strings statistics can now be computed: how are strings compiled, the quality of the extracted atoms, ...
- Evaluation duration statistics can now be computed, detailing how long each evaluation step takes. This is only available if the new
profilingfeature is enabled, to not impact evaluation performance if not set.
-
Improved testing on modules and on the
boreal-clibinary.
Here are some more details on the new YARA features:
Yara 4.3:
- Negation in hex strings, eg
{ ~C3 ~?F }. - New
to_stringfunction inmathmodule. - New
stringmodule withto_intandlengthfunctions. rvafield in imported functions inpemodule.pe.import_rvaandpe.delayed_import_rvafunctions.pe.rich_signature.version_datafield.- Iterator on bytes literal, eg
for any s in ("foo", "bar"): (...). atfor expression, egany of them at 0.- New functions
import_md5andtelfhashinelfmodule. - Use of the
authenticode-parserlib to parse signatures inpemodule. This adds a lot of fields inpe.signatures.
Here are the changes grouped by crate:
Boreal
Added
- Yara 4.3 compatibility. Too many features to list, see above for a short recap of the main new features.
- New
profilingfeature, needed to compute evaluation statistics.
Changed
- Rewrite of the strings compilation algorithm to significantly improve statistics.
opensslfeature removed, replaced with theauthenticodefeature.- Using the
pemodule with thesignaturesparsing now requires calling the unsafe functionCompiler::new_with_pe_signatures. - All dependencies updated.
regexhas been removed in favor ofregex-automata.
Fixed
- Improved handling on invalid ranges in '$a in (from..to)' expression.
- Fixed minor differences in edge cases in
elf.dynamic_section_entriesandelf.number_of_sections(e639df643b05). - Fixed
==operator on boolean values (cec439eee19f). - Fixed some bugs occuring when using the
fullwordkeyword with both thewideandasciimodifiers, see PR #51. - Fix compilation of rules following the failed compilation of a rule using a rule dependency. I doubt this actually impacted anyone, see PR #60.
- Change regex behavior to allow non ascii bytes in regexes. See PR #62. A warning has however been added to warn against this situation.
- Fixed string comparison in the
pe.importsandpe.(delayed_)import_rvafunctions to be case-insensitive, See PR #69.
boreal-cli
Added
- New
-Mflag to a list of available modules. - New
--string-statsflag to display strings' compilation statistics. - New
--scan-statsflag to display evaluation duration statistics.
Changed
- Number of dependencies reduced by removing any use of proc macros.
borealupdated to 0.3, seeborealchanges.
boreal-parser
Added
- Parsing of negation in hex strings, eg
{ ~C3 ~?F }(9c21fd446). - Parsing of
atfor expression, egany of them at 0(b26fbc3b6). parse_regexandparse_hex_stringadded to public API (d6a7afc98).
Changed
- Exports of the crate have been entirely reworked. Objects are now nested in relevant modules (3e8682bec).
- Removal of
bitflagsdependency, rework ofVariableModifiersobject (05877aae4). - Regex now accepts non ascii bytes when not in a class. See PR #62.
- AST for bytes and characters in a regex has been updated to provide escaping information and span location. See PR #68.
Fixed
- Some public objects were not properly exposed publicly, this should now be fixed (3e8682bec).