yaklang avatar

Type Juggling

Teaches Claude to exploit PHP's loose comparison operators and type coercion rules, the kind of stuff that shows up in legacy codebases and CTF challenges. When you hit authentication or token validation that uses `==` instead of `===`, this walks through magic hash collisions (like `md5('240610708') == md5('QNKCDZO')` both evaluating to 0e scientific notation), HMAC bypass via numeric coercion, and classic tricks like passing arrays to `strcmp`. Includes version-specific behavior across PHP 5, 7, and 8, since `0 == "foo"` changed semantics. The routing is sharp: it tells Claude to check for loose equality sinks first, then map to the right payload table. Honestly most useful for security audits and explaining why `hash_equals` exists, but the reference tables alone are worth keeping around.

skills.sh installs
3.8K
GitHub stars
2.6K
last updated
Aug 21, 2026

Install

$ npx -y skills add yaklang/hack-skills --skill type-juggling --agent claude-code

Installs into .claude/skills of the current project.

Files

SKILL: PHP Type Juggling — Weak Comparison & Magic Hash Bypass

AI LOAD INSTRUCTION: PHP == coercion, magic hashes (0e…), HMAC/hash loose checks, NULL from bad types, and CTF-style strcmp / json_decode / intval tricks. Use strict routing: map the sink (== vs hash_equals), PHP major version, and whether both operands are attacker-controlled. Routing note: when you encounter PHP login/signature logic or code like md5($_GET['x'])==md5($_GET['y']), start with this skill; if hash_equals/=== is already used, this path usually does not apply.

0. QUICK START

First-pass goal: prove the server branch treats unequal secrets/tokens as equal via coercion, not guess the real password.

First-pass payloads (auth / token shape)

password[]=x
password=
0
0e12345
240610708
QNKCDZO
true
[]
{"password":true}
admin%00

Minimal PHP probes (local or php -r in lab)

<?php
// Loose compare probes — run in target PHP major version if possible
var_dump('0e123' == '0e999');
var_dump('123a' == 123);
var_dump(md5('240610708') == md5('QNKCDZO'));

Routing hints

Sponsors

Details

Repository
github.com/yaklang/hack-skills
Categories
Backend & APIs, Security, Code Review & Quality, PHP & Laravel
First seen
Jun 3, 2026

More from yaklang/hack-skills

All 102
1cloudflare avatarbuilding-ai-agent-on-cloudflarecloudflare/skillsBuilds AI agents on Cloudflare using the Agents SDK with state management, real-time WebSockets, scheduled tasks, tool integration, and chat capabilities. Gener3.7Kskills.sh installs
2yaklang avatarnosql-injectionyaklang/hack-skillsNoSQL injection playbook. Use when MongoDB-style operators, JSON query objects, flexible search filters, or backend query DSLs may allow data or logic abuse.3.7Kskills.sh installs
3netlify avatarnetlify-deploynetlify/context-and-toolsDeploy, host, and publish web projects on Netlify with the Netlify CLI. Use when the user wants to deploy a site or repository to Netlify, link a local project 3.7Kskills.sh installs
4huggingface avatarhf-clihuggingface/skillsHugging Face Hub CLI (`hf`) for downloading, uploading, and managing models, datasets, spaces, buckets, repos, papers, jobs, and more on the Hugging Face Hub. U3.6Kskills.sh installs
5dotnet avatartemplate-comparisondotnet/skillsCompares two or more dotnet new templates side by side to help users choose between them based on parameters, feature support, frameworks, and classifications. 3.5Kskills.sh installs
6resciencelab avatarredditresciencelab/opc-skillsSearch and retrieve content from Reddit. Get posts, comments, subreddit info, and user profiles via the public JSON API. Use when user mentions Reddit, a subred3.5Kskills.sh installs