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.
-
Add recursion depth limits and stack-overrun checks to geometry parsers.
-
Check for empty decrypted replies before subtracting from lengths and bound server-supplied iteration counts.
Seen in 2 reports
-
Bound server-supplied counts and lengths before using them as array or stack allocation sizes.
-
Validate length and count values in server responses before use.
-
Check size and offset fields against buffer bounds and guard against integer overflow before allocation.
-
Limit image dimensions and total pixel count before processing.
Seen in 2 reports
-
Fix the removal loop so it does not skip entries and never leaves a negative descriptor in the list.
Seen in 1 report
-
Add a recursion depth limit and loop detection when following compression pointers.
-
Enforce an overall timeout on webhook deliveries and limit the size of responses that are buffered or stored.
Seen in 1 report
-
Assign vault identifiers in the protocol rather than letting users choose them, or use a commit-reveal scheme.
Seen in 1 report
-
Include a unique salt or deployer address in the CREATE2 salt so that addresses cannot be pre-occupied.
Seen in 1 report
-
Do not enforce a hard maximum balance in the deposit function, or allow deposits to exceed the limit temporarily.
Seen in 1 report
-
Cap the size of the activeTransactionBlocks array and avoid O(n) removal loops.
Seen in 1 report
-
Cap the shared NFT array and provide a way to remove entries without requiring a successful transfer.
Seen in 1 report
-
Check for integer overflow when adding a skip length to the index in generated unmarshalling code.
Seen in 1 report
-
Reject non-SIP URIs in SIP headers and check for NULL scheme pointers before dereferencing.
Seen in 1 report
-
Validate and limit the array index provided in the multipart map.
Seen in 1 report
-
Validate that the tag name is a non-null string before saving it, and handle null gracefully in the front-end.
Seen in 1 report
-
Validate the target path when following a directory junction.
Seen in 1 report
-
Validate the proposal type string and reject null proposed values at creation time.
Seen in 1 report
-
Maintain a separate counter for the curated pool count instead of iterating over an unbounded array.
Seen in 1 report
-
Handle insufficient balances per protocol instead of reverting the entire batch.
Seen in 1 report
-
Use safeIncreaseAllowance instead of safeApprove when changing a non-zero allowance.
Seen in 1 report
-
Properly encode special characters in branch names when constructing URLs.
Seen in 1 report
-
Safely encode URL characters before storing them in the cache.
Seen in 1 report
-
Deploy and initialize proxy contracts in the same transaction.
Seen in 1 report
-
Initialize implementation contracts or disable their initializers.
Seen in 1 report
-
Wrap the URL constructor in a try/catch and validate leading slashes.
-
Validate the Content-Length header to prevent excessive memory allocation.
Seen in 1 report
-
Use a keyed hash function and disallow duplicate keys in the hash table.
Seen in 1 report
-
Lower the rate limit threshold for the add comment endpoint.
Seen in 1 report
-
Properly validate uploaded file content type and content, and do not serve SVG files from user uploads.
Seen in 1 report
-
Do not assert that the contract's LP token balance is zero after redemption; account for donations.
Seen in 1 report
-
Do not assert that the contract's yield share balance is zero after a swap; account for pre-existing shares.
Seen in 1 report
-
Fix the race condition in Pluton syscall handling to prevent reboots.
Seen in 1 report
-
Scale the weight ratio consistently with the base used in the pow calculation to prevent overflow.
Seen in 1 report
-
Declare the array with the correct length or use a dynamic array.
Seen in 1 report
-
Pass the underlying token address instead of the LP token address to the router's update function.
Seen in 1 report
-
Set a session status on every created session and make cleanup remove sessions with unset status.
Seen in 1 report
-
Validate and limit filename length before file handling and URL operations.
Seen in 1 report
-
Enforce a limit on the actual data read, not just the declared uncompressed size.
Seen in 1 report
-
Do not pass user-controlled parameters to dynamic method invocation.
-
Validate and cap integer values read from HTTP headers before allocating or looping.
Seen in 1 report
-
Verify packet length against the minimum before subtracting.
Seen in 1 report
-
Validate Vendor ID payloads before dereferencing pointers.
-
Add access control to approve functions.
Seen in 1 report
-
Handle share previews that round to zero.
-
Allow a previous round's price when the current round is outside the epoch window.
Seen in 1 report
-
Check whether the borrowed amount exceeds the cap before subtracting.
-
Limit gas forwarded to receiver hooks.
Seen in 1 report