re-swift

Reverse engineer Swift binaries by decoding mangled symbols, witness tables, closures, and reflection metadata.

64|9|Updated Aug 17, 2026
One-click install
npx skills add https://github.com/dslsdzc/rev-skills --skill re-swift-dslsdzc
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: re-swift
Source: https://github.com/dslsdzc/rev-skills/tree/main/.claude/skills/re-swift
Command: npx skills add https://github.com/dslsdzc/rev-skills --skill re-swift-dslsdzc

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Swift binaries strip readable names behind mangled symbols and hide type structure in reflection metadata, making reverse engineering far harder than plain C/C++ analysis. This Skill provides a complete workflow to recover symbols, protocol conformances, closure captures, and type layouts from Swift Mach-O and ELF binaries. ## Core Features & Use Cases - Mangling Decoding: Batch-decode $s, $S, and _T0 symbols with swift-demangle and feed results back into Ghidra or IDA for readable function names. - Witness Table & Closure Recovery: Reconstruct protocol conformance dispatch tables from __swift5_proto records and recover closure capture layouts from swift_allocObject call sites. - Reflection Metadata Analysis: Rebuild struct and class layouts from __swift5_fieldmd and __swift5_typeref sections even on stripped binaries. - Use Case: Given a stripped iOS app binary with no symbol names, locate the __swift5_* sections, rebuild the type and protocol relationship graph, then demangle remaining symbols to restore a navigable pseudocode view in Ghidra. ## Quick Start Analyze this Swift binary by identifying its mangled symbols, decoding them with swift-demangle, and reconstructing its protocol witness tables and type layout from the swift5 reflection sections.

Frequently Asked Questions about re-swift

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I demangle Swift symbols in a binary?▼

Extract symbols with llvm-nm or readelf -s, filter names starting with $s, and pipe them into swift-demangle. On macOS use xcrun swift-demangle; batch output can be scripted back into Ghidra or IDA to rename functions.

How do I identify a Swift binary versus Objective-C?▼

Check for $s, $S, or _T0 mangled symbol prefixes, swift_ runtime imports like swift_retain, and __swift5_* reflection sections. Pure Objective-C binaries lack all of these and should be analyzed through the ObjC path instead.

Can I reverse engineer a stripped Swift binary?▼

Yes. Stripping removes the symbol table but not the __swift5_* reflection sections, which are data segments. Protocol conformances, field metadata, and type descriptors can be rebuilt from __swift5_proto, __swift5_fieldmd, and __swift5_typeref.

Why does swift-demangle fail on some symbols?▼

Mangling schemes evolved across Swift versions ($s for 5+, $S for 4.2, _T0 for 4.0). A demangle tool older than the binary's compiler version cannot decode newer symbols, so use a toolchain from the same or a newer Swift release.

Why does strings miss some Swift mangled names?▼

Mangled names can embed symbolic references containing control bytes \x01-\x1f followed by pointer bytes, so they are not clean null-terminated strings. Always extract symbols from the symbol table with llvm-nm or readelf -s instead of strings.

How do I recover protocol witness tables in Swift binaries?▼

Locate conformance records in the __swift5_proto section or find swift_getWitnessTable call sites. The witness table is an array of implementation addresses whose slot order matches the protocol declaration order.