Skip to main content

Mandacaru 🌵

CI

Antivírus/EDR de código aberto (GPLv3) feito para a nova geração de ataques: malware que muda a cada geração (escrito ou reescrito por IA), phishing sob medida e abuso de agentes de IA e servidores MCP.

Status: v0.2, em Python, voltado para Linux. Detecta e registra; ainda não bloqueia nem remove nada. Também roda no Windows, mas sem eBPF nem serviço.

Por que outro antivírus?

Antivírus clássicos dependem de assinaturas e hashes. Um LLM consegue gerar mil variantes do mesmo malware, cada uma com bytes diferentes. O Mandacaru se apoia no que não muda: o que o código precisa fazer para causar dano.

Camada O que detecta Como
Estática ofuscação + decodificação + execução, download-e-executa, shells reversos, notas de resgate, prompt injection em arquivos YARA + heurísticas de técnica (não de bytes)
Comportamento criptografia em massa (ransomware), shell aberto por serviço web/Office, binário rodando de /tmp, shell com conexão de rede regras com estado sobre eventos
Agentes de IA agente/servidor MCP lendo ~/.ssh, .env, credenciais de nuvem; agente abrindo shell com curl/nc linhagem de processos
Kernel (Linux) todo execve, inclusive processos que vivem milissegundos eBPF (BCC), opcional

Instalação

Ubuntu 24.04+ / Debian 13+ (recomendado: instala o serviço)

Baixe o .deb da página de Releases e instale:

sudo apt install ./mandacaru_0.2.0_all.deb
systemctl status mandacaru                      # o serviço já sobe sozinho
sudo tail -f /var/log/mandacaru/alerts.jsonl    # alertas em tempo real

O apt traz as dependências (python3-yara, python3-psutil, python3-watchdog) e, como recomendado, o python3-bpfcc para o coletor eBPF.

Só a ferramenta de varredura (qualquer Linux)

pipx install mandacaru-edr
mandacaru scan ~/Downloads

No PyPI o pacote se chama mandacaru-edr; o comando é mandacaru. Se o pip precisar compilar o YARA e reclamar de Python.h, instale python3-dev libssl-dev.

Desenvolvimento

git clone https://github.com/VandyckLN/mandacaru && cd mandacaru
python3 -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
# opcional, para o coletor eBPF (Ubuntu/Debian):
sudo apt install bpfcc-tools python3-bpfcc

Configuração

O serviço lê /etc/mandacaru/config.toml. Depois de editar: sudo systemctl restart mandacaru.

[monitor]
# Sem esta chave: Downloads, Documentos e Desktop de cada usuário, mais /tmp e /dev/shm.
# paths = ["/home/ana/Downloads", "/srv/uploads"]
ebpf = true          # se não funcionar, cai para psutil sozinho

[alerts]
min_severity = "LOW" # INFO | LOW | MEDIUM | HIGH | CRITICAL
json = "/var/log/mandacaru/alerts.jsonl"

[rules]
dirs = ["/etc/mandacaru/rules.d"]   # suas regras .yar

[exclude]
paths = []           # globs de caminho absoluto, ex.: "/home/*/.cache/*"

A precedência é flag da linha de comando > arquivo > padrão. Use --config CAMINHO para outro arquivo. Chave desconhecida ou tipo errado faz o comando sair com código 1 e uma mensagem dizendo qual chave.

Uso

# varrer pastas (código de saída 2 se houver alerta HIGH ou CRITICAL: bom para CI)
mandacaru scan ~/Downloads ./projeto

# monitorar em tempo real (Downloads, Documentos, /tmp...); com sudo, usa eBPF
mandacaru monitor
sudo mandacaru --json /var/log/mandacaru.jsonl monitor

# regras YARA próprias
mandacaru --rules ./minhas-regras scan .

Os alertas saem no terminal e, com --json, em JSON Lines, já com as técnicas do MITRE ATT&CK. Esse formato serve para mandar para Wazuh, Loki ou Elastic.

Arquitetura

coletores (procmon | ebpf | fsmon) ──► fila ──► Engine ──► detectores (static | behavior) ──► sinks (console | jsonl)
  • collectors/: geram Events. procmon usa psutil (multiplataforma), ebpf usa um tracepoint de execve (Linux, root) e fsmon usa watchdog (inotify/ReadDirectoryChanges).
  • detectors/static.py: YARA + heurísticas. Só alerta ofuscação quando aparecem juntos conteúdo codificado, decodificação e execução dinâmica.
  • detectors/behavior.py: regras com janela de tempo e cooldown para não inundar o usuário.
  • rules/yara/base.yar: regras base.

Testes e falsos positivos

pytest -q          # 54 testes, com amostras inofensivas que imitam as técnicas

Varredura de cerca de 91 mil arquivos legítimos (stdlib do Python, dist-packages e /usr/share): 0 alertas HIGH/CRITICAL. Ficaram 1 MEDIUM (documentação com curl | bash) e 1 LOW (bundle JS grande).

Roadmap

  • Ações de resposta: suspender processo (SIGSTOP) e colocar arquivo em quarentena
  • Modelo de anomalias local (IsolationForest sobre linhagem, rede e arquivos), sem enviar dados para a nuvem
  • eBPF para openat em arquivos sensíveis e connect (rede)
  • Classificador de scripts gerados por LLM (features de AST + entropia)
  • Proteção do próprio agente: binário em Rust, assinatura das regras
  • Coletor Windows via ETW
  • Serviço systemd + pacote .deb

Contribuindo

Veja CONTRIBUTING.md. Falhas de segurança: SECURITY.md.

Licença

GPL-3.0-or-later. Veja LICENSE. Quem distribuir versões modificadas precisa publicar o código.

Metadata

Release files for mandacaru-edr 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mandacaru-edr 0.2.0
File Size Uploaded Provenance Actions
mandacaru_edr-0.2.0.tar.gz 39.0 kB With provenance Details for mandacaru_edr-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mandacaru-edr 0.2.0
File Interpreter ABI Platform Actions
mandacaru_edr-0.2.0-py3-none-any.whl Python 3 none any Details for mandacaru_edr-0.2.0-py3-none-any.whl

Total release size: 73.0 kB

Release files / mandacaru_edr-0.2.0.tar.gz

Download URL mandacaru_edr-0.2.0.tar.gz
Size 39.0 kB
Tags Source
SHA-256 checksum
How to use checksums
05fbc7aec018afdf36325b46bd07c82bc9296312be1fb9806f4319767f1c1d83
BLAKE2b-256 checksum
How to use checksums
9d775413a59a69ff4b34d781ee8fb37357140ab606b4ce4fffd5e3e9ab8c7418
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / mandacaru_edr-0.2.0-py3-none-any.whl

Download URL mandacaru_edr-0.2.0-py3-none-any.whl
Size 34.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed7f18bd1562d8f58e010e443bd524d1f8f5c7d6ce268535cf52e3b899dd43d7
BLAKE2b-256 checksum
How to use checksums
bf449c72b513cefb1dd79593552445fb972ad0bedaa534178ff06eb2109bb80d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for mandacaru-edr 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mandacaru_edr-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page