/security-agent-skills:hunting-dotnet-deserialization-type-injectionfrom security-agent-skills
Hunts .NET deserialization where untrusted input reaches a type-resolving formatter (BinaryFormatter, SoapFormatter, NetDataContractSerializer, LosFormatter, ObjectStateFormatter, or JSON with type-name handling). Use when a service reads serialized .NET objects it did not produce.
Ships in security-agent-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
.NET deserialization is dangerous for a specific reason: several formatters read the concrete type to
instantiate from the serialized data, not from the declared target. When BinaryFormatter,
SoapFormatter, NetDataContractSerializer, the ViewState formatters, or a JSON serializer with
type-name handling turned on processes attacker data, the attacker chooses which class gets constructed.
That lets them instantiate a gadget type whose property setters, deserialization callbacks, or type
converters perform a side effect, chaining to a process start, a command, or a file operation. The fix is
almost always to stop resolving types from the data. You find these by locating every formatter that
honors an embedded or annotated type and asking whether untrusted bytes reach it.
Test deserialization only against services you own or are authorized to assess, on non-production infrastructure. A confirming payload constructs an attacker-chosen type and can run code, so treat every proof as a live intrusion inside the authorized scope. If you can't name the authorization, stop.
Establish the type-resolving sinks first. Inventory every formatter that reads the type from the
data: BinaryFormatter, SoapFormatter, NetDataContractSerializer, LosFormatter and
ObjectStateFormatter behind ViewState, and any JSON or XML serializer configured with type-name
handling or a permissive binder. This is the false-positive killer: a formatter that deserializes to a
fixed known type with no type resolution is not injectable. Name the resolving sinks first.
Trace untrusted bytes into each sink. Follow request bodies, ViewState fields, cookies, headers, queue messages, and cache values into the formatter. ViewState is a common source when the machine key is weak or absent, letting an attacker forge a signed payload. Confirm the bytes reaching the formatter are attacker-influenced.
Confirm the formatter honors an attacker type. For binary and SOAP formatters this is inherent; for JSON and XML it depends on the type-name-handling setting and the binder. A serializer restricted to a known type or guarded by a strict binder that rejects unexpected types does not let the attacker pick the class. Read the exact configuration, not the default.
Locate a reachable gadget type. A usable gadget is a type on the loaded assemblies whose
construction path, a property setter, an OnDeserialized callback, a type converter, or a
System.Object returned into a dangerous API, performs a side effect the attacker steers. Match the
present assemblies against known chains rather than assuming any type resolution is exploitable.
Check the defenses that actually stop it. Replacing the formatter with one that deserializes to a fixed contract, disabling type-name handling, enforcing a strict allowlist binder, and setting a strong machine key for ViewState each remove the vector. A post-deserialization type check does not, because construction already ran. Determine which of these stands at the sink.
Confirm and record. Confirm by supplying a benign in-scope payload that constructs a marker type or triggers an out-of-band callback, proving the formatter honors the attacker's type, without a destructive gadget. Kill the lead if no untrusted data reaches a type-resolving formatter, if type resolution is disabled or bound to an allowlist, or if ViewState is integrity-protected and no reachable gadget exists. Record the source, the formatter, the type-resolution setting, and the chain.
LosFormatter/ObjectStateFormatter payload that deserializes on postback.Confirm. A legacy endpoint accepts a serialized object in a hidden field and deserializes it with
BinaryFormatter. The machine key is derivable, so an attacker forges a valid payload. A crafted object names a gadget type whose set accessor starts a process, and a benign marker payload confirms the type is constructed. Confirmed untrusted deserialization to remote code execution,critical, remediation = removeBinaryFormatter, deserialize to a fixed data contract with a data-only serializer, and rotate to a strong machine key so ViewState cannot be forged.Kill. The service deserializes only with a JSON serializer whose type-name handling is off and whose binder rejects any type outside a three-type allowlist, and ViewState uses a strong machine key with integrity protection. A crafted payload naming any gadget type is refused before construction. Killed,
kill_reason= "no type-resolving formatter on untrusted data; JSON binder allowlists three data types and ViewState is integrity-protected, so no attacker type is constructed."
You need every formatter on untrusted input, its type-resolution setting or binder, the untrusted sources that reach it, the ViewState machine-key posture, and the reachable gadget types on the loaded assemblies. For each sink, ask whether attacker bytes arrive, whether the formatter honors an attacker type, and whether a reachable gadget exists. Reading the formatter configuration shows the intent; a benign marker payload shows whether the attacker's type is actually constructed.
hunting-java-deserialization-gadget-chains - the JVM sibling, where the stream rather than a type name
drives reconstruction of a gadget.hunting-php-object-injection-pop-chains - the PHP sibling, triggered by magic methods on reconstruction.adjudicating-dependency-cve-reachability - use it to prove a gadget-bearing assembly is loaded at a
vulnerable version, not merely referenced.adjudicating-taint-paths - use it to confirm untrusted bytes reach the formatter through ViewState and
framework indirection.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub unboundcompute/security-agent-skills --plugin security-agent-skills194 skills in this plugin
/adjudicating-dependency-cve-reachabilityDecide whether a CVE in a dependency actually exposes your application before you scramble to patch: is the vulnerable function on a real call path from your code, do the trigger preconditions hold, and can an attacker control the input that reaches it. Use when an advisory, SCA scan, or dependency bot flags a CVE and you must separate a genuine exposure from unreachable noise, or justify why you are or are not affected. Covers pinning the vulnerable symbol, call-path reachability, precondition checks, and taint from your entry points./adjudicating-taint-pathsDecide whether a whitebox lead is a real bug by tracing taint from an untrusted source to a dangerous sink and confirming every hop against live source. Use after a scanner, a candidate list, or your own reading surfaces a "this looks dangerous" sink (SQL exec, system/exec, file open, deserialize, template render, redirect target, memcpy) and you must decide whether attacker- controlled input actually reaches it - or kill the lead with evidence. Covers forward and reverse taint, witness paths, sanitizer analysis, and the evidence rules that separate a finding from a false positive.Other plugins' skills for the same job