Subscribe to the Non-Human & AI Identity Journal
Home FAQ Threats, Abuse & Incident Response What do security teams get wrong about per-chunk…
Threats, Abuse & Incident Response

What do security teams get wrong about per-chunk size checks?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated August 2, 2026 Domain: Threats, Abuse & Incident Response

They assume a maximum read size prevents abuse, but an attacker can still force a stream to decompress far more than any single chunk limit suggests. The control has to measure total expansion across the whole archive, not just the size of each read operation.

Why This Matters for Security Teams

Per-chunk size checks look reassuring because they cap what a single read can return, but they do not measure the total work an input can force the system to do. That distinction matters in archive handling, stream processing, and any pipeline that expands compressed or nested content. Security teams often treat the read boundary as the control boundary, which is where the risk is misplaced.

The better mental model is to assess cumulative expansion, recursion depth, and total output against the original input budget. NIST’s control language in NIST SP 800-53 Rev 5 Security and Privacy Controls is useful here because it pushes teams toward enforcing system constraints, not just input filters. The same lesson appears in NHIMG’s Ultimate Guide to NHIs, where large attack surfaces persist when controls are applied at the wrong layer.

For teams that only inspect chunk size, a crafted payload can still trigger massive decompression, repeated parsing, or deep nesting that exhausts memory, CPU, or disk. In practice, many security teams encounter the abuse only after the service has already consumed resources far beyond the intended limit.

How It Works in Practice

Effective defense starts with measuring the full expansion path, not just each individual read. A secure implementation should track the original archive size, accumulated decompressed bytes, entry counts, nesting depth, and per-entry metadata as the file is processed. If any one of those thresholds is exceeded, processing should stop immediately and the archive should be rejected.

That means the control belongs in the decompression and parsing layer, not in a wrapper that checks incoming buffer sizes. For example, a ZIP, TAR, or nested archive should be evaluated against a policy that considers total extracted output and recursion depth. Where possible, apply explicit limits on file count, file size, and compression ratio, and fail closed when the archive structure is inconsistent or self-referential. Guidance from NIST SP 800-53 Rev 5 Security and Privacy Controls supports this kind of bounded processing, and NHI governance lessons from Ultimate Guide to NHIs reinforce the need to control the whole lifecycle of risky inputs.

  • Track total decompressed bytes across the entire archive.
  • Enforce recursion and nesting depth limits.
  • Cap the number of extracted entries and the compression ratio.
  • Terminate processing on malformed, cyclic, or unexpectedly expanding content.
  • Log the rejection reason so abuse patterns can be detected and tuned.

These controls tend to break down when processing is split across services, because no single component can see the full expansion budget.

Common Variations and Edge Cases

Tighter decompression controls often increase implementation overhead, requiring organisations to balance user convenience against resilience to resource exhaustion. That tradeoff is especially visible in environments that ingest third-party uploads, vendor payloads, or legacy archives where file structure is inconsistent.

There is no universal standard for compression-ratio thresholds yet, so current guidance suggests starting with conservative limits, then tuning based on real traffic and failure analysis. Extremely high ratios are not always malicious, but they should trigger additional scrutiny, not automatic trust. Nested archives, encrypted containers, and streaming parsers can also obscure the true expansion path, so a per-read cap is least reliable in those cases.

Security teams should also be careful not to confuse data validation with resource governance. A file can pass schema checks and still explode into far more content than expected once decompressed. The practical answer is to treat input processing as a resource control problem, not just a format validation problem, and to align rejection logic with the actual expansion behavior rather than the size of each chunk alone.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10 and CSA MAESTRO address the attack and risk surface, while NIST CSF 2.0, NIST AI RMF and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-07Covers abuse of long-lived or poorly bounded non-human inputs and processing.
NIST CSF 2.0PR.PT-3Protective technology should constrain resource use, not just input size.
NIST AI RMFGOVERNRuntime controls and accountability are needed for unsafe input handling decisions.
CSA MAESTROA1Agentic systems must constrain tool and data processing to prevent runaway expansion.
NIST SP 800-53 Rev 5SI-10Input validation alone is insufficient without enforcing processing and resource limits.

Set hard limits on expansion, lifetime, and processing scope before accepting archive-like inputs.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on August 2, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org