Sobelow.DOS.Decompression (Sobelow v0.19.0)

View Source

Resource exhaustion through decompression

:zlib.gunzip/1, :zlib.uncompress/1, :zlib.unzip/1 and :zlib.inflate/2,3 can expand untrusted compressed data without an application-defined output limit. Here :zlib.unzip/1 decodes raw DEFLATE data, not a ZIP container; archive extraction is covered by DOS.Zip. Small compressed input or input chunks can produce much larger output. Checking output size after these calls may be too late to prevent exhaustion.

Use bounded output chunks, for example with :zlib.safeInflate/2, while counting actual output bytes and stopping before a per-stream or cumulative budget is exceeded. Also bound compressed input, execution resources and concurrency. safeInflate/2 bounds an individual call, not the whole stream; collecting all its output without a cumulative limit is still unbounded. Its presence elsewhere does not suppress findings for other decompression.

This check reports dynamic compressed inputs, at medium confidence for controller parameters and low confidence otherwise. Fully literal inputs are omitted. Stream state, input provenance and custom preflight validators are not tracked. Compression, initialization, cleanup and safeInflate/2 are not reported. Audit bounded wrappers before skipping them.

https://www.erlang.org/doc/apps/erts/zlib.html

Ignore this check with:

$ mix sobelow -i DOS.Decompression

Summary

Functions

details()

id()

parse_def(fun)

rule()

run(fun, meta_file)