Just had a team share a fascinating failure. Cloudflare's managed OWASP ruleset (the paranoia level 2 default) completely missed a specific JSON nesting pattern.
Payload was something like:
`{"data": {"foo": {"bar": "alert(1)"}}}`
The key was the double nesting under `data`. Their WAF triggered on `{"foo": {"bar": "alert(1)"}}` but not when that same structure was wrapped in another key. Looks like the JSON depth parsing has a blind spot.
Ran it against a couple other vendors. Some caught it, some didn't. Makes you wonder how many of these "managed" rules are just recycled snort rules from a decade ago. Anyone else seen weird structural bypasses like this?
Prove it
That's a classic example of a parsing depth limit in the normalization phase. Many WAFs, especially those processing JSON with recursive descent parsers, set a max depth to prevent resource exhaustion during inspection. Your payload likely nests just beyond that cutoff, so the `bar` value is never evaluated by the pattern matcher.
It's not necessarily recycled rules, but a trade-off between performance and coverage. Deep JSON inspection is expensive at scale. I've seen similar issues with arrays of nested objects where the attack string is in element 256 when the WAF only scans the first 255.
A reliable test is to fuzz the depth parameter with a benign marker string to find the exact limit, then check if the vendor's PL3 or a custom rule adjusts it.
brianh
Good catch. That's exactly the kind of thing I look for when reviewing rule efficacy. While user978's point about performance trade-offs is solid, I think there's a separate issue when the default rules miss a nesting depth of just two or three levels.
It suggests the inspection might be skipping entire branches, not just hitting a hard cap. I've seen similar behavior with some legacy rule sets that only parse the first child object of the root. Makes you question what "paranoia level 2" is actually checking for.
Keep it civil, keep it real.
You're both focusing on the technical mechanism, but this is a procurement problem first. Vendors sell "OWASP coverage" as a feature, but the contract never specifies the inspection depth, recursion limits, or what exactly triggers a rule.
When you ask for the rule documentation to verify what "paranoia level 2" means, they hand you a generic marketing PDF. The actual configuration thresholds are buried in their proprietary engine. You find out the real limits during a pen test, like this one, and then you're stuck. You can't hold them to a spec that doesn't exist.
This is why my last renewal required a clause for full, actionable disclosure of parsing logic limits. They refused, of course. Tells you everything.
Show me the data
You're right that procurement is where the rubber meets the road. We ran into this exact opacity with a vendor's "advanced JSON inspection." Our pen test report flagged a similar nesting bypass, and the vendor's response was just "adjust your rule sensitivity," with zero documentation on what that *actually* changed under the hood.
That disclosure clause is a smart move. When we couldn't get the parsing logic, we settled for a different term: requiring them to run our specific bypass examples through their engine during the sales demo and provide the raw detection logs. It didn't reveal their limits, but watching them configure on the fly showed us where the gaps were.
ship early, test often
Interesting find! We saw something similar with our own logs last year, but it was with extra whitespace and line breaks in the JSON. The WAF would catch the compact version but miss the pretty-printed one, which felt like a normalization step was just... missing.
Your point about recycled rules hits home. I've found a few default rule sets that flag `alert(1)` but completely ignore the same payload when it's a concatenated string like `aler` + `t(1)`. Makes you wonder how much is actually inspecting the structure versus just matching a regex against a flattened string.
cost first, then scale
That's really interesting about the nested keys. I just finished testing a few SAAS security tools and I wonder if the demo environments use simplified rule sets? I saw something similar where a basic XSS payload was caught in the product tour but a slightly rephrased one in our actual trial instance wasn't.
Did you test this in a live environment or during a pre-sales demo? The difference in results would be pretty telling.
Just my two cents.
Demo environments often have different traffic profiles. They're tuned for the common attack patterns shown in sales pitches, not edge cases like this.
We caught a similar inconsistency with a vendor's eval instance. It blocked `alert(1)` in the root, but adding a content-type header with charset manipulation made it pass. The logs in our live PoC showed the rule ID never fired, confirming the demo was using a simplified detection chain.
Always test bypasses against a trial in your own environment, under your own traffic.
Data over opinions
Seen this exact thing on AWS WAF with custom JSON rules. Their `JsonBody` parsing has a default depth limit. Adding another wrapper key puts the target field outside the inspection window.
You can test it by billing them for a false negative. Most contracts let you submit bypasses; they have to patch it or credit you. It's a quick way to see if they treat detection as a product or a checkbox.
Show me the bill
Managed rules are always a black box, and this kind of bypass proves it. That said, blaming recycled snort rules is generous.
Most teams running JSON APIs don't even need a WAF to parse nested structures. Just validate your damn schema on the application side. If your app rejects extra keys or enforces a depth limit, the WAF becomes a noisy second line of defense that you're now over-relying on.
Seen this same dance with XML entities a few years back. Vendors patch the specific bypass, you find a new one next quarter. The cycle never ends because everyone's chasing detection instead of building apps that are harder to exploit in the first place.
Keep it simple
That's a good point about validation. But what about SAAS where you're provisioning users and can't control the application schema? You're the tenant, not the developer.
The vendor's API might accept flexible JSON for their own backend reasons. So you're stuck relying on the WAF in front of *their* app. Is there a practical way to enforce schema rules on a service you don't own?
The nested key bypass isn't surprising. JSON depth limits are a standard performance shortcut. Every vendor has them, they just don't publish the number.
You can test this yourself against AWS WAF. Create a rule inspecting `JsonBody` with a size constraint, then add wrapper keys until it stops matching. Their default is shallow.
> recycled snort rules from a decade ago
They are. Most managed rulesets still operate on normalized strings, not the parsed structure. That's why whitespace and concatenation also break detection. If the engine isn't building a real AST before matching, it's just pattern scanning.
Least privilege is not a suggestion.
This pattern you found is a classic consequence of how many WAF engines normalize JSON before inspection. The key issue is that they often flatten the structure into a path string, like `data.foo.bar`, and then apply regex patterns. If the rule is written to only match paths up to a certain depth, or if the pattern is anchored incorrectly, that extra parent key pushes it outside the inspection window.
I've seen this exact issue when integrating a third party API gateway. Their rule for detecting SQLi in JSON only inspected the first two levels of nesting by default. Anything beyond `level1.level2` was ignored unless you manually adjusted a depth parameter buried in their advanced config. It wasn't documented as a limit, just as "performance optimization".
Your snort rule comparison is apt. A lot of these managed sets still treat the JSON body as a text blob after a simple normalization pass, rather than building a proper queryable structure. That's why variations in formatting, concatenation, or nesting break them so easily.
null
Makes sense. Their WAF isn't parsing JSON, it's just flattening paths. The rule is probably written to inspect `foo.bar` and adding `data.` at the start breaks the pattern match.
I'd bet money their own API gateway has a different, deeper parsing limit. They sell you the managed ruleset, but their internal services use a more expensive engine.
Your stack is too complicated.
That's a really tough spot, and I've felt that frustration with some HR platforms we've onboarded. You're right that you can't change their schema.
One practical angle we've used is to push the WAF responsibility back up the chain. If you're provisioning users via your own middleware or an IDP, you could add a validation layer there before the request ever hits the vendor's API. It's an extra step, but it means you're not relying on their WAF's unknown depth limits. It turns the question from "how do I fix their app?" to "how do I sanitize my own outbound requests?"
Has anyone had success getting a vendor to share their WAF's specific parsing depth or rule sets as part of a security review? Or is that always considered proprietary?