agentleFS
awarexoneawarexone/AXguard/deserialization-security/SKILL.md

deserialization-security

Skill17 starsChanged 47 days agoMITView on GitHub

Analyze unsafe deserialization and object-decode sinks — use when reviewing pickle, YAML load, Java ObjectInputStream, PHP unserialize, or untrusted serialized blobs (CWE-502 / A08:2021).

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    After AXguard hits injection.*pickle*, *unserialize*, *objectinput*.

    line 41
  2. Distinctive:

    Check for cryptographic integrity (HMAC/signature) and whether verification precedes deserialize.

    line 64
  3. Distinctive:

    Prefer replacing the format over “hardening” unsafe loaders when possible.

    line 66
  4. Distinctive:

    Prefer JSON (or similar) with schema validation.

    line 84
  5. Very specific:

    Never pickle/unserialize untrusted data.

    line 85
  6. Distinctive:

    Remove unused gadget-heavy libraries from classpath.

    line 88

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Deserialization Security

Purpose

Encode practitioner analysis of insecure deserialization: untrusted data is decoded into objects/code paths that invoke unexpected constructors, magic methods, or gadgets, often causing RCE or auth bypass.

When to Use / When Not to Use

Use when:

  • pickle.loads, yaml.load (unsafe), ObjectInputStream, unserialize(, BinaryFormatter, Marshal.load, JavaScript node-serialize-class patterns, Redis/cache storing pickled objects, signed-but-not-encrypted cookies of serialized state.
  • After AXguard hits injection.*pickle*, *unserialize*, *objectinput*.

Do not use when:

  • Data is pure JSON/structured text parsed into primitive DTOs with schema validation and no polymorphic type attacker control.
  • Serialization is only outbound (encoding) with no decode of untrusted input.

Security Concepts

Many serializers can reconstruct arbitrary types. Integrity of the blob (HMAC) helps only if the key is secret and verification happens before deserialize. Prefer data-only formats (JSON) + explicit schema.

Threat Model

Attacker goals:

  1. Remote code execution via gadget chains.
  2. Forge session/auth objects.
  3. DoS via deeply nested / expensive object graphs.

Analysis Workflow

  1. Inventory decode sinks and libraries/versions.
  2. Trace whether the blob is attacker-reachable (HTTP body, cookie, queue, file upload, cache key value).
  3. Check for cryptographic integrity (HMAC/signature) and whether verification precedes deserialize.
  4. Determine allowed types / allowlists (yaml.safe_load, Java allowlists, PHP allowed_classes).
  5. Prefer replacing the format over “hardening” unsafe loaders when possible.
  6. Assess impact based on process privileges and available gadgets in classpath/deps.

Evidence Requirements

  • Decode sink location
  • Untrusted source of serialized bytes
  • Missing integrity check or unsafe loader API
  • Impact hypothesis (RCE / auth forge / DoS)

False Positive Controls

  • yaml.safe_load / JSON-only parsers
  • Deserialize only of trusted operator-controlled backups offline
  • Integrity-protected blobs with server-side keys and no attacker key access (residual risk if types still dangerous — note)

Remediation

  1. Prefer JSON (or similar) with schema validation.
  2. Never pickle/unserialize untrusted data; use safe loaders and type allowlists if unavoidable.
  3. Authenticate then decrypt/verify before decode; rotate keys.
  4. Isolate deserializers in hardened workers; keep deps patched.
  5. Remove unused gadget-heavy libraries from classpath.

Verification

Find unsafe loaders → Replace with safe format/API → Re-run axguard → Confirm no untrusted deserialize path

Related Skills

  • command-injection, ssti-analysis — alternate RCE
  • api-security — untrusted message bodies
  • security-triage, security-remediation

Framework Mapping

  • CWE-502
  • OWASP Top 10 2021 A08:2021 Software and Data Integrity Failures

References

Research Provenance

Primary sources:

  • OWASP Top 10:2021 A08; CWE-502 (accessed 2026-09-15)

Secondary / internal:

  • AXGuard rules/injection.json, rules/advanced.json (unserialize/ObjectInput patterns)
  • AwareXone Agentic-Bug-Hunter deserialization methodology (concepts only; not copied)

Datasets:

  • UVID HF dataset — category linkage concepts only (MIT license metadata review 2026-09-15)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.