Commit graph

11407 commits

Author SHA1 Message Date
Micah Snyder
d755fc09c2
Fix links in github issue template
Fixes: https://github.com/Cisco-Talos/clamav/issues/1429
2025-01-02 09:59:06 -05:00
Micah Snyder
4d389f3eed
Sigtool: CVD build hack for verify bug in 1.1 -> 1.4
Have --build retry if the tar.gz MD5 starts with 00.
2024-12-17 09:17:11 -05:00
Micah Snyder
b8795fde95
Fix CVD dsig verification when hash starts with zeros
Occasionally the MD5 hash for RSA-based digital signature
verification begins with zeros. A bug in how we convert the RSA
decoded plain text from a big number back to a hex string causes it
to write the number to the far left of the plain text buffer.
If the number is smaller than a hash, then zero-padding ends up on
the right when it should've been on the left.

Additional fix: BN_bn2bin() will write zero bytes if the bignum is 0.
So there is no point "error checking" the BN_bn2bin() call.
Thanks to Tom Judge for noticing these shenanigans.
Ref: https://github.com/openssl/openssl/issues/2101

Side note: BN_num_bytes() will also return 0 if the bignum is 0,
which is fine.
2024-12-04 09:46:31 -05:00
Ravi Sundriyal
d6d25c33d9
Jenkins: Archive the cargo vcs file
Adds clamav cargo vcs info for each rust component.
2024-11-14 16:30:22 -05:00
Micah Snyder
163fbdb08e
Freshclam: fix crash when using DatabaseCustomURL for CVD and other files
Freshclam may crash if using DatabaseCustomURL for a CVD and multiple
other files. The issue occurs because of a bad index in the "do not
prune" list.

Fixes: https://github.com/Cisco-Talos/clamav/issues/1364
2024-10-30 19:19:27 -04:00
Micah Snyder
2e544984f0
Freshclam, Sigtool, Clamconf: fix database line count if has empty lines
Fixes: https://github.com/Cisco-Talos/clamav/issues/1390
2024-10-30 17:45:36 -04:00
Micah Snyder
89711e1dfd
Fix a possible crash when loading a malformed logical signature
If the 'hexsig' for an image fuzzy hash subsignature has invalid unicode
it may cause a crash. The problem is we fail to allocate an error
message in this instance, so when it tries to print that message it gets
a NULL dereference.

This is not a security issue.

Fixes: https://issues.oss-fuzz.com/issues/376331488
2024-10-30 16:01:25 -04:00
Micah Snyder
52b201762f
Merge pull request #1387 from micahsnyder/KamathForAIX-gh-1383
Build system improvements to support AIX
2024-10-09 18:01:23 -04:00
Micah Snyder
6f7ceb5498
Merge pull request #1314 from b1tg/regex-exclude
Add regex support for OnAccessExcludePath
2024-10-09 16:49:14 -04:00
Aditya Vidyadhar Kamath
efe89784fc
Build system improvements to support AIX
Closes #1383
2024-10-09 11:08:14 -04:00
b1tg
cfae6dac96
Add regex support for OnAccessExcludePath 2024-09-26 12:33:19 -04:00
Ravi Sundriyal
801a0ef450
Jenkins: Add gitguardian stage to test pipeline
Also changes the Jenkinsfile from scripted to declarative.
2024-09-13 20:37:11 -04:00
Micah Snyder
03d0481b83
Merge pull request #1281 from ragusaa/CLAM-2586-SaveUrlsHTML
Clam 2586 save urls html
2024-09-12 17:15:07 -04:00
Andy Ragusa
666e047f2b
Store URLs from HTML when recording scan metadata json
Store URLs found in HTML `<a>` and `<form>` tags during scan of HTML files
when recording scan metadata.

HTML URL recording will be ON by default, but is a part of the
generate-metadata-json feature.
The generate-metadata-json feature is OFF by default.

This introduces a new general scan option:
- libclamav: `CL_SCAN_GENERAL_STORE_HTML_URLS`.
- ClamD: `JsonStoreHTMLUrls`.
- ClamScan: `--json-store-html-urls`

Thank you Matt Jolly for the helpful comment on the pull request.
2024-09-11 13:40:29 -04:00
Micah Snyder
8ae19eca40
Merge pull request #1295 from ragusaa/CLAM-2585-OleCheckEncrypted_3
Clam 2585 ole check encrypted 3
2024-09-11 12:27:01 -04:00
Andy Ragusa
6d50a60560
Notify user that ole2 files are encrypted
Add keys to the metadata.json file that informs the user that a scanned
ole2 file is encrypted.  Information about the type of encryption is
provided when the information is available.  This feature co-authored by
Micah Snyder.
2024-09-10 11:50:27 -04:00
Micah Snyder
51e239028b
Merge pull request #1264 from ragusaa/CLAM-2602-ValidateMaxRecursion
Added checks for MaxRecursion
2024-09-09 17:48:25 -04:00
Micah Snyder
e7cb0ff6f1
Clang-format touchup 2024-09-09 12:46:33 -04:00
Andy Ragusa
29987c0eeb
Limit the max-recursion scan option to 100
There is presently no limit for the max-recursion scan option.
Selecting a max-recursion limit that is too high will cause confusing
errors. E.g.:

