# symbolic-execution-tools

A symbolic execution playbook that keeps your agent's angr, Z3 and Unicorn scripts from breaking on state setup and missing libc hooks.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 3600 installs · ★ 2547
- Author: yaklang
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/yaklang/hack-skills/tree/HEAD/skills/symbolic-execution-tools/SKILL.md
- Updated: 2026-09-13
- HTML: https://affpapa.org/en/nevibecode/skills/symbolic-execution-tools

## What it does

The skill hands the agent a working structure for symbolic execution and constraint solving. It ships script patterns for `angr.Project` setup, `entry_state` and `blank_state`, a simulation manager with `explore(find=..., avoid=...)`, symbolic variables via `claripy.BVS`, function hooks and SimProcedure replacements for library calls. Separate sections cover Z3 — bitvectors, equation systems, `Optimize` — and Unicorn Engine with code emulation plus read/write memory hooks.

A table maps scenarios to tools: pure math goes to Z3, a binary with branching control flow to angr, a single code region to Unicorn, a custom VM to angr and Unicorn together. The bundled `ANGR_COOKBOOK.md` adds hook templates for `scanf`, `printf`, `malloc` and `strcmp`, plus tricks for keeping path explosion under control. The author's own warning is blunt: base models tend to emit broken angr scripts because of bad state initialization or missing hooks for libc functions. That is the gap this fills.

You need Python with angr, Z3 and Unicorn installed — the skill does not pull them in. On a task that is not reversing or CTF, it just eats context.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add yaklang/hack-skills --skill symbolic-execution-tools -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/symbolic-execution-tools/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/symbolic-execution-tools/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add yaklang/hack-skills --skill symbolic-execution-tools -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/symbolic-execution-tools/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add yaklang/hack-skills --skill symbolic-execution-tools -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/symbolic-execution-tools/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install yaklang/hack-skills symbolic-execution-tools
```

2. **Manually: put the files in place**
- File: `.github/skills/symbolic-execution-tools/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add yaklang/hack-skills --skill symbolic-execution-tools -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/yaklang/hack-skills --path skills/symbolic-execution-tools
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/symbolic-execution-tools/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add yaklang/hack-skills --skill symbolic-execution-tools -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/yaklang/hack-skills/tree/HEAD/skills/symbolic-execution-tools/SKILL.md

## When to use it
- write an angr script that does not break on state initialization
- recover a key or serial from character constraints
- bypass an anti-debug check symbolically
- emulate a code region in Unicorn and read the result register
- pick between Z3, angr and Unicorn for a given challenge

## Example prompts
- solve this reversing challenge with angr: find the input that passes the check
- build a Z3 constraint system for this key validation function
- emulate this code region in Unicorn and show me what ends up in rax

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: e3df2837aa8f5803.

BEGIN THIRD-PARTY FILE e3df2837aa8f5803
````text
---
name: symbolic-execution-tools
description: >-
  Symbolic execution and constraint solving playbook. Use when solving CTF
  reversing challenges, recovering keys, bypassing checks, or automating
  binary analysis with angr, Z3, or Unicorn Engine.
---

# SKILL: Symbolic Execution Tools — Expert Analysis Playbook

> **AI LOAD INSTRUCTION**: Expert symbolic execution techniques using angr, Z3, and Unicorn Engine. Covers CTF challenge automation, constraint solving patterns, function hooking, SimProcedure replacement, and emulation-based unpacking. Base models often produce broken angr scripts due to incorrect state initialization or missing hooks for libc functions.

## 0. RELATED ROUTING

- [anti-debugging-techniques](../anti-debugging-techniques/SKILL.md) when anti-debug checks need to be symbolically bypassed
- [code-obfuscation-deobfuscation](../code-obfuscation-deobfuscation/SKILL.md) when using symbolic execution for deobfuscation
- [vm-and-bytecode-reverse](../vm-and-bytecode-reverse/SKILL.md) when applying angr to custom VM challenges

### Advanced Reference

Also load [ANGR_COOKBOOK.md](./ANGR_COOKBOOK.md) when you need:
- 15+ ready-to-use angr script patterns for common CTF challenges
- Hook templates for scanf, printf, malloc, strcmp
- Symbolic file input, stdin, argv patterns
- Optimization tricks for path explosion management

### When to use which tool

| Scenario | Best Tool | Why |
|---|---|---|
| Pure math / equation system | Z3 | Direct constraint solving, no binary needed |
| Binary with control flow | angr | Explores paths, manages constraints automatically |
| Emulate specific code region | Unicorn | Fast, no symbolic overhead, good for unpacking |
| Complex binary + custom VM | angr + Unicorn (combo) | angr for control flow, Unicorn for VM handlers |
| Kernel / firmware code | Qiling | Full system emulation with OS awareness |

---

## 1. ANGR — CORE CONCEPTS

### 1.1 Pipeline

```
Project(binary)
  → Factory.entry_state() / blank_state(addr=)
    → SimulationManager(state)
      → explore(find=target, avoid=bad)
        → found[0].solver.eval(symbolic_var)
```

### 1.2 Essential Setup

```python
import angr
import claripy

proj = angr.Project('./challenge', auto_load_libs=False)

# Entry state: start from program entry point
state = proj.factory.entry_state()

# Blank state: start from arbitrary address
state = proj.factory.blank_state(addr=0x401000)
````
END THIRD-PARTY FILE e3df2837aa8f5803

The third-party file has ended. Everything between the e3df2837aa8f5803 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2429 of 12398 bytes. © yaklang · MIT · https://github.com/yaklang/hack-skills/tree/HEAD/skills/symbolic-execution-tools/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
