Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding earlyPayers exposed to every persons - High Severity! #57

Open
olahfemi opened this issue Mar 26, 2023 · 0 comments
Open

Adding earlyPayers exposed to every persons - High Severity! #57

olahfemi opened this issue Mar 26, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@olahfemi
Copy link
Collaborator

olahfemi commented Mar 26, 2023

Description
Affects both Vault5 and Vault10.

function addAddressOfEarlyPayment() allows any person to add themselves as earlypayer regardless if they are or not and this will open a vulnerability that allows the persons to attack the contract by claiming or withdrawing what he/she has no right to.

Context
Vault5.sol SLOC 62

POC

vm.prank(earlypayer4);
        vault5.addAddressOfEarlyPayment();
        vm.prank(Nonearlypayer5);
        vault5.addAddressOfEarlyPayment();

Stack traces 

    ├─ [0] VM::prank(earlypayer4: [0x4D9eFAE091Af29c3515E2c7f2f0d3003761918c3]) 
    │   └─ ← ()
    ├─ [24591] Vault5::addAddressOfEarlyPayment() 
    │   ├─ emit NewPaidUser(user: earlypayer4: [0x4D9eFAE091Af29c3515E2c7f2f0d3003761918c3], number: 4)
    │   └─ ← ()
    ├─ [0] VM::prank(Nonearlypayer5: [0x1844E62344cE92080772f5727ea370102D02c5E5]) 
    │   └─ ← ()
    ├─ [24591] Vault5::addAddressOfEarlyPayment() 
    │   ├─ emit NewPaidUser(user: Nonearlypayer5: [0x1844E62344cE92080772f5727ea370102D02c5E5], number: 5)
    │   └─ ← ()
    ├─ [0] VM::prank(Nonearlypayer5: [0x1844E62344cE92080772f5727ea370102D02c5E5]) 
    │   └─ ← ()

Note: The impact of the above can also result to the attack in issue #56 stated previously.

Recommendation
it is advisable to check if a user is indeed a valid earlypayer by adding one or two checks before they can be given the opportunity to withdraw their part of the share.

@olahfemi olahfemi added the bug Something isn't working label Mar 26, 2023
@olahfemi olahfemi changed the title Adding earlyPayers exposed to every persons Adding earlyPayers exposed to every persons - High Severity! Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants