Add SB Curated (copied from the smartbugs repository).
This commit is contained in:
29
dataset/denial_of_service/auction.sol
Normal file
29
dataset/denial_of_service/auction.sol
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* @source: https://github.com/trailofbits/not-so-smart-contracts/blob/master/denial_of_service/auction.sol
|
||||
* @author: -
|
||||
* @vulnerable_at_lines: 23
|
||||
*/
|
||||
|
||||
pragma solidity ^0.4.15;
|
||||
|
||||
//Auction susceptible to DoS attack
|
||||
contract DosAuction {
|
||||
address currentFrontrunner;
|
||||
uint currentBid;
|
||||
|
||||
//Takes in bid, refunding the frontrunner if they are outbid
|
||||
function bid() payable {
|
||||
require(msg.value > currentBid);
|
||||
|
||||
//If the refund fails, the entire transaction reverts.
|
||||
//Therefore a frontrunner who always fails will win
|
||||
if (currentFrontrunner != 0) {
|
||||
//E.g. if recipients fallback function is just revert()
|
||||
// <yes> <report> DENIAL_OF_SERVICE
|
||||
require(currentFrontrunner.send(currentBid));
|
||||
}
|
||||
|
||||
currentFrontrunner = msg.sender;
|
||||
currentBid = msg.value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user