<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
<!-- NERF is a trademark of defconxt. -->
---
name: reverse-engineering-ransomware-samples
description: >-
  Reverse engineer ransomware samples to identify encryption algorithms, key management weaknesses, and potential decryption approaches.
domain: cybersecurity
subdomain: reverse-engineering
tags:
  - ransomware
  - encryption
  - malware
  - crypto-analysis
  - key-recovery
version: "1.0"
author: defconxt
license: AGPL-3.0
metadata:
  mitre-attack: ["T1486"]
  cwe: ["CWE-327"]
  tools: ["Ghidra", "x64dbg", "CyberChef", "hashcat", "ransomware-id"]
---

# Reverse Engineering Ransomware Samples

## Overview

Reverse engineer ransomware samples to identify encryption algorithms, key management weaknesses, and potential decryption approaches.

## Prerequisites

| Tool / Requirement | Details |
|---|---|
| `Ghidra` | Security tooling |
| `x64dbg` | Security tooling |
| `CyberChef` | Security tooling |
| `hashcat` | Security tooling |
| `ransomware-id` | Security tooling |
| Isolated lab environment for testing | Environment requirement |
| Authorization and signed Rules of Engagement (RoE) | Environment requirement |
| Relevant target samples or systems acquired through authorized channels | Environment requirement |

## Quick Reference

```bash
# Identify ransomware family
yara -r /opt/yara-rules/ransomware/ ./sample.exe

# Extract encryption constants
strings -a ./sample.exe | grep -iE "AES|RSA|encrypt|decrypt|key"

# Analyze with Ghidra
# Focus on: CryptEncrypt, CryptGenKey, BCryptEncrypt API calls

# Check for known decryptor availability
python3 ransomware_id.py --sample ./sample.exe
```

## Workflow

### Step 1: Preparation and Reconnaissance

```bash
# Identify target and gather initial intelligence
file ./target_sample
ghidra --version 2>/dev/null || echo "Install Ghidra"

# Set up working directory
mkdir -p /tmp/reverse-engineering-ransomware-samples/{output,logs,artifacts}
```

### Step 2: Primary Analysis

```bash
# Execute primary analysis with Ghidra
# Refer to Quick Reference above for detailed commands
echo "[*] Running Reverse Engineering Ransomware Samples with Ghidra..."

# Log all operations
script -q /tmp/reverse-engineering-ransomware-samples/logs/session.log
```

### Step 3: Deep Investigation

```bash
# Apply x64dbg for secondary analysis
echo "[*] Deep investigation with x64dbg..."

# Cross-reference findings
diff /tmp/reverse-engineering-ransomware-samples/output/primary.json /tmp/reverse-engineering-ransomware-samples/output/secondary.json
```

### Step 4: Documentation and Reporting

```bash
# Generate structured findings report
cat <<'EOF' > /tmp/reverse-engineering-ransomware-samples/output/report.json
{
  "technique": "reverse-engineering-ransomware-samples",
  "domain": "reverse-engineering",
  "tools_used": ["Ghidra", "x64dbg"],
  "findings": [],
  "recommendations": []
}
EOF
```

## Detection

```yaml
title: Reverse Engineering Ransomware Samples Detection
id: f4a06154-1b92-4e47-8a51-631a2d1efc5b
status: experimental
description: Detects suspicious activity related to reverse engineering ransomware samples techniques in reverse engineering context
logsource:
  category: process_creation
  product: windows
detection:
  selection:
    CommandLine: "*reverse*engineering*"
  condition: selection
level: medium
tags:
  - attack.t1486
  - attack.defense_evasion
falsepositives:
  - Malware analysis sandbox performing automated binary inspection
```


**Detection Opportunities**

| Indicator | Source | Detection Logic |
|---|---|---|
| Reverse Engineering Ransomware Samples Detection | windows/process_creation | Sigma rule (medium) |
| ATT&CK Coverage | MITRE ATT&CK | T1486 |

## Verification

- [ ] Environment and tools verified and operational
- [ ] Target samples acquired through authorized channels
- [ ] Primary analysis completed with findings documented
- [ ] Secondary validation performed with independent tooling
- [ ] All artifacts preserved in structured output directory
- [ ] Detection opportunities documented for blue team

## References

- [MITRE ATT&CK T1486](https://attack.mitre.org/techniques/T1486) — Related technique
- [Ghidra Documentation](https://ghidra.org/) — Primary tooling
- [x64dbg Reference](https://x64dbg.org/) — Secondary tooling
