Skip to content
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

p-tsanev - TelcoinDistributor.sol - Pausing the contract would disable challenging transactions #24

Closed
sherlock-admin opened this issue Jan 15, 2024 · 17 comments
Assignees
Labels
Escalation Resolved This issue's escalations have been approved/rejected Non-Reward This issue will not receive a payout Sponsor Confirmed The sponsor acknowledged this issue is valid Will Fix The sponsor confirmed this issue will be fixed

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Jan 15, 2024

p-tsanev

medium

TelcoinDistributor.sol - Pausing the contract would disable challenging transactions

Summary

The TelcoinDistributor contract allows for the proposal, execution and challenging(cancellation) of transactions. It also introduces pausing functionality, probably to deal with external integration pausing and as a security measure. This functionality can give unfair advantage to proposers.

Vulnerability Detail

The functions for executing and creating proposals are correctly safe-guarded with the whenNotPaused modifier, stopping the creation and execution of proposals. But an unfair advantage is created because the challengeTransaction function has the whenNotPaused modifier as well.
Depending the the duration of the pause it is highly possible for proposals created before the pause, either intentionally via front-running or accidentally, to pass their challenge period, giving council members no way to challenge. Thus creating an unfair advantage during the pause and potentially allowing malicious/unfavorable transactions to reach execution.

Impact

Unfair advantage during pause, potential stealing of funds from the owner() due to inability to challenge proposal

Code Snippet

https://github.com/sherlock-audit/2024-01-telcoin/blob/main/telcoin-audit/contracts/protocol/core/TelcoinDistributor.sol#L115-L136

Tool used

Manual Review

Recommendation

Remove the whenNotPaused modifier from the challengeTransaction function.

@amshirif amshirif self-assigned this Jan 16, 2024
@amshirif amshirif added Medium A valid Medium severity issue Sponsor Disputed The sponsor disputed this issue's validity Will Fix The sponsor confirmed this issue will be fixed Reward A payout will be made for this issue labels Jan 16, 2024
@amshirif
Copy link

@sherlock-admin2
Copy link
Contributor

1 comment(s) were left on this issue during the judging contest.

takarez commented:

invalid because { This is invalid due to the fact that sherlokc's rule number 5 stated that "Pausing a collateral causes some users to be unfairly liquidated or any other action causing loss of funds. This is not considered a valid issue."}

@sherlock-admin2 sherlock-admin2 changed the title Joyful Pine Mockingbird - TelcoinDistributor.sol - Pausing the contract would disable challenging transactions p-tsanev - TelcoinDistributor.sol - Pausing the contract would disable challenging transactions Jan 29, 2024
@sherlock-admin2 sherlock-admin2 added the Reward A payout will be made for this issue label Jan 29, 2024
@0xMR0
Copy link

0xMR0 commented Jan 30, 2024

Escalate

This is invalid issue. The contract can only be paused by owner of contract and the owner is trusted.

Is the admin/owner of the protocol/contracts TRUSTED or RESTRICTED?

TRUSTED

Even if the external integration is considered, Pausing of contract is acceptable to protocol team,

In case of external protocol integrations, are the risks of external contracts pausing or executing an emergency withdrawal acceptable? If not, Watsons will submit issues related to these situations that can harm your protocol's functionality.

Acceptable

Let me highlight Sherlock rules for trusted admin resulting in invalid issues,

Protocol admin is considered to be trusted in most cases, hence issues where . . . .

  1. An admin action can break certain assumptions about the functioning of the code. Example: Pausing a collateral causes some users to be unfairly liquidated or any other action causing loss of funds. This is not considered a valid issue.

Since, admin is trusted and it is expected from admin that before pausing the contract, all council members would be notified via some medium and it can be further assumed that all pending proposal would be executed before pausing the contract and there is no such issue can happen except malicious owner purposefully allows it council members.

I think, the issue could be valid if the admin was restricted with specific mention of pausing the contract in contest readme.md.

Feel free to correct, if i am missing something.

@sherlock-admin
Copy link
Contributor Author

Escalate

This is invalid issue. The contract can only be paused by owner of contract and the owner is trusted.

Is the admin/owner of the protocol/contracts TRUSTED or RESTRICTED?

TRUSTED

Even if the external integration is considered, Pausing of contract is acceptable to protocol team,

In case of external protocol integrations, are the risks of external contracts pausing or executing an emergency withdrawal acceptable? If not, Watsons will submit issues related to these situations that can harm your protocol's functionality.

Acceptable

Let me highlight Sherlock rules for trusted admin resulting in invalid issues,

Protocol admin is considered to be trusted in most cases, hence issues where . . . .

  1. An admin action can break certain assumptions about the functioning of the code. Example: Pausing a collateral causes some users to be unfairly liquidated or any other action causing loss of funds. This is not considered a valid issue.

Since, admin is trusted and it is expected from admin that before pausing the contract, all council members would be notified via some medium and it can be further assumed that all pending proposal would be executed before pausing the contract and there is no such issue can happen except malicious owner purposefully allows it council members.

I think, the issue could be valid if the admin was restricted with specific mention of pausing the contract in contest readme.md.

Feel free to correct, if i am missing something.

You've created a valid escalation!

To remove the escalation from consideration: Delete your comment.

You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.

@sherlock-admin2 sherlock-admin2 added the Escalated This issue contains a pending escalation label Jan 30, 2024
@0xLogos
Copy link

0xLogos commented Jan 30, 2024

I would like to say that it can be mitigated by admin by waiting malicious transaction to expire in paused state. I think it should remain medium if 1. waiting for expiration is not acceptable (maybe too long) or 2. expiration of other legitimate transactions is not acceptable

@0xMR0 council member can be malicious

all council members would be notified via some medium and it can be further assumed that all pending proposal would be executed before pausing the contract

@PlamenTSV
Copy link

Escalate
Admin does not need to be untrusted. Even if he notifies the council members for the pause, it in no way stops a malicious council member from submitting a malicious proposal that CANNOT be challenged (via front-running). The admin assumption when pausing would be that even if he did, malicious proposals could be challenged but they CANNOT be. An admin cannot know which proposals are malicious before pausing.
Yet another issue that is fixed by the team, I am fairly certain you are wasting your escalation.

@sherlock-admin
Copy link
Contributor Author

Escalate
Admin does not need to be untrusted. Even if he notifies the council members for the pause, it in no way stops a malicious council member from submitting a malicious proposal that CANNOT be challenged (via front-running). The admin assumption when pausing would be that even if he did, malicious proposals could be challenged but they CANNOT be. An admin cannot know which proposals are malicious before pausing.
Yet another issue that is fixed by the team, I am fairly certain you are wasting your escalation.

You've created a valid escalation!

To remove the escalation from consideration: Delete your comment.

You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.

@nevillehuang
Copy link
Collaborator

nevillehuang commented Jan 31, 2024

This should remain medium severity based off @0xLogos comments. He brought up really good points, but you can see that point 1 directly contradicts with point 2. Waiting for too long will cause legitimate proposals to be unfairly excluded too, and then the same situation can happen again when a pause is again executed (be it accidental or on purpose proposal proposed before pause is invoked), so to me this breaks core contract functionality, because you cannot make sure that all of the legitimate proposals are executed while waiting for expiration.

Although pausing is a sensitive and rare situation, because this directly undermines the execution of legitimate proposals and possibly even allow malicious proposals to go through, I believe this warrants medium severity.

@amshirif
Copy link

I agree with @nevillehuang

@0xMR0
Copy link

0xMR0 commented Feb 1, 2024

Respectfully disagree with above comments.

  1. The scenario mentioned in above comments is only possible when contract pause period is greater than challenge period which is highly unlikely to happen. If i remember correctly, the sponsor had confirmed the challenge period would be between 3 days to 7 days in public discord channel. So considering both point of 0xlogos, it means the contract pause period would be more than 3/7 days which i believe not going to happen as the protocol wont pause the contract for more than 1 day since pausing the contract is rare and highly likely only in emergency condition. Another reason, the protocol wont pause contract longer otherwise legitimate proposals wont be created and executed.

  2. Council members are semi trusted, either they can pass malicious proposals or legitimate proposals or they can even challenge all proposals so its upto the community to decide what they want. Therefore, saying malicious proposals would be passed due to pause of contract is void here.

  3. Admin/owner actions are trusted for this audit which means admin understand good enough the implication of pausing the contract more than the challenge period, Therefore, i believe the contract pause will always be less than the challenge period. The admin/owner can pause or unpause the contract anytime. This trusted admin rule at sherlock also make the issue invalid.

While i agree, the issue could be low severity but its invalid at sherlock. I would agree with @Czar102 final judgment on this issue without further arguments.

@PlamenTSV
Copy link

Respectfully disagree with the above comment:

  1. You are basing you argument on the assumption how long the pause will be, thus your argument is pretty much void. Sponsor comments do not hold as a source of truth and for as far as we know, the pause could be a long one depending on the emergency that caused it.
  2. Council members are semi-trusted and can be forcefully removed when malicious activity is detected. The idea is they are unable to execute it, which is not the case here since there is a viable and real possible scenario in which they can do so, THAT'S CONFIRMED BY THE SPONSOR AND FIXED (a hint not to discuss this further)
  3. Trusted admin has nothing to do with the issue, you can not determine how, when and why the contract would be paused in case of an emergency and for how long that would be until the problem the pause was initiated for was resolved. I trust the admin he would not pause the contract for his own benefit, I do not trust the other council members they would not exploit this pause. And now they can't.
    All of your arguments are null at this points, the sponsors and lead judge confirm the issue, while still abiding for the same rules you non-stop link. We will wait on the final judgement, end of discussion.

@nevillehuang
Copy link
Collaborator

nevillehuang commented Feb 2, 2024

Agree with @PlamenTSV the points made by @0xMR0 are simply assumptions and too dangerous, especially point 2, semi trusted does not mean they can decide whatever they want. This is why a challenge mechanism exists in the first place and should be applied consistently, be it in a paused state or not.

@Evert0x
Copy link

Evert0x commented Feb 13, 2024

I don't believe this issue should be rewarded.

I believe it's a design choice to pause the challengeTransaction function. The admin is trusted to use this functionality in the best interest of the protocol.

This issue illustrates a scenario where pausing the challengeTransaction function is a bad thing. But it could also be a good thing in case there is a security accident which can only be mitigated by pausing this function.

I believe this language applies

An admin action can break certain assumptions about the functioning of the code. Example: Pausing a collateral causes some users to be unfairly liquidated or any other action causing loss of funds. This is not considered a valid issue.

@Evert0x Evert0x closed this as completed Feb 14, 2024
@Evert0x Evert0x removed the Medium A valid Medium severity issue label Feb 14, 2024
@sherlock-admin sherlock-admin added Non-Reward This issue will not receive a payout and removed Reward A payout will be made for this issue labels Feb 14, 2024
@Evert0x
Copy link

Evert0x commented Feb 14, 2024

Result:
Invalid
Has Duplicates

@sherlock-admin2
Copy link
Contributor

sherlock-admin2 commented Feb 14, 2024

Escalations have been resolved successfully!

Escalation status:

@sherlock-admin sherlock-admin removed the Escalated This issue contains a pending escalation label Feb 14, 2024
@sherlock-admin2 sherlock-admin2 added Escalation Resolved This issue's escalations have been approved/rejected and removed Has Duplicates A valid issue with 1+ other issues describing the same vulnerability labels Feb 14, 2024
@sherlock-admin
Copy link
Contributor Author

The protocol team fixed this issue in PR/commit https://github.com/telcoin/telcoin-audit/pull/29.

@sherlock-admin
Copy link
Contributor Author

The Lead Senior Watson signed-off on the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Escalation Resolved This issue's escalations have been approved/rejected Non-Reward This issue will not receive a payout Sponsor Confirmed The sponsor acknowledged this issue is valid Will Fix The sponsor confirmed this issue will be fixed
Projects
None yet
Development

No branches or pull requests

8 participants