-
Notifications
You must be signed in to change notification settings - Fork 22
Description
copying related conversation
Hey Dymension team, while I was looking at open source projects, I noticed that the rollapp-wasm which uses the dymension-rdk, contains an ante handler responsible for essentially preventing IBC messages from received if not sent by a whitelisted relayer.
I was looking into this because rollapps use ibc-go v6.3.0 and there was a critical security advisory that likely affected certain deployed rollapps (GHSA-jg6f-48ff-5xrw) and I also saw that you previously asked for a scope request and I think the issues we will outline coincide with the same areas.
TheAnteHandlerpreventing IBC messages would prevent the exploitation of the known critical issue, though with a little bit of dive, I found a way to bypass the IBC message filtering.
Cosmwasm comes with a functionality known as stargate which allows cosmwasm contracts to dispatch protobuf encoded Cosmos-SDK messages. A contract can skip the ante handlers with the following logic:
#[cfg_attr(not(feature = "library"), entry_point)]
pub fn execute(
_deps: DepsMut,
_env: Env,
_info: MessageInfo,
msg: ExecuteMsg,
) -> Result<Response, StdError> {
match msg {
ExecuteMsg::Any { type_url, value } => {
let msg: CosmosMsg = CosmosMsg::Stargate {
type_url,
value: Binary::from_base64(&value)?,
};
Ok(Response::new().add_message(msg))
}
}
}