Sobelow.DOS.Zip (Sobelow v0.19.0)
View SourceResource exhaustion through ZIP extraction
:zip.unzip/1,2, :zip.extract/1,2 and :zip.zip_get/1,2 can expand
untrusted archives without a limit on actual output bytes. A single entry
can exhaust memory, disk space or CPU; nested archives are not required.
The :memory, :file_list and :file_filter options do not establish an
expanded-byte limit. ZIP-declared sizes can be forged.
Enforce per-entry and cumulative actual-output limits during bounded decompression, before allocating or writing the entire output. Also bound entry count, compressed input and execution resources. A size check after extraction is too late. A bounded preflight must inspect the same immutable archive data and byte ranges that subsequent extraction will consume.
This check reports dynamic archive inputs and handles. Controller parameters
influencing archive input receive medium confidence; other inputs and handles
receive low confidence. Fully literal inputs are omitted, but a fixed filename
can still contain untrusted data. Archive provenance and custom preflight
validators are not verified. Inline :zip.foldl/3 callbacks are reported only
when they directly invoke the third (entry-content) accessor before rebinding
it. Findings point at the enclosing foldl call and use its archive input.
Metadata-only callbacks, delegated/guarded callbacks, accessor aliases and
invocations in nested scopes or branching constructs are not tracked. Archive
creation is omitted. Audit bounded wrappers before skipping them.
https://www.erlang.org/doc/apps/stdlib/zip.html
Ignore this check with:
$ mix sobelow -i DOS.Zip