BriVault

First Flight #52
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: high
Likelihood: high
Invalid

Missing ReentrancyGuard for function that transfer token

Missing ReentrancyGuard for function that transfer token can lead to a contract fund draining

Description

  • Every token transfer should be an atomic operation of the contract

  • No mutex is used in the contract

@function deposit(uint256 assets, address receiver) public override returns (uint256) {
@function joinEvent(uint256 countryId) public {
@function cancelParticipation () public {
@function withdraw() external winnerSet {

Risk

Likelihood:

  • Will occur when a malicious participant or contract will callback the contract or function before the end of the function

Impact:

  • Fund are drained

Recommended Mitigation

+import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
-function deposit(uint256 assets, address receiver) public override returns (uint256) {
+function deposit(uint256 assets, address receiver) public nonReentrant override returns (uint256) {
-function joinEvent(uint256 countryId) public {
+function joinEvent(uint256 countryId) public nonReentrant {
-function cancelParticipation () public {
+function cancelParticipation () public nonReentrant {
-function withdraw() external winnerSet {
+function withdraw() external winnerSet nonReentrant {
Updates

Appeal created

bube Lead Judge 21 days ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!