Skip to content
Back to skills

Detecting Type Confusion

ASecurity

Detects type confusion vulnerabilities by identifying unsafe type casts, vtable corruption, and polymorphism issues. Use when analyzing object-oriented code, type casting, or investigating C++ memory safety issues.

  • 666 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added February 8, 2026
businessc++

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill detecting-type-confusion --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Detecting Type Confusion?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Detecting Type Confusion
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-detecting-type-confusion/badge)](https://www.skillsdirectory.com/skills/majiayu000-detecting-type-confusion)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: detecting-type-confusion
description: Detects type confusion vulnerabilities by identifying unsafe type casts, vtable corruption, and polymorphism issues. Use when analyzing object-oriented code, type casting, or investigating C++ memory safety issues.
---

# Type Confusion Detection

## Detection Workflow

1. **Identify type operations**: Find all type casts, virtual function calls, union usage, class hierarchies
2. **Analyze type safety**: Check cast validation, assess vtable integrity, verify union usage correctness
3. **Trace object flow**: Use `xrefs_to` to trace objects, identify type changes, assess type consistency
4. **Assess exploitability**: Can attacker control object type? Is there useful type confusion? Can attacker corrupt vtable?

## Key Patterns

- Unsafe type casting: C-style casts without validation, reinterpret_cast without checks
- Vtable corruption: virtual function calls on corrupted objects, vtable pointer manipulation
- Union misuse: writing to one union member, reading another
- Polymorphism issues: base pointer used as derived without dynamic_cast

## Output Format

Report with: id, type, subtype, severity, confidence, location, vulnerability, cast operation, base type, derived type, validation, vtable access, exploitability, attack scenario, impact, mitigation.

## Severity Guidelines

- **CRITICAL**: Type confusion with code execution
- **HIGH**: Type confusion with data corruption
- **MEDIUM**: Type confusion with limited impact
- **LOW**: Type confusion with minor issues

## See Also

- `patterns.md` - Detailed detection patterns and exploitation scenarios
- `examples.md` - Example analysis cases and code samples
- `references.md` - CWE references and mitigation strategies

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.