Submitted by DadeKuma, also found by NPCsCorp, MrPotatoMagic, SBSecurity, deth, nmirchev8, Tendency, ether_sky, Kow, haxatron, EV_om, 0xJaeger, ZdravkoHr, Giorgio, Soliditors, Aamir, Eeyore, Inference, and kutugu
https://github.com/decentxyz/decent-bridge/blob/7f90fd4489551b69c20d11eeecb17a3f564afb18/src/DecentEthRouter.sol#L101-L105 
https://github.com/decentxyz/decent-bridge/blob/7f90fd4489551b69c20d11eeecb17a3f564afb18/src/DecentBridgeExecutor.sol#L63
When the DecentBridgeExecutor._executeWeth/_executeEth target call fails, a refund is issued to the from address.
However, this address is wrongly set, so those refunds will be permanently lost.
UTB.bridgeAndExecute (Link) calls DecentBridgeAdapter.bridge (Link), which calls DecentEthRouter.bridgeWithPayload (Link), where the payload is constructed (Link):
Inside _getCallParams the from address is the msg.sender, i.e. the DecentBridgeAdapter address on the source chain (Link):
After the payload is constructed, DecentEthRouter sends the message:
Finally, on the destination chain, DecentEthRouter will receive the message (Link):
At the end of this function, the executor is invoked with the same _from address:
Finally, this is the execute function in DecentBridgeExecutor (Link):
Both _executeWeth and _executeEth have the same issue and funds will be lost when the target call fails, for example _executeEth (Link):
Now, DecentBridgeAdapter as a refund address seems wrong, as I disclosed in another issue, but lets suppose that it isnt, as its possible to prove both scenarios.
As proof by contradiction, funds should be sent to DecentBridgeAdapter, and this would be a non-issue if these contracts are deployed with CREATE2, as they would have the same address. But they are not deployed like that.
There is hard evidence that they have different addresses, for example, these are the addresses for DcntEth and DecentEthRouter in two different chains, which are already deployed:
If we take a look at the deploy script for DecentBridgeAdapter it also doesnt use CREATE2, as there isnt a factory:
So these funds will be sent to a random address in any case.
The executor.execute call in DecentEthRouter.onOFTReceived should be changed to an appropriate address (e.g. the user refund address) instead of using _from:
0xsomeone (Judge) commented:
wkantaros (Decent) confirmed
