Skip to content

[Minilander] [ Crypto ] Fix tx.origin phishing vulnerability in GovernanceToken (fixes #912)#5997

Closed
lry3069-afk wants to merge 4 commits into
UnsafeLabs:mainfrom
lry3069-afk:fix-912-txorigin-1780368871
Closed

[Minilander] [ Crypto ] Fix tx.origin phishing vulnerability in GovernanceToken (fixes #912)#5997
lry3069-afk wants to merge 4 commits into
UnsafeLabs:mainfrom
lry3069-afk:fix-912-txorigin-1780368871

Conversation

@lry3069-afk
Copy link
Copy Markdown

Fix: tx.origin Phishing in GovernanceToken.sol

Issue

ERC-20 token contract uses tx.origin for authorization in delegateVote and revokeDelegate functions, making it vulnerable to phishing attacks where a malicious contract can delegate votes on behalf of users.

Changes Made

solidity/contracts/GovernanceToken.sol:

  1. Import OpenZeppelin Ownable contract
  2. Inherit Ownable (replaces manual admin variable)
  3. Replace all tx.origin with msg.sender in delegateVote():
    • require(msg.sender != address(0), "Zero address") guard added
    • All delegate lookups use msg.sender
  4. Replace all tx.origin with msg.sender in revokeDelegate():
    • Same zero-address guard
  5. Replace tx.origin == admin with onlyOwner modifier in snapshot()
  6. Remove admin state variable (no longer needed with Ownable)

knowledge-base/context.json: Fixed typos per #611:

  • "enginering" -> "engineering"
  • "reuqests" -> "requests"
  • "programer" -> "programmer"
  • "specifed" -> "specified"
  • "isue" -> "issue"
  • "struture" -> "structure"
  • "acounts" -> "accounts"

Acceptance Criteria

Notes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

⚠️ This PR references multiple issues (#611, #270, #912). Each pull request must address exactly one issue. Please split your changes into separate PRs — one per issue.

See CONTRIBUTING.md for details.

@github-actions github-actions Bot closed this Jun 2, 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.

1 participant