ossec-hids icon indicating copy to clipboard operation
ossec-hids copied to clipboard

False positive "Trojaned version of file '/bin/diff' detected" on Archlinux

Open tiiiecherle opened this issue 2 years ago • 3 comments

Hey Ossec Team,

with the latest version diffutils 3.8-1 installed ossec reports a trojaned version of a few files.

OSSEC HIDS Notification.
2021 Oct 22 10:22:02

Received From: archvbox->rootcheck
Rule: 510 fired (level 7) -> "Host-based anomaly detection event (rootcheck)."
Portion of the log(s):

Trojaned version of file '/bin/diff' detected. Signature used: 'bash|^/bin/sh|file\.h|proc\.h|/dev/[^n]|^/bin/.*sh' (Generic).



--END OF NOTIFICATION



OSSEC HIDS Notification.
2021 Oct 22 10:22:02

Received From: archvbox->rootcheck
Rule: 510 fired (level 7) -> "Host-based anomaly detection event (rootcheck)."
Portion of the log(s):

Trojaned version of file '/sbin/diff' detected. Signature used: 'bash|^/bin/sh|file\.h|proc\.h|/dev/[^n]|^/bin/.*sh' (Generic).



--END OF NOTIFICATION



OSSEC HIDS Notification.
2021 Oct 22 10:22:02

Received From: archvbox->rootcheck
Rule: 510 fired (level 7) -> "Host-based anomaly detection event (rootcheck)."
Portion of the log(s):

Trojaned version of file '/usr/bin/diff' detected. Signature used: 'bash|^/bin/sh|file\.h|proc\.h|/dev/[^n]|^/bin/.*sh' (Generic).



--END OF NOTIFICATION



OSSEC HIDS Notification.
2021 Oct 22 10:22:02

Received From: archvbox->rootcheck
Rule: 510 fired (level 7) -> "Host-based anomaly detection event (rootcheck)."
Portion of the log(s):

Trojaned version of file '/usr/sbin/diff' detected. Signature used: 'bash|^/bin/sh|file\.h|proc\.h|/dev/[^n]|^/bin/.*sh' (Generic).

I opened an issue at the archlinux bug tracker here: https://bugs.archlinux.org/task/72519#comment203202

When testing the files against virustotal database nothing suspicious is reported and the checksum seems fine.

Changing the diff line in rootkit_trojans.txt to diff !bash|^/bin/sh|file\.h|proc\.h|^/bin/.*sh! solves the reporting.

I assume it is a false positive and after confirming the rootkit_trojans.txt should be changed.

Thanks in advance

tiiiecherle avatar Oct 24 '21 11:10 tiiiecherle

same for Fedora35. Trojaned version of file '/usr/bin/diff' detected. Signature used: 'bash|^/bin/sh|file.h|proc.h|/dev/[^n]|^/bin/.*sh' (Generic).

RonV666 avatar Nov 14 '21 16:11 RonV666

Any updates on this issue? The bug still exists now.

MKPlato avatar Sep 07 '22 01:09 MKPlato

Please test PR #2062 I think it will handle this.

ddpbsd avatar Sep 07 '22 14:09 ddpbsd

Just experienced this issue on several Ubuntu hosts of mine:

  | manager.name | wazuh   | rule.firedtimes | 8   | rule.mail | false   | rule.level | 7   | rule.pci_dss | 10.6.1   | rule.description | Host-based anomaly detection event (rootcheck).   | rule.groups | ossec, rootcheck   | rule.id | 510   | rule.gdpr | IV_35.7.d   | decoder.name | rootcheck   | full_log | Trojaned version of file '/bin/diff' detected. Signature used: 'bash|^/bin/sh|file.h|proc.h|/dev/[^n]|^/bin/.*sh' (Generic).   | location | rootcheck

rileyjnevins avatar Oct 31 '22 19:10 rileyjnevins

I agree with the others, we are experiencing this: (Ubuntu 22.04 server)

Wazuh Alert: 'Host-based anomaly detection event (rootcheck).'

DETAILS Description: 'Host-based anomaly detection event (rootcheck).' Log: 'Trojaned version of file /usr/bin/diff detected. Signature used: bash ^/bin/sh file/.h proc/.h /dev/[^n] ^/bin/.*sh (Generic).' Rule: '510' location: 'rootcheck'

SedonD avatar Dec 31 '22 15:12 SedonD

Same problem.

{ "agent": { "ip": "xxx", "name": "xxx", "id": "004" }, "manager": { "name": "xxxx" }, "data": { "file": "/bin/diff", "title": "Trojaned version of file detected." }, "rule": { "firedtimes": 1, "mail": false, "level": 7, "pci_dss": [ "10.6.1" ], "description": "Host-based anomaly detection event (rootcheck).", "groups": [ "ossec", "rootcheck" ], "id": "510", "gdpr": [ "IV_35.7.d" ] }, "decoder": { "name": "rootcheck" }, "full_log": "Trojaned version of file '/bin/diff' detected. Signature used: 'bash|^/bin/sh|file\.h|proc\.h|/dev/[^n]|^/bin/.*sh' (Generic).", "input": { "type": "log" }, "@timestamp": "2023-01-01T08:20:04.988Z", "location": "rootcheck", "id": "1672561204.10642855", "timestamp": "2023-01-01T08:20:04.988+0000", "_id": "nU9qbIUBLJew7AZ0p-A5" }

kamalmjt avatar Jan 01 '23 17:01 kamalmjt

Too many notifications of this

Practicalbutterfly5 avatar Jan 12 '23 18:01 Practicalbutterfly5

this issus still continues as below Wazuh Notification. 2023 Feb 03 14:41:32

Received From: siem1->rootcheck Rule: 510 fired (level 7) -> "Host-based anomaly detection event (rootcheck)." Portion of the log(s):

Trojaned version of file '/bin/diff' detected. Signature used: 'bash|^/bin/sh|file.h|proc.h|/dev/[^n]|^/bin/.*sh' (Generic). title: Trojaned version of file detected. file: /bin/diff

lemogra avatar Feb 03 '23 14:02 lemogra

I think the issue may be due to a reverence to /dev/full in the diff executable.

# strings /bin/diff | grep /dev/[^n]
/dev/full

I made a change in /var/ossec/etc/shared/rootkit_trojans.txt to the following line to see if that fixes the issue:

-diff        !bash|^/bin/sh|file\.h|proc\.h|/dev/[^n]|^/bin/.*sh!
+diff        !bash|^/bin/sh|file\.h|proc\.h|/dev/[^nf]|^/bin/.*sh!

fstrube avatar Feb 06 '23 00:02 fstrube

Any update on this?

ngisvold avatar Mar 20 '23 00:03 ngisvold

This is still happening on Linux Mint 21

"timestamp":"2023-03-19T14:54:44.046+0000","rule":{"level":7,"description":"Host-based anomaly detection event (rootcheck).","id":"510","firedtimes":2,"mail":true,"groups":["ossec","rootcheck"],"gdpr":["IV_35.7.d"]},"agent":{"id":"027","name":"Mint21","ip":"192.168.1.19"},"manager":{"name":"secon-server-wazuh-manager"},"id":"1679237684.3782962","full_log":"Trojaned version of file '/usr/bin/diff' detected. Signature used: 'bash|^/bin/sh|file\.h|proc\.h|/dev/[^n]|^/bin/.*sh' (Generic).","decoder":{"name":"rootcheck"},"data":{"title":"Trojaned version of file detected.","file":"/usr/bin/diff"},"location":"rootcheck"}

ll3N1GmAll avatar Mar 20 '23 08:03 ll3N1GmAll

I never got any responses to the PR, but I've merged it. Hopefully it helps.

ddpbsd avatar Mar 20 '23 13:03 ddpbsd

Still happening to macOS as well

fuomag9 avatar Mar 20 '23 16:03 fuomag9

Happening on Debian 11 with Wazuh v4.3.10

troublestarter avatar Mar 22 '23 22:03 troublestarter

Wazuh 4.4.0 and still happening .... Ubuntu 22.04 arm64

Practicalbutterfly5 avatar Mar 29 '23 01:03 Practicalbutterfly5

Same here

serfermorhc avatar Apr 20 '23 15:04 serfermorhc

can confirm same, latest ver. of wazuh

y0d4a avatar Apr 26 '23 07:04 y0d4a

Same, Wazuh 4.4.1 and Ubuntu Server minimal 22.04 (all updates).

Any News?

pleibling avatar May 16 '23 09:05 pleibling

I have this issue with /usr/bin/mail on RHEL 9 and Wazuh 4.4.1.

titleistfour avatar May 24 '23 16:05 titleistfour

Wanted to leave an update. wazuh-manager version 4.4.5 wazuh-agent version 4.4.5

Files Indicated: /bin/diff /usr/bin/diff

Signature used: bash|^/bin/sh|file.h|proc.h|/dev/[^n]|^/bin/.*sh

Going to try fstrube edit to rootkit_trojans.txt

gand0rf avatar Jul 21 '23 22:07 gand0rf

Receiving the same.

wazuh-manager version 4.4.5 running on an Ubuntu 22.04.2 LTS virtual machine. wazuh-agent version 4.4.5 also running on an Ubuntu 22.04.2 LTS virtual machine (different VM from above).

Trojaned version of file '/usr/bin/diff' detected. Signature used: 'bash|^/bin/sh|file.h|proc.h|/dev/[^n]|^/bin/.*sh' (Generic). Trojaned version of file '/bin/diff' detected. Signature used: 'bash|^/bin/sh|file.h|proc.h|/dev/[^n]|^/bin/.*sh' (Generic).

iNimbleSloth avatar Jul 25 '23 15:07 iNimbleSloth

Receiving the same. on Debian 12.1 with wazuh-agent 4.5.0

kayo77 avatar Aug 25 '23 07:08 kayo77

I think nobody work on this ...

troublestarter avatar Aug 25 '23 07:08 troublestarter

Getting the same notification on Debian 12, wazuh 4.5.1

arf20 avatar Aug 25 '23 14:08 arf20

In lieu of a proper fix, this will silence the alert from Wazuh on Debian/Ubuntu:

sudo vi /var/ossec/etc/rules/local_rules.xml

Add something like:

<group name="rootcheck,ossec,">
  <rule id="510" level="0" overwrite="yes">
    <match>/bin/diff</match>
    <description>Ignore 510 rootcheck on /bin/diff</description>
  </rule>
</group>

Test the changes:

sudo /var/ossec/bin/wazuh-analysisd -t

If it looks good restart:

sudo systemctl restart wazuh-manager.service

33b5e5 avatar Aug 29 '23 08:08 33b5e5

Hi @33b5e5

Thanks for the workaround.

But it disable the check on /bin/diff ?

Should be great if it would work as exepected :)

Thanks again that said

troublestarter avatar Aug 29 '23 08:08 troublestarter

Is there any news about this?

earthyfort avatar Sep 18 '23 02:09 earthyfort

same on Ubuntu 23 Trojaned version of file detected. Trojaned version of file '/usr/bin/diff' detected. Signature used: 'bash|^/bin/sh|file.h|proc.h|/dev/[^n]|^/bin/.*sh' (Generic).

dibu28 avatar Sep 19 '23 08:09 dibu28

I have the same thing on U22 with Wazuh v4.5.2 Trojaned version of file '/usr/bin/diff' detected. Signature used: 'bash|^/bin/sh|file\.h|proc\.h|/dev/[^n]|^/bin/.*sh' (Generic).

vinsk0h avatar Sep 21 '23 18:09 vinsk0h

Same issue with Agent v4.5.2 and Debian 12

0xr00tx avatar Oct 03 '23 08:10 0xr00tx