/home/aragusa/install.alz/bin/clamscan -d clamav.hdb . --max-recursion=9999999999

LibClamAV Error: fmap_fd: Attempted to get fd for NULL fmap
/home/aragusa/issue/clamav.hdb: Can't allocate memory ERROR
LibClamAV Error: fmap_fd: Attempted to get fd for NULL fmap
/home/aragusa/issue/test.sh: Can't allocate memory ERROR

This commit prevents setting the max-recursion limit higher than 100.
2024-09-09 12:32:29 -04:00
Micah Snyder
c17a0c7ae6
Merge pull request #1363 from micahsnyder/CLAM-2634-unprivileged-logg
Disable following symlinks when opening log files
2024-09-04 13:48:01 -04:00
Micah Snyder
5210e1560e
Merge pull request #1362 from micahsnyder/CLAM-2627-pdf-indirect-obj-from-objstm
Fix possible out of bounds read in PDF parser
2024-09-04 13:47:10 -04:00
Micah Snyder
88efeda2a4
Disable following symlinks when opening log files
The log module used by clamd and freshclam may follow symlinks.
This is a potential security concern since the log may be owned by
the unprivileged service but may be opened by the service running as
root on startup.

For Windows, we'll define O_NOFOLLOW so the code works, though the issue
does not affect Windows.

Issue reported by Detlef.
2024-09-04 13:15:42 -04:00
Micah Snyder
8915bd2257
Fix possible out of bounds read in PDF parser
The `find_length()` function in the PDF parser incorrectly assumes that
objects found are located in the main PDF file map, and fails to take
into account whether the objects were in fact found in extracted PDF
object streams. The resulting pointer is then invalid and may be an out
of bounds read.

This issue was found by OSS-Fuzz.

This fix checks if the object is from an object stream, and then
calculates the pointer based on the start of the object stream instead
of based on the start of the PDF.

I've also added extra checks to verify the calculated pointer and object
size are within the stream (or PDF file map). I'm not entirely sure this
is necessary, but better safe than sorry.

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=69617
2024-09-04 13:12:50 -04:00
Micah Snyder
25ca17b018
Merge pull request #1347 from micahsnyder/CLAM-2637-mbox-multipart-json-main
Email Parser: Reduce message multipart json logic complexity
2024-09-01 14:18:40 -04:00
Micah Snyder
94a8917a17
Merge pull request #1350 from micahsnyder/CLAM-2666-python-cgi
Tests: remove unused Python modules from freshclam tests
2024-08-28 16:07:51 -04:00
Micah Snyder
e06cf177e7
Tests: remove unused Python modules from freshclam tests
The 'cgi' module is deprecrated and will be removed in Python 3.13.
We weren't using it anyways.

