<!-- 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-smart-contracts
description: >-
  Decompile and analyze EVM smart contracts to identify vulnerabilities, backdoors, and malicious logic.
domain: cybersecurity
subdomain: reverse-engineering
tags:
  - smart-contracts
  - evm
  - solidity
  - decompilation
  - blockchain
version: "1.0"
author: defconxt
license: AGPL-3.0
metadata:
  mitre-attack: ["T1195"]
  cwe: ["CWE-693"]
  tools: ["mythril", "slither", "ghidra-evm", "etherscan"]
---

# Reverse Engineering Smart Contracts

## Overview

Decompile and analyze EVM smart contracts to identify vulnerabilities, backdoors, and malicious logic.

## Prerequisites

| Tool / Requirement | Details |
|---|---|
| `mythril` | Security tooling |
| `slither` | Security tooling |
| `ghidra-evm` | Security tooling |
| `etherscan` | 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
# Initialize working environment
mkdir -p /tmp/reverse-engineering-smart-contracts/{output,logs,artifacts}

# Execute primary analysis with mythril
echo "[*] Running Reverse Engineering Smart Contracts with mythril..."

# Validate results with slither
echo "[*] Cross-validating with slither..."

# Generate summary report
cat /tmp/reverse-engineering-smart-contracts/output/report.json
```

## Workflow

### Step 1: Preparation and Reconnaissance

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

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

### Step 2: Primary Analysis

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

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

### Step 3: Deep Investigation

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

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

### Step 4: Documentation and Reporting

```bash
# Generate structured findings report
cat <<'EOF' > /tmp/reverse-engineering-smart-contracts/output/report.json
{
  "technique": "reverse-engineering-smart-contracts",
  "domain": "reverse-engineering",
  "tools_used": ["mythril", "slither"],
  "findings": [],
  "recommendations": []
}
EOF
```

## Detection

```yaml
title: Reverse Engineering Smart Contracts Detection
id: d4dcdf90-95aa-4d59-a6e0-474295339b0c
status: experimental
description: Detects suspicious activity related to reverse engineering smart contracts techniques in reverse engineering context
logsource:
  category: process_creation
  product: windows
detection:
  selection:
    CommandLine: "*reverse*engineering*"
  condition: selection
level: medium
tags:
  - attack.t1195
  - attack.defense_evasion
falsepositives:
  - Malware analysis sandbox performing automated binary inspection
```


**Detection Opportunities**

| Indicator | Source | Detection Logic |
|---|---|---|
| Reverse Engineering Smart Contracts Detection | windows/process_creation | Sigma rule (medium) |
| ATT&CK Coverage | MITRE ATT&CK | T1195 |

## 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 T1195](https://attack.mitre.org/techniques/T1195) — Related technique
- [mythril Documentation](https://mythril.org/) — Primary tooling
- [slither Reference](https://slither.org/) — Secondary tooling
