You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The space after the equals sign in the pattern ("= .*(sha256|sha512)")) is not required and causes a false positive during conditions when the spacing is not present in an AIDE configuration rule.
The following variations in aide.conf are syntactically sane according to aide --config-check:
Checksums = rmd160+haval+gost+crc32+tiger+sha256+sha512 (works as expected)
Checksums=rmd160+haval+gost+crc32+tiger+sha256+sha512 (legal AIDE configuration syntax, but Lynis currently ignores it)
I propose modifying the egrep pattern to be something like: "^\s*\w+\s*=.*[^-](sha256|sha512)"
The above new pattern would have the following improvements:
Lines with and without leading/trailing space are properly detected.
Conditions when sha256 and sha512 are excluded (-) are handled appropriately (for example: Checksums=rmd160+haval+gost+crc32+tiger-sha256-sha512). Currently, Lynis detects excluded sha256/sha512 as false negatives (which is a bug).
The name of a template (left side of equals sign) must be present.
There is another limitation with the current detection method in Lynis. Just because a template is defined in aide.conf does not mean that the template is being applied to file and directory rules (another potential false negative). Templates can be defined and unused in other words. Furthermore, sha256/sha512 can be explicitly set for directory/file rules outside of templates. However, detecting the presence of sha256/sha512 for every directory/file rule would be more involved and not necessarily desirable in some cases. Perhaps it is best to add a manual review note for the system maintainer to ensure that the stronger hashing algorithms is/are being included in the appropriate rules. This inclusion might be encouraged for rules covering files that are typically subject to increased scrutiny such as /etc/passwd or those under /sbin.
Describe the bug
A Lynis audit reports the following despite explicitly using
sha256
and/orsha512
inaide.conf
:Version
Expected behavior
The test for control
FINT-4402
should pass/not be flagged as a finding whensha256
and/orsha512
are defined.Additional context
The issue stems from the
egrep
pattern employed ininclude/tests_file_integrity
on line 407: https://github.com/CISOfy/lynis/blob/master/include/tests_file_integrity#L407The space after the equals sign in the pattern (
"= .*(sha256|sha512)")
) is not required and causes a false positive during conditions when the spacing is not present in an AIDE configuration rule.The following variations in
aide.conf
are syntactically sane according toaide --config-check
:Checksums = rmd160+haval+gost+crc32+tiger+sha256+sha512
(works as expected)Checksums=rmd160+haval+gost+crc32+tiger+sha256+sha512
(legal AIDE configuration syntax, but Lynis currently ignores it)I propose modifying the
egrep
pattern to be something like:"^\s*\w+\s*=.*[^-](sha256|sha512)"
The above new pattern would have the following improvements:
sha256
andsha512
are excluded (-
) are handled appropriately (for example:Checksums=rmd160+haval+gost+crc32+tiger-sha256-sha512
). Currently, Lynis detects excludedsha256
/sha512
as false negatives (which is a bug).There is another limitation with the current detection method in Lynis. Just because a template is defined in
aide.conf
does not mean that the template is being applied to file and directory rules (another potential false negative). Templates can be defined and unused in other words. Furthermore,sha256
/sha512
can be explicitly set for directory/file rules outside of templates. However, detecting the presence ofsha256
/sha512
for every directory/file rule would be more involved and not necessarily desirable in some cases. Perhaps it is best to add a manual review note for the system maintainer to ensure that the stronger hashing algorithms is/are being included in the appropriate rules. This inclusion might be encouraged for rules covering files that are typically subject to increased scrutiny such as/etc/passwd
or those under/sbin
.This is related to #160.
The text was updated successfully, but these errors were encountered: