Skip to content

Instantly share code, notes, and snippets.

@humpalum
Last active February 17, 2021 11:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save humpalum/ce68317df2b740217ff2940f7479780b to your computer and use it in GitHub Desktop.
Save humpalum/ce68317df2b740217ff2940f7479780b to your computer and use it in GitHub Desktop.
Ansible playbook to check for files related to Exaramel
---
# Checks if files exists that related to Exaramel Malware
# Ref:https://www.cert.ssi.gouv.fr/uploads/CERTFR-2021-CTI-005.pdf
- name: Setting files to check
set_fact:
maliciousFiles:
- /tmp/.applocktx
- /tmp/.applock
- /usr/local/centreon/www/search.php
- /usr/share/centreon/www/search.php
- /usr/share/centreon/www/modules/Discovery/include/DB−Drop.php
- /usr/share/centreon/www/htmlHeader.php
- name: Check whether a file exists
stat:
path: "{{item}}"
register: exaramelInfected
with_items: "{{maliciousFiles}}"
- name: Evaluate Results
set_fact:
res: "{% for file in exaramelInfected.results %}{% if file.stat.exists %}{{file.stat.path}};{%endif%}{% endfor %}"
- name: Print Clean Hosts
debug:
msg: "'{{ inventory_hostname }}' Likely Clean!"
when: res == ""
- name: Print Infected Hosts
fail:
msg: "'{{ inventory_hostname }}' infected with Exaramel malware: {{res}}"
when: res != ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment