Amino legacy signing method broken because of name mismatch
Several Amino type names registered in Go code did not match the amino.name options in the protobuf definitions, so the legacy Amino codec could not find the interface and would fail to encode or decode those messages. This could break legacy signing and transaction handling for the affected message types.
Submitted by Franfran
The LegacyAmino codec is used for legacy reasons. Even if this codec is in the process of being deprecated for gogoprotobuf, it’s still relevant and if not implemented correctly, it won’t work correctly. Here is the implementation of the RegisterConcrete method to register the amino methods:
// This function should be used to register concrete types that will appear in
// interface fields/elements to be encoded/decoded by go-amino.
// Usage:
// `amino.RegisterConcrete(MyStruct1{}, "com.tendermint/MyStruct1", nil)`
func (cdc *Codec) RegisterConcrete(o interface{}, name string, copts *ConcreteOptions) {
As explained in the docs comment, it should be used to register concrete types for the interface. The name should match the amino.name options in the protobuf messages or it won’t be able to find the interface and won’t be able to encode/decode messages. Here are the places where the name is mismatched.
The RegisterAminoMsg can also be called which adds a check on the length of the input. However, it has not been found that any name exceeds this length of 39 characters. As a recommendation, the RegisterAminoMsg is preferred.
MiniEVM
-
Missing
option (amino.name) = "evm/MsgUpdateParams":
MiniWASM
-
option (amino.name) = "move/MsgUpdateParams", should change to"tokenfactory/MsgUpdateParams":
Initia
-
option (amino.name) = "move/MsgWhitelist", should change to"move/MsgDelist": -
cdc.RegisterConcrete(Params{}, "ibchooks/Params", nil), should change to"ibc-hooks/Params"(and possibly rename the directoryibchooksof the proto files toibc-hooks): -
option (amino.name) = "mstake/StakeAuthorization", should change to"mstaking/StakeAuthorization": -
Validators allow_list = 2 [(amino.oneof_name) = "mstake/StakeAuthorization/AllowList"], should change to"mstaking/StakeAuthorization/AllowList": -
Validators deny_list = 3 [(amino.oneof_name) = "mstake/StakeAuthorization/DenyList"], should change to"mstaking/StakeAuthorization/DenyList":
Recommended mitigation steps
Make sure that the amino names are matching.
hoon (Initia) confirmed and commented:
Fixed amino.
Status: Mitigation confirmed. Full details in reports from berndartmueller, 0xAlix2 and Franfran.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The Amino registration names in the Go codec files did not match the amino.name values declared in the protobuf files.
Impact
Legacy Amino encoding and decoding of the affected messages would fail, which could break legacy signing and transaction processing for those types.
What the attacker needed
Legacy Amino codec in use; affected message types
The fix
The amino names were made to match, and the project confirmed the issue was fixed in the referenced commits.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Amino is an older way of turning structured data into bytes and back. Each message type must be registered under exactly the same name in two places; if the names differ, the system cannot recognise the message and encoding or decoding fails. Here several names were spelled differently in the two places.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.