Open pde-rent opened 8 months ago
I believe there is slight confusion in relation to this issue. The issue title includes APY-02M which is about scratch space and APY-03M which is about an improperly forwarded payload.
APY-02M is already minor (due to the difficulties in reproducing stack corruption as you described) but APY-03M is reproducible and directly outlines the flaw in the forwarded calldata
which we reproduced locally. We are more than happy to relocate the major severity vulnerability to the StrategyV5Chainlink::updateAsset
and StrategyV5Pyth::updateAsset
functions, however, this would result in two major vulnerabilities replacing one which we do not think is ideal.
Thanks for clarifying, let's keep it as is.
We implemented the fix in a19c9dfd5403356cd0fb0ab701067c237a8696c5, tests revealed the implementation had flaws leading to 01dec1f31b6a983353be1fbb72aeb8163bdac34d.
Please note that _delegateToSelectorMemory
still has a an issue that we're working on (used in updateAsset
and setInputs
) if you guys could have a look, it might be obvious to your eagle eyes
Good point, corrupting memory and messing with the scratch space is not suitable for use at scale. We'll change the implementation to not alter scratch space and keep track of the updated memory pointer to make
_delegateWithSignature
usable amidst a longer call-flow.I would argue the severity here could be medium given that the function works (used for 1 year+) and stack corruption is hardly productible, the issues arise from broader call-flows (eg. designated inputs missmatch) and not the delegation itself, what do you think?
Fix proposal
Edit Here is an updated fix proposal with delegate calldata being passed as parameter
Edit 2 Function selector should be passed to the function from interface pre-compiled and not re-compiled at RT