-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Oppornity to drain funds because of missing propId validaiton in govshuttle #15
Comments
|
Hi @poorphd could you please elaborate more on this argument:
The code you quoted immediately before this only makes sure that it's Can't anyone send a |
Hi @3docSec, thanks for your review. Yes, that's right. After freezing the audit target code, our team internally identified that the authority validation for the govshuttle’s proposal msgs was missing, separate from the report. This issue was intended to be patched internally. We understood the report to have focused on the misses validation for duplicate propId, because the report didn’t mentioning the authority checks as a mitigation and Impact, only addressing the propId existence check. However, given that the authority validation issue has been clarified through your argument, even upon re-evaluation, our team has found that the audit target code has issues with proto, codec, and marshaling not functioning correctly for several Msgs including govshuttle proposal msgs. Therefore, even if the authority validation is missing, it appears that user can’t send a proposal msg, making the attack scenario you mentioned impossible. unsigned_tx.json
{
"body": {
"messages": [
{
"@type": "/canto.govshuttle.v1.MsgLendingMarketProposal",
"Authority": "canto10d07y265gmmuvt4z0w9aw880jnsr700jg5j4zm",
"Title": "test proposal",
"Description": "test",
"Metadata": "test"
}
],
"memo": "",
"timeout_height": "0",
"extension_options": [],
"non_critical_extension_options": []
},
"auth_info": {
"signer_infos": [],
"fee": {
"amount": [],
"gas_limit": "200000",
"payer": "",
"granter": ""
},
"tip": null
},
"signatures": []
}
$ cantod tx sign unsigned_tx.json --from canto1zjt3k88vft0vualyzv3qty6avf895qqyv59e3w --chain-id canto_9000-1 --output-document signed_tx.json
Error: can't unmarshal Any nested proto *types.MsgLendingMarketProposal: unknown field "Authority" in types.MsgLendingMarketProposal: tx parse error
If you could provide a PoC code or script demonstrating that the attack scenario you mentioned is possible within this context/audit target code, we would be able to reconsider our assessment. |
I see what you mean, at the very least there is #8 that prevents sending direct messages to the Govshuttle module to bypass the governance. I agree with you, an attack would need to pass a governance proposal, which makes it a low risk scenario. |
3docSec changed the severity to QA (Quality Assurance) |
3docSec marked the issue as grade-b |
Lines of code
https://github.com/code-423n4/2024-05-canto/blob/main/canto-main/x/govshuttle/keeper/msg_server.go#L30
https://github.com/code-423n4/2024-05-canto/blob/main/canto-main/x/govshuttle/keeper/msg_server.go#L48
Vulnerability details
Impact
GovShuttle module misses validation for duplicate propId which might result in a proposal being rewritten and funds stolen.
Summary
An attacker waits before a valid proposal is approved. After approval they can rewrite it using the govshuttle with any target contract, data and value. Since govshuttle is an admin of other contracts this will allow an attacker to steal funds and become an admin of any contract controlled by the module.
Recommended Mitigation Steps
Make sure to check fail if a proposal already exists before calling
AppendLendingMarketProposal
.Affected lines:
https://github.com/code-423n4/2024-05-canto/blob/main/canto-main/x/govshuttle/keeper/msg_server.go#L30
https://github.com/code-423n4/2024-05-canto/blob/main/canto-main/x/govshuttle/keeper/msg_server.go#L48
Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: