# Validator Node Compromize Analysis

**URL:** <https://forum.cosmos.network/t/validator-node-compromize-analysis/2321>\
**Category:** Tendermint\
**Created:** [June 16, 2019, 8:55am UTC](https://forum.cosmos.network/t/validator-node-compromize-analysis/2321 "2019-06-16T08:55:50Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![unicorn](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.cosmos.network/unicorn/32/612_2.png) [@unicorn](https://forum.cosmos.network/u/unicorn)\
**Post date:** [June 16, 2019, 8:55am UTC](https://forum.cosmos.network/t/validator-node-compromize-analysis/2321/1 "2019-06-16T08:55:50Z")

</div>

We are currently evaluating the KMS softsign component for production use. Softsign has some good properties compared to a HSM. However, some risk analysis is required beforehand.

**Assumptions**  
Let’s assume

1. we have a sentry architecture with a KMS component,
2. an adversary has taken over the validator node, and
3. that the operator key is completely offline and not accessible by the attacker.

**Implications**  
The adversary is able to send arbitrary commands to the KMS; e.g. SignVote, SignProposal and so on. As an effect, the adversary might be able to conduct a double-signing attack and therefore slash the validator.

**Remediation Ideas**

1. Once the operator detects the attack, he should be able to put the validator into the inactive set on a voluntary basis (fees should be imposed anyhow)
2. Afterwards, the operator should be able to change the validator keys, otherwise the validator cannot recover from attacks at all (in case the validator key has been accessed by the adversary)

What do you think?

---

<div class="post-metadata">

**Author:** ![mdyring](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@mdyring](https://forum.cosmos.network/u/mdyring)\
**Post date:** [June 16, 2019, 9:04am UTC](https://forum.cosmos.network/t/validator-node-compromize-analysis/2321/2 "2019-06-16T09:04:48Z")

</div>

The KMS prevents double signing as it will only sign for higher (Height, Round, Step).

I would also suggest using a HSM such as YubiHSM. It is fairly easy to setup and create a wrapped export of the secret key.

---

<div class="post-metadata">

**Author:** ![unicorn](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.cosmos.network/unicorn/32/612_2.png) [@unicorn](https://forum.cosmos.network/u/unicorn)\
**Post date:** [June 16, 2019, 9:11am UTC](https://forum.cosmos.network/t/validator-node-compromize-analysis/2321/3 "2019-06-16T09:11:36Z")

</div>

I don’t see any benefits when using a HSM over softsign when it comes to double-voting. Since gaiad sends commands to KMS (and therefore to softsign or HSM) it is easily possible to cause double-voting and slashing.

HSMs are dumb 🙂

---

<div class="post-metadata">

**Author:** ![mdyring](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@mdyring](https://forum.cosmos.network/u/mdyring)\
**Post date:** [June 16, 2019, 9:32am UTC](https://forum.cosmos.network/t/validator-node-compromize-analysis/2321/4 "2019-06-16T09:32:11Z")

</div>

There are a number of best practices around KMS that makes double signing highly unlikely:

You would typically run the KMS process on a different, locked down host from the validator. The KMS connects to the validator process, so outbound connection to validator. It then signs request from the validator, but only those that would _not_ result in double signing.

This double signing prevention is implemented in tmkms software but also runs in Ledger devices (not YubiHSM).

---

<div class="post-metadata">

**Author:** ![unicorn](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.cosmos.network/unicorn/32/612_2.png) [@unicorn](https://forum.cosmos.network/u/unicorn)\
**Post date:** [June 16, 2019, 9:54am UTC](https://forum.cosmos.network/t/validator-node-compromize-analysis/2321/5 "2019-06-16T09:54:47Z")

</div>

Good points, we are going to do some security testing around the double signing prevention in the KMS. I don’t see how HSMs are able to detect double signing.

---

<div class="post-metadata">

**Author:** ![mdyring](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@mdyring](https://forum.cosmos.network/u/mdyring)\
**Post date:** [June 16, 2019, 10:01am UTC](https://forum.cosmos.network/t/validator-node-compromize-analysis/2321/6 "2019-06-16T10:01:00Z")

</div>

The Ledger app prevents double-signing inside try\_state\_transition():

> <https://github.com/tendermint/ledger-validator-app/blob/bee890e5ccc7e98b8a2a8ce30db00cbe9b5fc2bf/src/app_main.c#L207>

---

<div class="post-metadata">

**Author:** ![unicorn](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.cosmos.network/unicorn/32/612_2.png) [@unicorn](https://forum.cosmos.network/u/unicorn)\
**Post date:** [June 16, 2019, 10:34am UTC](https://forum.cosmos.network/t/validator-node-compromize-analysis/2321/7 "2019-06-16T10:34:07Z")

</div>

[https://github.com/tendermint/ledger-validator-app/blob/bee890e5ccc7e98b8a2a8ce30db00cbe9b5fc2bf/src/lib/vote\_fsm.c#L19](https://github.com/tendermint/ledger-validator-app/blob/bee890e5ccc7e98b8a2a8ce30db00cbe9b5fc2bf/src/lib/vote_fsm.c#L19) it’s rather a sanity than a security check. Quickly double vote twice will bypass this check

---

<div class="post-metadata">

**Author:** ![mdyring](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@mdyring](https://forum.cosmos.network/u/mdyring)\
**Post date:** [June 16, 2019, 10:55am UTC](https://forum.cosmos.network/t/validator-node-compromize-analysis/2321/8 "2019-06-16T10:55:54Z")

</div>

I disagree. This happens serially/sequentially over USB, there is no parallelism. It can’t be bypassed by timing.

State is updated here:

> <https://github.com/tendermint/ledger-validator-app/blob/bee890e5ccc7e98b8a2a8ce30db00cbe9b5fc2bf/src/lib/vote_fsm.c#L58>

---

<div class="post-metadata">

**Author:** ![unicorn](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.cosmos.network/unicorn/32/612_2.png) [@unicorn](https://forum.cosmos.network/u/unicorn)\
**Post date:** [June 16, 2019, 7:39pm UTC](https://forum.cosmos.network/t/validator-node-compromize-analysis/2321/9 "2019-06-16T19:39:15Z")

</div>

Thanks for the great feedback. This is a very interesting topic. However, I suppose KMS should do the same check, as well. I am still in learning mode and trying to get into details

---

<div class="post-metadata">

**Author:** ![mdyring](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@mdyring](https://forum.cosmos.network/u/mdyring)\
**Post date:** [June 17, 2019, 8:29pm UTC](https://forum.cosmos.network/t/validator-node-compromize-analysis/2321/10 "2019-06-17T20:29:13Z")

</div>

Similarly to Ledger, the tmkms service itself does a similar check. As you can see in the config it stores state files for each chain, which contains last signed height etc.

---

<div class="post-metadata">

**Author:** ![jleni](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.cosmos.network/jleni/32/431_2.png) [@jleni](https://forum.cosmos.network/u/jleni)\
**Post date:** [June 18, 2019, 2:17pm UTC](https://forum.cosmos.network/t/validator-node-compromize-analysis/2321/11 "2019-06-18T14:17:30Z")

</div>

Correct @mdyring. It should not be possible to skip the check or to double sign. The ledger app keeps tracking the last vote. Ledger devices needs to reply before getting another request. There are no threads or possible race conditions… before signing the state is updated.

I am always open to hear about proof-of-concept for exploits and/or interesting analyses. Nevertheless, I think it is responsible to avoid claims about security issues without strong support, otherwise, this may mislead/confuse users.

---

<div class="post-metadata">

**Author:** ![jleni](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.cosmos.network/jleni/32/431_2.png) [@jleni](https://forum.cosmos.network/u/jleni)\
**Post date:** [June 18, 2019, 2:27pm UTC](https://forum.cosmos.network/t/validator-node-compromize-analysis/2321/12 "2019-06-18T14:27:29Z")

</div>

Said all this, @unicorn Please! if you guys actually find anything interesting, we invite you to submit to the bounty program here: [https://hackerone.com/tendermint](https://hackerone.com/tendermint)  
It is always good to hear about aspects that we might have overseen!

---

<div class="post-metadata">

**Author:** ![unicorn](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.cosmos.network/unicorn/32/612_2.png) [@unicorn](https://forum.cosmos.network/u/unicorn)\
**Post date:** [June 18, 2019, 11:01pm UTC](https://forum.cosmos.network/t/validator-node-compromize-analysis/2321/13 "2019-06-18T23:01:23Z")

</div>

Sorry for the misunderstanding. There is no security issue to report right now. However, we are about to start fuzzing and real security analysis with respect to KMS … however, only if we will not drop out of the validator set 🤯
