_msgSender() fails to return the transaction's sender when msg.sender == address(this)
MembershipFactory._msgSender() should return the EOA address of the function caller when msg.sender == address(this), but this is not correct because everything it does is return the last 20 bytes of msg.data, which is expected to be the mentioned address but will never be.
This happens because if a low level call is done, the context changes to the own call, and so does the msg.data. Therefore, when joinDAO() or upgradeTier() are called with msg.data == address(this), _msgSender returns tierIndex and fromTierIndex params respectively.
See PoC below.
_msgSender() does not work as expected and does not return the expected address when msg.data == address(this), making joinDAO() or upgradeTier() revert in this cases.
Remix, Manual review
PoC
The utility of the _msgSender() function is not very clear, but if it expects to return the EOA which called the function, simply return tx.origin.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.