Anyone can grief the Socket-DL protocol by calling registerSwitchBoard() for all available potential Switchboards and potential Slugs.
Estimated to have a severity of Medium because it fits in: Damage to users/protocol due to griefing
- Retrieve the deployed
Switchboardson a chain - Determine
chain idswhere theSocket-DL procotolmight be deployed in the future, for example via https://chainlist.org/ - Assume
Slugsare the same aschain ids, which seems to be the case so far - Call
registerSwitchBoard()for all theSwitchboardsandchain idswith undesirable values formaxPacketLength_andcapacitorType_. - Once the
Socketteam wants to deploy to a new chain, theSwitchBoardis already registered and can't be registered again. As there are multiplecapacitorType_s, the wrong one might be deployed. Also themaxPacketLength_is probably not as wanted.
Possible solutions:
- allow multiple
capacitorsfor aswitchboard - check that
maxPacketLength_is valid for the specific capacitor - make the function
registerSwitchBoard()permissioned - have a permissioned way to undo the
registerSwitchBoard()
New deployments can't be made for new chains with the present Switchboards.
A workaround would be to deploy new Switchboards and take care an attacker doesn't front run by calling registerSwitchBoard() again.
Another workaround would be to use alternative values for Slugs, but that might be confusing.
Here is the code for registerSwitchBoard():
SocketConfig.sol#L82-L121
function registerSwitchBoard(
address switchBoardAddress_,
uint256 maxPacketLength_,
uint32 siblingChainSlug_,
uint32 capacitorType_ ) ... {
if (
address(capacitors__[switchBoardAddress_][siblingChainSlug_]) !=
address(0)
) revert SwitchboardExists();
(
ICapacitor capacitor__,
IDecapacitor decapacitor__
) = capacitorFactory__.deploy(
capacitorType_,
siblingChainSlug_,
maxPacketLength_
);
capacitorToSlug[address(capacitor__)] = siblingChainSlug_;
capacitors__[switchBoardAddress_][siblingChainSlug_] = capacitor__;
decapacitors__[switchBoardAddress_][siblingChainSlug_] = decapacitor__;
ISwitchboard(switchBoardAddress_).registerCapacitor(...);
...
}