type-juggling

Identify PHP loose comparison and magic-hash authentication bypass paths.

5|2|Updated May 16, 2026
One-click install
npx skills add https://github.com/DorianGallo/hack-skills-local --skill type-juggling-doriangallo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: type-juggling
Source: https://github.com/DorianGallo/hack-skills-local/tree/main/skills/type-juggling
Command: npx skills add https://github.com/DorianGallo/hack-skills-local --skill type-juggling-doriangallo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you identify and reason about PHP authentication and signature-check bypasses caused by loose comparison (==) and weak type coercion, including “magic hash” 0e… behavior and related edge cases like NULL coercion and hash/HMAC comparisons to falsy constants.

Core Features & Use Cases

  • PHP weak comparison forensics: Understand how == and != behave across string/number/boolean/null contexts and what changes between PHP 5/7/8.
  • Magic hash (0e…) collision detection: Determine when md5/sha1-style hashes interpreted as scientific-notation zeros can incorrectly compare equal.
  • HMAC/hash bypass patterns: Identify logic that compares loose MAC outputs to constants like "0" or 0 and how attacker-controlled inputs might satisfy those loose checks.
  • Common CTF-style failure modes: Cover NULL juggling from type errors, strcmp/int/array quirks, intval parsing surprises, and json_decode associative-array pitfalls.

Quick Start

Ask the AI to audit a PHP login or signature-check snippet for unsafe loose comparisons by mapping the comparison sink (== vs === vs hash_equals) and then proposing the smallest verification probes for the target PHP major version.

Frequently Asked Questions about type-juggling

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

FAQPage Schema
How does PHP type juggling cause authentication bypasses with loose comparison?

PHP type juggling causes authentication bypasses when loose comparison (==) coerces mismatched operands, allowing attacker-controlled inputs to incorrectly match hashes, tokens, or NULL values during signature checks.

What is a magic hash collision in PHP security auditing?

A magic hash collision occurs when md5 or sha1 outputs starting with '0e' are interpreted as scientific-notation zeros by PHP loose comparison, making different hashes incorrectly evaluate as equal during auth checks.

How do I audit PHP code for loose comparison and HMAC bypass vulnerabilities?

You audit PHP code for loose comparison vulnerabilities by mapping comparison sinks using == or != instead of strict equality, then verifying hash_equals usage and testing magic-hash behavior across target PHP versions.

Do PHP loose comparison security vulnerabilities behave differently across PHP versions?

PHP loose comparison vulnerabilities behave differently across PHP 5, 7, and 8 due to changing type coercion rules, affecting how NULL, boolean, and string-to-number comparisons resolve during authentication checks.

When should I use hash_equals instead of loose comparison for PHP HMAC validation?

You should use hash_equals for PHP HMAC validation whenever comparing attacker-controlled inputs against MAC outputs to prevent type juggling, magic-hash 0e collisions, and NULL coercion bypasses inherent in loose comparison.

Can PHP strcmp or intval functions lead to type juggling bypasses in CTF challenges?

PHP strcmp and intval functions can lead to type juggling bypasses in CTF challenges when array inputs or parsing surprises coerce unexpected return values that loosely compare equal to falsy constants.