feat(dos): implement denial-of-service, gas-griefing, and unbounded-work analysis (#80) - #114
Merged
Nanle-code merged 2 commits intoAug 30, 2026
Conversation
Contributor
|
@covenantalade nice work here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #80
engine for ChainProof/StellarChainproofs.
constant_bounded,paginated,unbounded).- Tracks side-effects in loop bodies (state writes, storage deletes, call fan-outs, return bombs, event
emissions).
2. Call Fan-Out & Push Payment Detection (
packages/core/src/dos/call-fanout.ts):- Identifies high-risk push-payment patterns, value transfers, low-level
.call, return bombs(
returndatacopy), and 63/64th gas forwarding issues.3. Array Growth & Storage Poisoning (
packages/core/src/dos/growth-analyzer.ts):- Detects public/unprotected
.push()endpoints on storage arrays iterated across contracts.4. Mitigation Evidence Recognition (
packages/core/src/dos/mitigation-detector.ts):- Recognizes pull-payment workflows, pagination (
offset/limit), explicit length caps (require(len <= MAX)), failure isolation, and checkpoint state machines.5. Rule Suite (
CP-DOS-001throughCP-DOS-010):-
CP-DOS-001: Unbounded Loop Iteration over Dynamic Storage-
CP-DOS-002: Push-Payment Pattern with Unexpected Revert Risk (SWC-113)-
CP-DOS-003: External Call Fan-Out in Loop Body-
CP-DOS-004: Returndata Memory Bomb / Griefing Risk-
CP-DOS-005: Unbounded Storage Clearing / Mass Deletion-
CP-DOS-006: Insufficient Gas Forwarding (63/64th Rule)-
CP-DOS-007: Single-Transaction Block Gas Limit Deadlock-
CP-DOS-008: Unbounded Recursion (SWC-107)-
CP-DOS-009: Array Poisoning / Unconstrained Growth-
CP-DOS-010: Revert Propagation in Batch Operations6. CLI Commands & Server Endpoints:
- CLI:
chainproof dos inspect-loops,fanout,audit(--format table|json|markdown,--fail-on).- REST API:
POST /dos/inspect-loops,POST /dos/fanout,POST /dos/auditwith OpenAPI v3 docs.7. Fixtures & Documentation:
- Added 9 vulnerable and secure Solidity fixtures in
examples/contracts/dos/.- Comprehensive guide in
docs/dos-analysis.md.