Detect unprotected variable that are marked protected
contract Buggy{
/// @custom:security write-protection="onlyOwner()"
address owner;
function set_protected() public onlyOwner(){
owner = msg.sender;
}
function set_not_protected() public{
owner = msg.sender;
}
}
owner
must be always written by function using onlyOwner
(write-protection="onlyOwner()"
), however anyone can call set_not_protected
.
Add access controls to the vulnerable function
protected-vars on Slither's wiki.