Skip to content

hermes-agent [ Crypto ] Fix tx.origin phishing vulnerability in GovernanceToken delegation#5895

Closed
KK88100 wants to merge 1 commit into
UnsafeLabs:mainfrom
KK88100:fix/governancetoken-msg-sender-912-1780279624
Closed

hermes-agent [ Crypto ] Fix tx.origin phishing vulnerability in GovernanceToken delegation#5895
KK88100 wants to merge 1 commit into
UnsafeLabs:mainfrom
KK88100:fix/governancetoken-msg-sender-912-1780279624

Conversation

@KK88100
Copy link
Copy Markdown

@KK88100 KK88100 commented Jun 1, 2026

Issue

Closes #912

Summary

Replaced all tx.origin authorization checks with msg.sender in delegateVote and revokeDelegate. Replaced tx.origin == admin in snapshot() with onlyOwner modifier from OpenZeppelin Ownable. Added zero-address guards and a phishing test that verifies a malicious contract cannot delegate votes on behalf of users who interact with it.

Acceptance Criteria

  • No usage of tx.origin remains in the contract
  • All authorization checks use msg.sender
  • onlyOwner modifier protects admin functions (snapshot)
  • Delegated voting still works correctly through legitimate contract interactions
  • Added a test that deploys a phishing contract and verifies it cannot delegate votes
  • Existing governance proposal and voting tests pass unchanged
  • Included .attribution.json

Tests

Tests added in solidity/test/GovernanceToken.t.sol using Foundry:

  • test_DelegateVoteUsesMsgSender
  • test_PhishingCannotDelegateOthers
  • test_RevokeDelegateUsesMsgSender
  • test_SnapshotOnlyOwner
  • test_DelegateToSelfRejected
  • test_DelegateVoteRevertsForZeroAddress
  • test_GovernanceProposalAndVoting

Payment address (USDT TRC20): TXjaadYhD579e3bCWKnRFKjRq9RZQL7WNj

…n auth

- Replace all tx.origin checks with msg.sender in delegateVote and revokeDelegate
- Add Ownable for snapshot() admin function instead of tx.origin check
- Add require(msg.sender != address(0)) and require(to != address(0)) guards
- Add phishing test verifying malicious contract cannot delegate others' votes
- Add Foundry tests covering all acceptance criteria

Closes UnsafeLabs#912
@KK88100
Copy link
Copy Markdown
Author

KK88100 commented Jun 1, 2026

Payment address for bounty (USDT TRC20): TXjaadYhD579e3bCWKnRFKjRq9RZQL7WNj

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Unfortunately the changes in this PR didn't fully resolve the issue. Please rework your solution and submit a new pull request.

Make sure to review the acceptance criteria in the linked issue and verify all conditions are met before resubmitting. See CONTRIBUTING.md for guidelines.

@github-actions github-actions Bot closed this Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ Crypto ] Fix tx.origin phishing vulnerability in GovernanceToken delegation

1 participant