2025-02-datingdapp/retrospective.md
han 09ed9015e5
Some checks failed
CI / Foundry project (push) Has been cancelled
add valid finding, ai finding, and retro
2025-03-08 23:24:27 +07:00

4.7 KiB

Audit Findings Retrospective

Analysis of Your Findings

Finding Overview

  1. H-01: Blocked User Can Call SoulboundProfileNFT::mintProfile Again

    • Originally marked as High severity
    • Actually Medium severity
    • Valid finding but severity overestimated
  2. H-02: User Fund Sent to LikeRegistry::likeUser is Never Accounted

    • High severity
    • Valid finding
    • Well documented with proper severity assessment

Areas for Improvement

  1. Severity Assessment

    • H-01 was overestimated as High when it should be Medium
    • Consider the following for severity assessment:
      • Immediate financial impact
      • Likelihood of exploitation
      • Complexity of the attack
      • Required preconditions
  2. Impact Analysis

    • Could expand more on the real-world implications
    • Consider including specific attack scenarios
    • Quantify potential losses where possible
  3. Alternative Attack Vectors

    • Could explore more variations of the attacks
    • Consider combining vulnerabilities for compound effects
    • Analyze potential bypass methods for proposed fixes

Recommendations for Future Findings

  1. Severity Classification

    • Use CVSS scoring system or similar framework
    • Document severity reasoning more explicitly
    • Consider both impact and likelihood
  2. Documentation Enhancement

    • Include diagrams for complex attack flows
    • Add more real-world exploitation scenarios
    • Document any assumptions made
  3. Testing Methodology

    • Include more edge cases in POCs
    • Test fixes against multiple attack vectors
    • Document test coverage

Learning from Other Auditors' Findings

1. Deeper State Analysis (from M-01)

  • Other auditors identified the same issue with blocked profiles but approached it differently
  • They focused on the root cause (state management) rather than just the symptom
  • Key learning: Always analyze how state changes affect the entire system lifecycle
  • Their solution with isBlocked mapping is more robust and gas-efficient

2. Complex Scenario Modeling (from M-02)

  • Impressive multi-step attack scenario involving multiple users
  • Demonstrated deep understanding of business logic flaws
  • Key learnings:
    • Consider how different user interactions can be combined
    • Test complex user interaction sequences
    • Think about how state resets affect future interactions
    • Pay attention to accounting mechanisms and balance tracking

3. Quality of Documentation

  • Other auditors excelled in:
    • Clear step-by-step attack scenarios
    • Detailed proof of concepts with multiple actors
    • Well-structured test cases that prove the vulnerability
    • Thorough explanation of the root cause

4. Advanced Testing Techniques

  • Use of descriptive console.log statements in POCs
  • Creation of multiple test accounts with meaningful names
  • Systematic approach to testing complex scenarios
  • Clear separation of setup, execution, and verification in tests

5. Recommendations Quality

  • Solutions consider:
    • Gas efficiency
    • State management
    • Future extensibility
    • Clear upgrade paths

6. Centralization Risk Analysis (from M-03)

  • Identified important centralization risks in permissioned functions
  • Considered user fund safety in relation to admin powers
  • Key learnings:
    • Always analyze privileged functions for potential abuse
    • Consider user fund safety in relation to admin actions
    • Propose decentralized alternatives (e.g., voting mechanisms)
    • Think about user protection mechanisms

7. Smart Contract Security Patterns (from M-04)

  • Excellent identification of CEI (Checks-Effects-Interactions) pattern violation
  • Thorough understanding of reentrancy vectors in NFT minting
  • Key learnings:
    • Always follow established security patterns
    • Consider callback functions as potential attack vectors
    • Pay attention to state updates ordering
    • Think about contract-to-contract interactions

8. Testing Innovation

From M-03 and M-04:

  • Creation of specialized malicious contracts for testing
  • Use of vm.prank and vm.startPrank effectively
  • Clear test naming that describes the attack scenario
  • Effective use of assertions to prove vulnerability impact

Additional Key Takeaways

  1. Consider Centralization: Always analyze privileged functions for potential abuse and propose decentralized alternatives
  2. Follow Security Patterns: Adhere to established patterns like CEI and document any necessary deviations
  3. Test Edge Cases: Create specialized contracts and scenarios to test security assumptions

Conclusion

Remember to:

  • Double-check severity ratings against standard frameworks
  • Expand impact analysis with real-world scenarios
  • Consider more complex attack vectors
  • Test fixes thoroughly
  • Document assumptions and limitations