-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Handle
gpersoon
Vulnerability details
Impact
The initial tokens are minted to the address PERMANENT_INITIAL_LIQUIDITY_HOLDER
The comments suggest they can never be moved from there.
However transferFrom in SyntheticToken.sol allows longShort to move tokens from any address so also from address PERMANENT_INITIAL_LIQUIDITY_HOLDER
This is unlikely to happen because the current source of LongShort.sol doesn't allow for this action.
However LongShort.sol is upgradable to in theory a future version could allow this.
Proof of Concept
// https://github.com/code-423n4/2021-08-floatcapital/blob/main/contracts/contracts/LongShort.sol#L34
/// @notice this is the address that permanently locked initial liquidity for markets is held by.
/// These tokens will never move so market can never have zero liquidity on a side.
/// @dev f10a7 spells float in hex - for fun - important part is that the private key for this address in not known.
address public constant PERMANENT_INITIAL_LIQUIDITY_HOLDER = 0xf10A7_F10A7_f10A7_F10a7_F10A7_f10a7_F10A7_f10a7;
//https://github.com/code-423n4/2021-08-floatcapital/blob/main/contracts/contracts/LongShort.sol#L304
function _seedMarketInitially(uint256 initialMarketSeedForEachMarketSide, uint32 marketIndex) internal
...
ISyntheticToken(syntheticTokens[latestMarket][true]).mint(PERMANENT_INITIAL_LIQUIDITY_HOLDER,initialMarketSeedForEachMarketSide);
ISyntheticToken(syntheticTokens[latestMarket][false]).mint(PERMANENT_INITIAL_LIQUIDITY_HOLDER, initialMarketSeedForEachMarketSide);
// https://github.com/code-423n4/2021-08-floatcapital/blob/main/contracts/contracts/SyntheticToken.sol#L91
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
if (recipient == longShort && msg.sender == longShort) { // sender could be any address
super._transfer(sender, recipient, amount);
return true;
} else {
return super.transferFrom(sender, recipient, amount);
}
}
Tools Used
Recommended Mitigation Steps
Accept the risk and document this in the contract
or update transferFrom to contain the following:
if (recipient == longShort && msg.sender == longShort && sender!=PERMANENT_INITIAL_LIQUIDITY_HOLDER) {