Spectra - smaul's results

A permissionless interest rate derivatives protocol on Ethereum.

General Information

Platform: Code4rena

Start Date: 23/02/2024

Pot Size: $36,500 USDC

Total HM: 2

Participants: 39

Period: 7 days

Judge: Dravee

Id: 338

League: ETH

Spectra

Findings Distribution

Researcher Performance

Rank: 20/39

Findings: 1

Award: $80.57

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

80.5733 USDC - $80.57

Labels

bug
2 (Med Risk)
partial-75
sufficient quality report
:robot:_33_group
duplicate-210

External Links

Lines of code

https://github.com/code-423n4/2024-02-spectra/blob/main/src/tokens/PrincipalToken.sol#L460-L462 https://github.com/code-423n4/2024-02-spectra/blob/main/src/tokens/PrincipalToken.sol#L483-L485

Vulnerability details

Impact

Some Functions e.g. maxWithdraw(), maxRedeem() in the PrincipalToken Contract isn't Following the proper EIP-5095 standard which can create issue if someone want to integrate PrincipalToken with any other protocol and they expect those functions to be return 0 when pause but it will just revert the whole transaction and this can cause security issue the system.

Proof of Concept

maxWithdraw(), maxRedeem() functions are not following the proper EIP5095 standard. According to the EIP standard these functions should return 0 incase of pause but in this contract the functions will revert incase the contract is paused. Recommended EIP snippet;

MUST factor in both global and user-specific limits, like if redemption is entirely disabled (even temporarily) it MUST return 0. MUST NOT revert.

As Spectra team specifically mentioned that this contract is compliant to EIP5095 standard, so the team should make sure it follows proper EIP guidelines.

PoC:

function testPauseShoudNotRevert() external {

uint256 amountToDeposit = 1e18;

_prepareForDepositIBT(testUser, amountToDeposit);

vm.startPrank(testUser);

ibt.approve(address(principalToken), amountToDeposit);

principalToken.depositIBT(amountToDeposit, testUser);

vm.stopPrank();

vm.prank(scriptAdmin);
principalToken.pause();

vm.prank(testUser);
uint wb = principalToken.maxWithdraw(testUser);
console.log("Withdrawable Balance Should be 0:", wb);

}

Tools Used

Manual Analysis

Follow the EIP5095 guidelines and return 0 value for maxWithdraw(), maxRedeem() functions when the contract is paused.

Assessed type

Context

#0 - c4-pre-sort

2024-03-03T09:21:03Z

gzeon-c4 marked the issue as duplicate of #33

#1 - c4-pre-sort

2024-03-03T09:21:07Z

gzeon-c4 marked the issue as sufficient quality report

#2 - c4-judge

2024-03-11T00:23:56Z

JustDravee marked the issue as satisfactory

#3 - c4-judge

2024-03-11T00:23:59Z

JustDravee marked the issue as partial-75

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter