gnolang / gno

Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + Gno.land: a blockchain for timeless code and fair open-source
https://gno.land/
Other
875 stars 355 forks source link

Cosmos-sdk vulnerability retrospective #587

Open grepsuzette opened 1 year ago

grepsuzette commented 1 year ago

I've been making some researchs these past 2 days on the topic of past vulnerabilities affecting cosmos libraries. I will start a list here (there must be more):

2022-10-07 500M USD Binance hack

2022-10-08 Dragonberry

2022-10-11 Elderflower

Verichain public advisory VSA-2022-100

Verichain public advisory VSA-2022-101, CVE-2023-27575

grepsuzette commented 1 year ago

Some more vulns. We will obviously need a much better method, contact people in the know and access better place than Google, Twitter or exploit-db like as I've been doing now. For instance https://github.com/tendermint/tendermint/security/advisories lists 4 vulns publicly, but there are undisclosed ones from the list above. Also, preventive fixes must not have been listed so we can be vulnerable even in the absence of a listed vuln. Anyway, I still consider this list helpful.

DoS CVE-2019-25072

"Due to support of Gzip compression in request bodies, as well as a lack of limiting response body sizes, a malicious server can cause a client to consume a significant amount of system resources, which may be used as a denial of service vector."

grepsuzette commented 1 year ago

"Lavender" CVE-2020-5303

"Tendermint before versions 0.33.3, 0.32.10, and 0.31.12 has a denial-of-service vulnerability. Tendermint does not limit the number of P2P connection requests. For each p2p connection, it allocates XXX bytes. Even though this memory is garbage collected once the connection is terminated (due to duplicate IP or reaching a maximum number of inbound peers), temporary memory spikes can lead to OOM (Out-Of-Memory) exceptions. Additionally, Tendermint does not reclaim activeID of a peer after it's removed in Mempool reactor. This does not happen all the time. It only happens when a connection fails (for any reason) before the Peer is created and added to all reactors. RemovePeer is therefore called before AddPeer, which leads to always growing memory (activeIDs map). The activeIDs map has a maximum size of 65535 and the node will panic if this map reaches the maximum. An attacker can create a lot of connection attempts (exploiting above denial of service), which ultimately will lead to the node panicking. These issues are patched in Tendermint 0.33.3 and 0.32.10."

grepsuzette commented 1 year ago

"Syringa" CVE-2020-15091

"TenderMint from version 0.33.0 and before version 0.33.6 allows block proposers to include signatures for the wrong block. This may happen naturally if you start a network, have it run for some time and restart it (without changing chainID). A malicious block proposer (even with a minimal amount of stake) can use this vulnerability to completely halt the network. This issue is fixed in Tendermint 0.33.6 which checks all the signatures are for the block with 2/3+ majority before creating a commit."

grepsuzette commented 1 year ago

"Mulberry" CVE-2021-21271

"Tendermint Core v0.34.0 introduced a new way of handling evidence of misbehavior. As part of this, we added a new Timestamp field to Evidence structs. This timestamp would be calculated using the same algorithm that is used when a block is created and proposed. (This algorithm relies on the timestamp of the last commit from this specific block.) In Tendermint Core v0.34.0-v0.34.2, the consensus reactor is responsible for forming DuplicateVoteEvidence whenever double signs are observed. However, the current block is still “in flight” when it is being formed by the consensus reactor. It hasn’t been finalized through network consensus yet. This means that different nodes in the network may observe different “last commits” when assigning a timestamp to DuplicateVoteEvidence. In turn, different nodes could form DuplicateVoteEvidence objects at the same height but with different timestamps. (...)"

grepsuzette commented 1 year ago

Last one, at least for now.

"Alderfly" GHSA-f3w5-v9xx-rp8p


Btw there are other repo to inspect for vuln advisories.

"Tendermint bug bounty program ranks bugs affecting the following libs as Critical:"

https://github.com/tendermint/tendermint
https://github.com/cosmos/iavl
https://github.com/cosmos/cosmos-sdk
https://github.com/iqlusioninc/yubihsm.rs  (Restricted to the ed25519 pubkey and signing paths)
https://github.com/iqlusioninc/tmkms
https://github.com/iqlusioninc/crates/tree/main/signatory  (Restricted to the ed25519 provider sub-crates like dalek-ed25519 and ring)
https://github.com/cosmos/ledger-cosmos
https://github.com/cosmos/gaia
https://github.com/cosmos/ibc-go

Some of them are used in pkgs. I don't want to flood this topic right now.

moul commented 1 year ago

Do you think this is heading in the right direction, @jaekwon, or do you have an alternative plan to address these points?