Commit Graph
3215 Commits
Author SHA1 Message Date
Victor M. Alvarez 092187edc9 Adds maintenance mode warning
Adds a warning banner to the README indicating that the project is in maintenance mode, directing users to the YARA-X project for further information.
2025-06-04 13:52:28 +02:00
Victor M. Alvarez 7ff39042be bump version number to 4.5.4. v4.5.4 2025-05-26 18:06:13 +02:00
Victor M. Alvarez 6c8accd96a bump version number to 4.5.3. 2025-05-26 18:02:53 +02:00
Victor M. Alvarez 2e64b4c12d fix: escape new line and carriage returns characters when printing file names.
Matches on files whose name contains such characters are not properly printed.
v4.5.3
2025-05-22 18:51:07 +02:00
Robin Lambertz a7f351aab0 Avoid infinite loops when iterating macho regions (#2145)
There was a possible (and trivial to trigger) infinite loop in yara that can be caused by quiting an application while we're enumerating its memory regions. When this happens, vm_region_64 will start returning an error (that isn't KERN_INVALID_ADDRESS), which yr_process_get_next_memory_block reacted to by infinite looping.

Generally speaking, the loop in that function seems completely unnecessary, and as such was removed to make the control flow easier to reason about.

This can be reproduced easily by running sudo yara test.yar <pid> on a large application, and quitting the app while the scan is running. This isn't 100% consistent, but more often than not I would end up with the infinite loop.
2025-04-09 20:46:04 +02:00
Mani dca494038c Update README.md (#2146) 2025-04-09 20:45:17 +02:00
Victor M. Alvarez bae530c7f0 Remove Bazel as a build system. (#2144)
Bazel was the build system used by VirusTotal. Now that VirusTotal has moved to YARA-X, maintaining the Bazel infrastructure working is painful, specially with the backward incompatible changes introduced in recent versions of Bazel.
2025-04-09 20:44:51 +02:00
Victor M. Alvarez 93d1de6db6 Add check for null pointers in yr_lex_parse_rules_bytes and yr_lex_parse_rules_string
Closes #2139
2025-02-27 11:43:44 +01:00
gremat 53642c3fcb feat: support mimalloc (#2135) 2025-02-11 13:27:14 +01:00
gremat 0eb7b3ec96 fix: restore debug output indentation in catch clause (#2134) 2025-01-30 11:59:30 +01:00
Shane Huntley 5ff67fca5b Additional elf parsing check to avoid integer overflow. (#2131) 2025-01-13 10:12:24 +01:00
secDre4mer d3eae3258a fix: correct indentation issues (#2133) 2025-01-13 10:12:02 +01:00
duckie 91fda4f2ed Remove the libyara from path libyara/Makefile.am (#2129)
The file is no longer present on that path and moved to root of project.
Fixing the docs so it does'nt cause confusion to others like it did to
me.
2025-01-13 10:10:52 +01:00
utkonos ef8f1de92e Replace stray markdown with correct RST (#2132) 2025-01-13 10:10:16 +01:00
signalblur 390b66bc93 Add Corelight to list of YARA users (#2124) 2024-12-13 10:30:33 +01:00
Victor M. Alvarez 42297f8595 Disable cache in Bazel build workflow 2024-12-11 11:22:07 +01:00
Victor M. Alvarez f1ca8b754a Rename cache trying to solve issue with Bazel build 2024-12-11 11:19:42 +01:00
Victor M. Alvarez 610e88fb75 Fix typo in documentation. 2024-12-11 11:10:46 +01:00
Victor M. Alvarez 1fb43ebff2 Upgrade to actions/cache@v4.
GitHub is deprecating versions 2 and 3.
2024-12-11 10:26:05 +01:00
zdwg42 3a60f2dd8c Remove dotnet configure instructions since it's enabled by default now (#2122) 2024-12-02 21:10:06 +01:00
Victor M. Alvarez 2ff13ab999 fix: large memory consumption while parsing corrupted PE. (#2120)
After #2119 `yara` is consuming a large amount of memory while parsing 9bddb45c44d9c25a4f97ef800cb110de5e6a15349bac05d389c8bda37902f25a. That's because after the change it doesn't limit the total number of imported functions, only the total number of parsing attempts, but the count is reset with each import entry. This file has a large number of entries and a large number of functions per entry, the total number of functions is very high.

It turns out that we must limit both the total number of correctly parsed functions (for cases like this one), and the total number of parsing attempts (for cases like the one #2119 was aiming to solve).
2024-11-28 13:31:32 +01:00
Victor M. Alvarez b61ce3c4a3 Upgrade upload-artifact action to v4 2024-11-26 16:25:46 +01:00
Wesley Shields 14a9f03a7f Fix bug when parsing imports from 32bit PE. (#2119)
There is a bug when parsing [1] which turns out to be incorrectly checking the
number of successfully parsed imported functions and not the number of parsed
attempts. This particular sample is badly malformed and is causing excessive
loops in the parser while attempting to parse invalid data. With this fix it
will finish in a few seconds on my laptop.

[1]: 9c8e4dfa84b1ce7e919964978d33eada266d58b2aacdbef44b0618cc178ea421
2024-11-26 16:23:47 +01:00
Josh Kamdjou 548ba3d9c8 Add Sublime Security to Who's using YARA (#2108) 2024-09-25 19:51:07 +02:00
Alexander J 2c9a728ada typos in docs/writingrules.rst (#2110) 2024-09-24 20:10:23 +02:00
Victor M. Alvarez 688268d839 Update AppVeyor token. v4.5.2 2024-09-10 10:52:59 +02:00
Victor M. Alvarez 1628e61f8e Bump version to 4.5.2 2024-09-10 10:44:46 +02:00
Victor M. Alvarez 44fd094544 Fix regression introduced in 6209630
One section entry was being ignored while parsing file b200f89fe313b6311e444e37725cae95127797ddb430e711c788c264acf92eb0 because we were forcing every resource entry to be shorter than the PE itself.

Although this sanity check makes sense, with truncated files this can lead to resource entries that are ignored. Here we make the sanity check more permissive, allowing entries that are larger than the PE  file, but rejecting entries with ridiculously large sizes.
2024-09-10 09:35:08 +02:00
Hilko Bengen 51940253d8 filemap: define PROC_SUPER_MAGIC, avoid linux/magic.h (#2103)
PR #1848 caused build issues with some "unusual" build configurations
– apparently we can't rely on linux/magic.h being present when
cross-building for musl libc.

Defining PROC_SUPER_MAGIC should not cause a problems since it should
be considered part of the Linux kernel/user API and it is unlikely to
change.
2024-09-05 17:11:08 +02:00
Tad KellerandTad Keller 79954d33e4 use new module macros in docs (#2100)
Co-authored-by: Tad Keller <[email protected]>
2024-08-16 10:05:01 +02:00
Wes 6936a2a528 docs: minor updates to xor (#2098) 2024-08-04 22:44:25 +02:00
Victor M. Alvarez a8d59da636 Use MacOS 13 in build workflow.
For some reason in MacOS 14 the build fails because the `configure` script is unable to find the Jansson library, even thought it is correctly installed by `brew`.
2024-08-02 10:35:51 +02:00
Victor M. Alvarez 9f3da0911f Use latest MacOS in build workflow. 2024-08-02 10:24:56 +02:00
Victor M. Alvarez 17fc88ef48 Remove all references to ERROR_TOO_MANY_SCAN_THREADS
This error code is not used anymore. Closes #2068.
2024-08-02 10:01:16 +02:00
Victor M. Alvarez 2a9f61d484 Mitigate stack overflow when scanning very deep directory trees.
Closes #2088.
2024-08-01 11:42:01 +02:00
chrisdoman be2212a29c Add Cado to who is using Yara (#2086) 2024-08-01 11:31:02 +02:00
Chris Arceneaux 6cb6c08d54 Adding Veeam (#2083)
Adding Veeam to list of companies that use YARA.
2024-08-01 11:30:21 +02:00
Victor M. Alvarez b68de47e82 Use YR_MAX_PATH instead of MAX_PATH (#2090)
Replace all instances of `MAX_PATH` with `YR_MAX_PATH`.
2024-08-01 11:29:48 +02:00
Victor M. Alvarez c70d927719 Fix warning
`_rich_version` in PE module should return an `int64_t` instead of `uint64_t`.
2024-07-26 11:14:18 +02:00
Victor M. Alvarez cbc982d754 Fix crash while parsing PE Rich header
File e77b007c9a964411c5e33afeec18be32c86963b78f3c3e906b28fcf1382f46c3 has a Rich header of only 8 bytes, which is smaller than the RICH_SIGNATURE structure. This was causing a crash when some of the `rich_xxx` functions were used with this file.
2024-07-24 14:31:30 +02:00
Victor M. Alvarez 6fe197e1bc Fix null pointer dereference introduced in 8616165.
See: https://oss-fuzz.com/testcase?key=5726747190951936
2024-06-21 16:25:46 +02:00
Victor M. Alvarez 8616165472 Fix segfault with regular expressions that matched the zero-length string.
In regular expressions, repetition operators`{0,0}` and `{,0}` are valid, but they always match the zero-length string. For instance, `a{0,0}` and `[a-z]{0,0}` both match the zero-length string.

When the whole regular expression consists in one of these repetitions it caused a segfault during the evaluation of the regular expression because the `forward_code_ref` field for the root atom in the atom's tree was null.

Closes #2084.
2024-06-19 13:47:58 +02:00
Victor M. Alvarez 608fb3da46 Increase the limit for the maximum number of rows in dotnet module.
See:
https://github.com/VirusTotal/yara-x/issues/138
https://github.com/VirusTotal/yara-x/commit/2f410f7dc26f9ff8fcf3847dc143e07126b90a87
2024-06-19 11:47:47 +02:00
Victor M. Alvarez 4fc1ff822c Recover from syntax error at the end of an included file
When an included file contains an error that makes the parsing fail, the compiler must pop the file name from the stack before continuing parsing the original file, otherwise it will cause the confusing errors described in https://github.com/VirusTotal/yara-python/issues/260
2024-05-31 16:30:11 +02:00
Victor M. Alvarez 3f5b4c73d9 Limit resource names to 1000 character at most.
Fixes high memory usage with corrupt files like bd15a7227770d89546e0a16e4c8da45937d970baa810827a7ceb17abd3138fec.
2024-05-29 12:15:44 +02:00
Victor M. Alvarez 0e5b6bb966 Bump version to 4.5.1 v4.5.1 2024-05-25 12:23:51 +02:00
Victor M. Alvarez e453eb1314 Fix infinite loop with certain corrupt files. 2024-05-24 14:03:42 +02:00
Victor M. Alvarez 8a0c19d6f5 Remove printf 2024-05-23 13:44:29 +02:00
Victor M. Alvarez 46ae348687 Remove printf. 2024-05-23 13:43:52 +02:00
Victor M. Alvarez f1640e24ec Allow spaces in regexp repetition operators.
For instance, `x{n, m}`, `x{n ,m}` and `x{n  ,  m}` are all equivalent to `x{n,m}`. This is done for compatibility with YARA-X, but I've seen real-life regular expressions in that contain such spaces, for example:

```
/C:\\Users\\qqq\\.{30, 50}\.pdb/
```
2024-05-22 15:51:43 +02:00