In-depth lesson · DoS
Typical fixes
Every point the DoS reports back under this heading, best-backed first, each with the reports it is seen in.
-
Replace vulnerable regular expressions with ones that do not have overlapping or ambiguous clauses, or use a linear-time matcher.
Seen in 31 reports
-
Check the declared decompressed length against the gossip size limit before allocating or decompressing.
Seen in 11 reports
-
Resolve and validate the real target path before a privileged service or installer writes a file, and refuse to follow symbolic links.
Seen in 9 reports
-
Restrict access to dangerous writer and logging functions.
Seen in 8 reports
-
Replace backtracking-prone regular expressions with linear-time parsing or bound the input length.
Seen in 7 reports
-
Enforce maximum lengths and validation on message, template, name, password and avatar fields.
Seen in 7 reports
-
Check the declared decompressed length against the documented maximum before allocating or decompressing.
Seen in 7 reports
-
Validate field and size values against the received buffer length before reading.
Seen in 7 reports
-
Rewrite vulnerable regular expressions to avoid nested quantifiers and ambiguous repetition, or bound input length before matching.
Seen in 5 reports
-
Validate setter inputs so divisors and multipliers cannot be zero and fees cannot exceed the base constant.
Seen in 5 reports
-
Bound loops over arrays and balances or process them in batches.
Seen in 5 reports
-
The HID crash issues were addressed with improved bounds checks.
Seen in 5 reports
-
Stop fetching record data the dashboard does not render, cap record sizes and add end-of-input checks to decoders.
Seen in 5 reports
-
Check whether a path is a symbolic link and validate the target before writing.
Seen in 5 reports
-
Check return values and null pointers and free allocated memory on every error path.
Seen in 4 reports
-
Check pointers for null and validate buffer lengths before dereferencing or freeing.
Seen in 4 reports
-
Cache the described sub-call and add a depth limit to the decoder.
Seen in 4 reports
-
Count pending handshakes against the connection limit and defer expensive key generation until the peer has sent its first message.
Seen in 4 reports
-
Decode opaque inner calls with the depth-limited decoder used elsewhere and require all bytes to be consumed.
Seen in 4 reports
-
Validate the real target path and refuse to follow links or junctions created by low-privileged users.
Seen in 3 reports
-
Enforce server-side maximum lengths and character validation on usernames, phone numbers and uploaded filenames.
Seen in 3 reports
-
Validate and limit file read operations in JSON-RPC handlers to avoid blocking on slow streams.
Seen in 3 reports
-
Check buffers are allocated and avoid recursion in close paths.
Seen in 3 reports
-
Bound retries on deterministic reverts and re-check parent validity before submitting.
Seen in 3 reports
-
Reserve the one-byte derivation version prefix in the default frame-size budget and add an await point in the retry loop.
Seen in 3 reports
-
Verify the proof-of-work seal in the sync verifier and report failures as verification errors that carry peer identity so the peer can be penalised.
Seen in 3 reports
-
Do not use unverified nullifier public inputs as pool identity, or verify the proof before admission.
Seen in 3 reports
-
Bound the mintable share supply and reserve headroom for the next fee accrual before checked addition.
Seen in 3 reports
-
Treat an unrepresentable share quote as zero shares and take the rejection and refund path instead of panicking.
Seen in 3 reports
-
Check decoded dimensions and pixel count, not just compressed size.
Seen in 3 reports
-
Use safeTransfer functions that handle non-standard tokens which do not return a boolean.
-
Validate that array elements and the param field are objects of the expected type before accessing them.
-
Enforce a maximum password length before hashing the input.
Seen in 2 reports
-
Apply the same control character validation to document.cookie as to Set-Cookie.
-
Check length and offset fields against buffer size and release memory after negotiate.
-
Bounds-check offsets from file metadata before reading.
-
Truncate long URLs before rendering on the home screen.
-
Use call instead of transfer and handle recipients that cannot receive Ether.
-
Handle reverts inside loops and paginate view functions.
-
Allow repayment or replenishment amounts to be at most the current debt or deficit.
Seen in 2 reports
-
Validate bid public keys, commitments and encrypted amounts at submission.
Seen in 2 reports
-
Do not assume a minimum creation code size and initialise arrays returned from pause functions.
Seen in 2 reports
-
Make the txpool affordability check include every fee that execution will charge.
-
Reserve space for the derivation prefix byte in frame sizing and add backoff to failed frame retries.
-
Cap request body size and validate field lengths before buffering, parsing or hashing.
-
Bound the number of storage keys per request and keep the semaphore and blocking-pool offload in the override.
Seen in 2 reports
-
Low -
Low
-
-
Classify the over-cap rejection as permanent so the transaction is evicted and rejection-cached.
-
Apply the same content-size validation to drafts as to published posts and do not persist a draft after an error.
-
Check claimed image dimensions and cap decode memory before handing the file to the graphics library.
-
Enforce request size limits at the HTTP server and structural limits in the payload schema.