bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 14쪽 중 14쪽
endorsement of any particular project or team, and the report
does not guarantee the security of any particular project. This audit does not give any war-
ranties on discovering all security issues of the smart contracts, i.e., the evaluation result does
1https://github.com/PufferFinance/puffer-locker/blob/dev/src/vlPUFFER.sol
not guarantee the nonexistence of any further findings of security issues. As one audit can-
not be considered comprehensive, we always recommend proceeding with independent audits
and a public bug bounty program to ensure the security of smart contracts.
The scope of this audit is limited to the code mentioned in Section 1.1. Unless explic-
itly specified, the security of the language itself (e.g., the solidity language), the underlying
compiling toolchain and the computing infrastructure are out of the scope.
1.3 Procedure of Auditing
We perform the audit according to the following procedure.
-Vulnerability DetectionWe first scan smart contracts with automatic code analyzers,
and then manually verify (reject or confirm) the issues reported by them.
-Semantic AnalysisWe study the business logic of smart contracts and conduct further
investigation on the possible vulnerabilities using an automatic fuzzing tool (developed by
our research team). We also manually analyze possible attack scenarios with independent
auditors to cross-check the result.
-RecommendationWe provide some useful advice to developers from the perspective
of good programming practice, including gas optimization, code style, and etc.
We show the main concrete checkpoints in the following.
1.3.1 Security Issues
∗Access control
∗Permission management
∗Whitelist and blacklist mechanisms
∗Initialization consistency
∗Improper use of proxy system
∗Reentrancy
∗Denial of Service (DoS)
∗Untrusted external calls and control flow
∗Exception handling
∗Data handling and flow
∗Events operations
∗Error-prone randomness
∗Oracle security
∗Business logic correctness
∗Semantic and functional consistency
∗Emergency mechanisms
∗Economic and incentive impact
1.3.2 Additional Recommendation
∗Gas efficiency
∗Code quality and style
2
∗Redundant logic and code
∗Parameter validations
∗Documentation and comments
1.3.3 Note
∗Centralization risks
∗Off-chain dependencies
∗Threat modeling
∗Protocol-specific assumptions
NoteThe listed checkpoints cover the primary focus areas. Additional checks may be applied
depending on the project’s design. The audit emphasizes identifying security vulnerabilities
rather than verifying standard functionality. When specifications are clear, we assume func-
tional correctness and concentrate on uncovering potential security issues.
1.4 Security Model
To evaluate the risk, we follow the standards or suggestions that are widely adopted by
both industry and academy, including OWASP Risk Rating Methodology 2 and Common Weak-
ness Enumeration 3. The overallseverityof the risk is determined bylikelihoodandimpact.
Specifically, likelihood is used to estimate how likely a particular vulnerability can be uncov-
ered and exploited by an attacker, while impact is used to measure the consequences of a
successful exploit.
In this report, both likelihood and impact are categorized into two ratings, i.e.,highandlow
respectively, and their combinations are shown in Table 1.1.
Table 1.1:Vulnerability Severity Classification
Impact
High High Medium
Low Medium Low
High Low
Likelihood
Accordingly, the severity measured in this report are classified into three categories:High,
Medium,Low. For the sake of completeness,Undeterminedis also used to cover circum-
stances when the risk cannot be well determined.
Furthermore, the status of a discovered item will fall into one of the following five cate-
gories:
2https://owasp.org/www-community/OWASP_Risk_Rating_Methodology
3https://cwe.mitre.org/
3
-UndeterminedNo response yet.
-AcknowledgedThe item has been received by the client, but not confirmed yet.
-ConfirmedThe item has been recognized by the client, but not fixed yet.
-Partially FixedThe item has been confirmed and partially fixed by the client.
-FixedThe item has been confirmed and fixed by the client.
4
Chapter 2 Findings
In total, we havetworecommendations.
- Recommendation: 2
ID Severity Description Category Status
1 - Incorrect comment on vlPUFFER mintinglogic Recommendation Fixed
2 - Lack of check in functionkickUsers() Recommendation Confirmed
The details are provided in the following sections.
2.1 Additional Recommendation
2.1.1 Incorrect comment on vlPUFFER minting logic
StatusFixed inVersion 2
Introduced byVersion 1
DescriptionUsers can invoke thecreateLock()function to depositPUFFERtokens in exchange
forvlPUFFER, calculated asamount * multiplier, wheremultiplierrepresents the number of
months the tokens will be locked. However, acommentin the code suggests that locking 100
PUFFERfor 2 years yields 24,000vlPUFFER, which is incorrect based on the actual logic (100
PUFFER* 24 months = 2,400vlPUFFER). This inconsistency between the comment and the
implementation may confuse developers or integrators reviewing the code.
66// If a user locks 100 PUFFER tokens for 2 years, they will get 24000 vlPUFFER
Listing 2.1:vlPUFFER.sol
138functioncreateLock(uint256amount,uint256multiplier)external{
139_createLock(amount, multiplier);
140}
Listing 2.2:vlPUFFER.sol
167function_createLock(uint256amount,uint256multiplier)internalonlyValidMultiplier(
multiplier) whenNotPaused {
168require(amount >= _MIN_LOCK_AMOUNT, InvalidAmount());
169require(lockInfos[msg.sender].pufferAmount == 0, LockAlreadyExists());
170
171
172// Transfer PUFFER tokens to this contract using SafeERC20
173PUFFER.safeTransferFrom(msg.sender,address(this), amount);
174
175
176uint256unlockTime = _calculateUnlockTime(multiplier);
177uint256vlPUFFERAmount = amount * multiplier;
178
179
180uint256supplyBefore = totalSupply();
181
182
183// Mint the vlPUFFER (non transferable)
184_mint(msg.sender, vlPUFFERAmount);
185
186
187// Update the lock information
188lockInfos[msg.sender] = LockInfo({ pufferAmount: amount, unlockTime: unlockTime });
189
190
191// delegate the voting power to themselves
192_delegate(msg.sender,msg.sender);
193
194
195emitDeposit({ user:msg.sender, pufferAmount: amount, unlockTime: unlockTime,
vlPUFFERAmount: vlPUFFERAmount });
196emitSupply({ previousSupply: supplyBefore, currentSupply: totalSupply() });
197}
Listing 2.3:vlPUFFER.sol
SuggestionRevise the comment to ensure it accurately reflects the implemented logic and
remains consistent with the code.
2.1.2 Lack of check in functionkickUsers()
StatusConfirmed
Introduced byVersion 1
DescriptionThekickUsers()function allows any caller to remove users who have failed to
withdraw theirPUFFERtokens after the grace period, transferring their tokens and awarding a
1% fee to thekicker. However, the function does not prevent users from including their own
address in the kick list. Since self-kicking yields the same result as invokingwithdraw(), this
operation is redundant and serves no purpose.
278
279/**
280* @notice Kick multiple users and receive 1% of their PUFFER tokens as a reward
281* @param users Array of user addresses to kick
282*/
283functionkickUsers(address[] calldata users)external{
284uint256totalKickerFee;
285
286
287for(uint256i = 0; i < users.length; ++i) {
288addressuser = users[i];
289LockInfomemorylockInfo = lockInfos[user];
290
291
292if(lockInfo.pufferAmount == 0) {
293continue;
6
294}
295
296
297// The user has a grace period to withdraw their tokens
298require(lockInfo.unlockTime + _GRACE_PERIOD <block.timestamp, TokensMustBeUnlocked());
299
300
301uint256vlPUFFERAmount = balanceOf(user);
302
303
304// 1% of the PUFFER tokens are sent to the kicker
305uint256kickerFee = (lockInfo.pufferAmount * _KICKER_FEE_BPS) / _KICKER_FEE_DENOMINATOR
;
306totalKickerFee += kickerFee;
307
308
309// The rest of the PUFFER tokens are sent to the user
310uint256pufferAmount = lockInfo.pufferAmount;
311
312
313deletelockInfos[user];
314
315
316_burn(user, vlPUFFERAmount);
317
318
319// Send the rest of the PUFFER tokens to the user
320PUFFER.safeTransfer(user, pufferAmount - kickerFee);
321
322
323emitUserKicked({ kicker:msg.sender, user: user, vlPUFFERAmount: vlPUFFERAmount,
kickerFee: kickerFee });
324}
325
326
327// Send all kicker fees in a single transfer
328if(totalKickerFee > 0) {
329PUFFER.safeTransfer(msg.sender, totalKickerFee);
330}
331}
Listing 2.4:vlPUFFER.sol
SuggestionAdd a check to prevent users from kicking themselves.
Feedback from the projectUsers can invokekickUsers()from a different address, therefore
adding such a check would be meaningless.
7프로젝트로 돌아가기