Fixes: https://github.com/Cisco-Talos/clamav/issues/1327
2024-08-28 15:09:12 -04:00
Micah Snyder
19b25ce67d
Merge pull request #1324 from rsundriyal/CLAM-2563-version-bump-up
1.5.0-devel version changes
2024-08-21 11:38:18 -07:00
rsundriyal
5a84081574
New release version changes
Signed-off-by: rsundriyal <ravis069@gmail.com>
2024-08-21 11:53:20 -04:00
Micah Snyder
c96130a23a
Email Parser: Reduce message multipart json logic complexity
Simplify JSON object handling in mbox scanning, eliminate a number of
single use functions, and reduce the places the JSON object is exposed.
2024-08-19 15:06:38 -04:00
Micah Snyder
cad552d115
Merge pull request #1280 from micahsnyder/CLAM-2559-1.4.0-release-prep
Remove the -rc suffix for 1.4.0 release
2024-07-29 13:44:58 -07:00
Micah Snyder
9d25f803d1
Merge pull request #1316 from micahsnyder/increase-modulename-length
tests: Fix issue when path to unrar module is very long
2024-07-29 13:44:18 -07:00
Micah Snyder
e131ad8bd5
Merge pull request #1263 from micahsnyder/lzh-delharc-crc-check-fix
LZH: check CRC after reading file data
2024-07-29 08:10:54 -07:00
Micah Snyder
1da18af0f7
LZH: check CRC after reading file data
The checksum should be verified after reading file data, not before.
2024-07-26 14:50:25 -04:00
Micah Snyder
0d4075ec6c
Merge pull request #1318 from Artoria2e5/patch-1
INSTALL.md: change LLVM description
2024-07-26 09:22:14 -07:00
Mingye Wang
333ac26af5
INSTALL.md: change LLVM description
Somehow the changes from #692 did not come with a doc update. The cap at version 13 is given from #574. I did not try to build it with LLVM 14, so I don't know whether it truly doesn't compile or simply fails due to the CMake thing.
2024-07-26 16:11:09 +08:00
Micah Snyder
55a526d310
Merge pull request #1317 from znley/main
Bump rust libc from 0.2.154 to 0.2.155
2024-07-25 10:33:25 -07:00
znley
8aa8524661
Bump rust libc from 0.2.154 to 0.2.155
rust libc 0.2.154 has been yanked.
https://crates.io/crates/libc/0.2.154
2024-07-25 12:53:41 -04:00
Micah Snyder
287d8d830f
tests: Fix issue when path to unrar module is very long
If the LD_LIBRARY_PATH for libclamunrar_iface longer than 128 chars,
it may be truncated and fail to load the RAR module.
2024-07-24 11:39:17 -04:00
Micah Snyder
565142d469
News: final updates prior to 1.4.0 2024-07-23 18:52:14 -04:00
Micah Snyder
37bcf93345
Undo libclamav SOVERSION change; Only bump revision
Resolves https://github.com/Cisco-Talos/clamav/issues/1296
2024-07-23 18:33:22 -04:00
Micah Snyder
09e828bc63
Remove the -rc suffix for 1.4.0 release 2024-07-23 18:33:19 -04:00
Micah Snyder
6c0d644a3e
Merge pull request #1309 from userwiths/issue-1174-FailIfCvdOlderThan-error-on-whitelist
fix: Allow `clamd` to start normally when a whitelist is present.
2024-07-23 14:07:22 -07:00
Stiliyan Tonev (Bark)
9a7b186aec
fix: Issue with --fail-if-cvd-older-than and non-CVD database files
Clamscan and ClamD will throw an error if you use the
'--fail-if-cvd-older-than=DAYS' / 'FailIfCvdOlderThan' option and
try to load any plaintext signature files.
That is, it throws an error when encountering plain signature files like
`.ign2`, `.ldb`, `.hdb`, etc.
This feature should only verify CVD / CLD files.

The feature (and bug) was introduced in ClamAV 1.1.0, here:
e4fe6654c1

With this change, the `cl_cvdgetage` checks will skip any file that is
not a CVD or CLD.

Fixes: https://github.com/Cisco-Talos/clamav/issues/1174
2024-07-23 16:01:07 -04:00
Micah Snyder
2a5241ab6d
Merge pull request #1301 from liushuyu/respect-build-flags
cmake/FindRust.cmake: inherit RUSTFLAGS from the environment
2024-07-23 09:53:20 -07:00
liushuyu
bef8451ad2
cmake/FindRust.cmake: inherit RUSTFLAGS from the environment 2024-07-23 10:05:40 +08:00
Micah Snyder
8f914a0105
Merge pull request #1294 from sebastianas/lib_version
Add a dependency for the version map.
2024-07-22 10:53:23 -07:00
Micah Snyder
60ade09054
Merge pull request #1305 from micahsnyder/CLAM-2636-expiring-crb-and-Y2K38
Fix unit test caused by expiring signing certificate
2024-07-22 10:47:57 -07:00
Micah Snyder
d11590f7a4
Fix unit test caused by expiring signing certificate
The clamscan test "assorted_test.py::TC::test_pe_cert_trust" is about to
fail because the "test.exe" test file was signed with a cert set to
expire after only 2 years, and it has been 23 months.

While attempting to generate a new one that will last 73000 days (200
years), I discovered that any signing certificate set to expire after
2038 will fail the trust-check because the `ca.not_after` variable is
maxed out `time_t` incapable of expressing a higher number.
To fix this, I've upgraded the variables to `uint64_t`.

I also had to replace a bunch of generated signatures to match the new
"test.exe".

Finally, I noticed that "ca.not_before" was being set to the token[8]
instead of token[9], which presumably mean the "NotBefore" field for
Trusted and Revoked Certificates was non-functional, as it was treating
the "CertSign" boolean as the "NotBefore" value.

Fixes: https://github.com/Cisco-Talos/clamav/issues/1300
2024-07-22 13:25:52 -04:00
Sebastian Andrzej Siewior
34d4d0ed83
Add a dependency for the version map.
Add a dependcy  on that version map so that it is re-run once it
changes.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
2024-07-22 10:28:03 -04:00
Micah Snyder
652d5f6cd3
Merge pull request #1293 from sebastianas/unaligned
cli_check_mydoom_log: Avoid unaligned access.
2024-07-22 07:26:37 -07:00