Voltar às atualizações
New releaseAug 6, 2026

certgraveyard_yara v2026.08.06

Geração automatizada de regras YARA a partir do banco de dados de certificados comprometidos do Cert Central.

Compartilhar

CertGraveyard YARA - Regras YARA para Análise de Certificados

Gerador de Regras YARA CertGraveyard

GitHub license made-with-python

Geração automatizada de regras YARA a partir do banco de dados de certificados comprometidos do CertGraveyard.

Recursos

  • 🔄 Atualizações Diárias: Verifica automaticamente o CertGraveyard em busca de novos certificados comprometidos
  • 📝 Geração de Regras YARA: Cria regras YARA individuais para cada certificado
  • Validação: Valida todas as regras com yara-python
  • 📦 Gestão de Releases: Releases automatizados com conjunto de regras combinado e arquivo ZIP
  • 📋 Changelog: Mantém um changelog detalhado de todas as adições e modificações

Início Rápido

Instalação

# Clone the repository
git clone https://github.com/tjnel/certgraveyard_yara.git
cd certgraveyard_yara

# Install with UV
uv sync --all-extras

Uso

# Download latest CSV from CertGraveyard
cert-graveyard-yara download

# Check if CSV has changed
cert-graveyard-yara check-changed

# Generate YARA rules
cert-graveyard-yara generate

# Validate rules
cert-graveyard-yara validate --engine yara

# Create combined file and ZIP archive
cert-graveyard-yara combine
cert-graveyard-yara package

# Run full pipeline
cert-graveyard-yara run --all

Usando as Regras Geradas

Baixe o release mais recente ou use as regras diretamente:

# Scan with combined ruleset
yara rules/combined/MAL_Compromised_Cert_*.yara /path/to/scan

# Or use individual rules
yara rules/individual/*.yara /path/to/scan

Estrutura do Projeto

cert-graveyard-yara/
├── .github/workflows/      # GitHub Actions
│   ├── daily-update.yml    # Daily CSV check and rule generation
│   ├── ci.yml              # PR validation and testing
│   └── release.yml         # Release creation
├── src/cert_graveyard_yara/  # Source code
│   ├── __init__.py
│   ├── downloader.py       # CSV download and caching
│   ├── parser.py           # CSV parsing
│   ├── generator.py        # YARA rule generation
│   ├── validator.py        # Rule validation
│   ├── changelog.py        # Changelog management
│   └── cli.py              # Command-line interface
├── tests/                  # Test suite
├── rules/
│   ├── individual/         # Individual YARA rule files
│   └── combined/           # Combined release files
├── data/                   # CSV data and hash files
├── templates/              # Jinja2 templates
└── CHANGELOG.md

Formato das Regras Geradas

Cada regra segue este formato:

import "pe"

rule MAL_Compromised_Cert_Emotet_DigiCert_0a_1b_2c_3d {
   meta:
      description         = "Detects malware Emotet using compromised certificate..."
      author              = "TNEL (https://github.com/tjnel/certgraveyard_yara)"
      reference           = "https://certgraveyard.org"
      
      hash                = "a1b2c3d4..."
      malware             = "Emotet"
      malware_type        = "Trojan"
      
      cert_issuer         = "DigiCert SHA2 Assured ID Code Signing CA"
      cert_serial         = "0a:1b:2c:3d"
      cert_valid_from     = "2024-01-15"
      cert_valid_to       = "2025-01-15"

   condition:
      uint16(0) == 0x5a4d and
      for any sig in pe.signatures : (
         sig.issuer contains "DigiCert SHA2 Assured ID Code Signing CA" and
         sig.serial == "0a:1b:2c:3d"
      )
}

Desenvolvimento

Configurando o Ambiente de Desenvolvimento

# Install with dev dependencies
uv sync --all-extras

# Run linting
uv run ruff check src tests

# Run type checking
uv run mypy src

# Run tests
uv run pytest

Executando Testes

# Run all tests with coverage
uv run pytest

# Run specific test file
uv run pytest tests/test_generator.py

# Run with verbose output
uv run pytest -v

Comandos da CLI

ComandoDescrição
downloadBaixar CSV do CertGraveyard
check-changedVerificar se o CSV mudou desde a última execução
generateGerar regras YARA a partir do CSV
validateValidar regras YARA
changelogAtualizar changelog com as alterações
combineCriar arquivo YARA combinado
packageCriar arquivo ZIP das regras
runExecutar pipeline completo

Configuração

Variáveis de Ambiente

VariávelDescriçãoPadrão
CERTGRAVEYARD_URLURL de download do CSVhttps://certgraveyard.org/api/download_csv

Licença

Licença MIT — consulte LICENSE para detalhes.

Agradecimentos

  • CertGraveyard por fornecer o banco de dados de certificados comprometidos
  • YARA pelo motor de correspondência de padrões

Categorias