# Deserialization denylist bypass to code execution

Unsafe deserialization guarded only by a regex or denylist of known-bad classes, modules or keywords

_Area: Web injection and code execution. Seen in 2 disclosed reports; latest 2026-08-04. Updated 2026-11-09._

## How it works
A deserializer (pickle, YAML, a custom protocol) is treated as safe because a filter blocks known-dangerous names. The assumption that breaks: a denylist only covers what its author thought of. Any reachable sink not on the list — a library function that itself deserializes, a constructor reachable through a reference, or a name the filter silently drops — still runs attacker-controlled code. The filter checks the wrong thing (spelling of a name) instead of the real invariant (no attacker data reaches a code-executing sink).

## Where it shows up
- Regex or keyword denylists in front of `pickle.loads`, `yaml.load`, `unserialize`, or a custom chunk parser [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-x6vm-w76m-8j7g.md).
- A sandbox that pre-imports powerful libraries (pandas, os, subprocess) and only blocks their obvious entry points [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-x6vm-w76m-8j7g.md).
- Deserializers that resolve `$`-prefixed or reference tokens to constructors/prototypes, where attacker objects can impersonate internal types [E1](https://bugbountylibrary.com/r/blog%3Awiz-io-blog-nextjs-cve-2025-55182-react2shell-deep-dive.md).
- Security scanners whose unsafe-list is not matched by the code paths that actually emit analysis nodes [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-h4rm-mm56-xf63.md).
- Any early-return or special-case branch (e.g. builtins handling) that skips a check [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-h4rm-mm56-xf63.md).

## How to review
State the invariant: no attacker-controlled bytes may reach a callable that executes code or imports modules. Then:
- Enumerate every sink reachable from the input, including library APIs the denylist does not name (`read_pickle`, eval-like loaders) [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-x6vm-w76m-8j7g.md).
- For reference-resolving deserializers, confirm attacker objects cannot be substituted for internal types (Response/Chunk) [E1](https://bugbountylibrary.com/r/blog%3Awiz-io-blog-nextjs-cve-2025-55182-react2shell-deep-dive.md).
- For a scanner, diff its unsafe-list against every branch that emits or skips nodes; a skip branch is a blind spot [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-h4rm-mm56-xf63.md).
- Prefer allowlists and type checks over name matching.

## How finders spotted it
- Read the Flight chunk deserializer, noticed missing type checks let attacker objects stand in for internal Response/Chunk types, then built a self-referencing chain resolving to `Function()` [E1](https://bugbountylibrary.com/r/blog%3Awiz-io-blog-nextjs-cve-2025-55182-react2shell-deep-dive.md).
- Saw `customReadCSVFunc` run as Python guarded only by a regex denylist, reasoned pandas itself offers dangerous primitives, and found `read_pickle()` reachable with no forbidden keyword [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-x6vm-w76m-8j7g.md).
- Read the bytecode-to-AST translation, noticed builtins imports are dropped while still listed as unsafe, then built a raw opcode pickle to confirm the analyzer omits builtins [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-h4rm-mm56-xf63.md).

## Variants seen
- Custom protocol reference resolution to a constructor [E1](https://bugbountylibrary.com/r/blog%3Awiz-io-blog-nextjs-cve-2025-55182-react2shell-deep-dive.md).
- Library deserialization sink inside a keyword-filtered sandbox [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-x6vm-w76m-8j7g.md).
- Analyzer blind spot from a skipped AST node [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-h4rm-mm56-xf63.md).

## Impact and severity
E1 gave unauthenticated RCE from one HTTP request, exploited in the wild for miners and backdoors, then pivoted to cloud metadata credential theft and container escape [E1](https://bugbountylibrary.com/r/blog%3Awiz-io-blog-nextjs-cve-2025-55182-react2shell-deep-dive.md). E2 gave OS command execution via a crafted pickle [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-x6vm-w76m-8j7g.md). E3 let a malicious pickle be classified LIKELY_SAFE, defeating the tool meant to catch it [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-h4rm-mm56-xf63.md). Severity rises with reach (unauthenticated, network-facing) and with what the process can reach afterward (credentials, host) [E1](https://bugbountylibrary.com/r/blog%3Awiz-io-blog-nextjs-cve-2025-55182-react2shell-deep-dive.md).

## Seen in real software
Open-source packages and projects, and products, where this pattern was found. If the target runs one, compare the version it runs with the fix.
- **flowise-components (npm)** <= 3.1.2, fixed in 3.1.3: Flowise: Remote Code Execution Vulnerability in CSVAgent (CVE-2026-69256). Report: https://bugbountylibrary.com/r/ghsa%3AGHSA-x6vm-w76m-8j7g.md. Fix: https://github.com/FlowiseAI/Flowise/commit/c79fe56a6c249850e96bce9b4859f7a0083e4507
- **React** (React Server Components / React Flight deserialization) (version not stated): React2Shell: Technical Deep-Dive & In-the-Wild Exploitation of CVE-2025-55182 (CVE-2025-55182). Report: https://bugbountylibrary.com/r/blog%3Awiz-io-blog-nextjs-cve-2025-55182-react2shell-deep-dive.md

## Evidence
- E1: https://bugbountylibrary.com/r/blog%3Awiz-io-blog-nextjs-cve-2025-55182-react2shell-deep-dive.md
- E2: https://bugbountylibrary.com/r/ghsa%3AGHSA-x6vm-w76m-8j7g.md
- E3: https://bugbountylibrary.com/r/ghsa%3AGHSA-h4rm-mm56-xf63.md
