-
Notifications
You must be signed in to change notification settings - Fork 0
/
Calyptus462.sol
35 lines (30 loc) · 942 Bytes
/
Calyptus462.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
// https://x.com/calyptus_web3/status/1855890728951369798
// Identify the vulnerability in the provided proxy contract setup and propose a solution.
// The base logic contract
contract BaseContractV1 {
uint256 public count;
address public owner;
constructor(){
owner = msg.sender;
}
function increment() external {
require(msg.sender == owner,"Only owner can increment");
count++;
}
}
// The upgraded logic contract, intended to be used with a proxy.
contract BaseContractV2 {
uint256 public count;
address public owner;
string public name;
function increment() external {
require(msg.sender == owner, "Only owner can increment");
count += 2;
}
function setName(string memory _name) external {
require(msg.sender == owner, "Only owner can set the name");
name = _name;
}
}