Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cc: fix ed25519 signatures malleability #632

Merged
merged 4 commits into from
Oct 3, 2024
Merged

Conversation

DeckerSU
Copy link

@DeckerSU DeckerSU commented Oct 2, 2024

cc: fix ed25519 signatures malleability

Actually, the current CC code doesn’t use Ed25519 signatures, so CVE-2024-45193 has no impact on Komodo (KMD) or any existing assetchains. However, since CC could potentially use these types of signatures in the future (e.g., for newly developed CCs), we’ve added a 0 <= s < L check to prevent signature malleability.

Tests: afcb471

Before changes:

testing signature malleability
Signature:
0f 03 c0 e6 2c 38 ed 29
48 26 93 38 07 4a 25 f7
75 e1 db ce 6f 7d da 02
c6 c3 fd da 4c 7d d4 6b
bb f9 d4 06 5b fe 1f ff
34 1f 93 6d 7e ab 2b b5
a9 4a 88 23 3d 8f 7f 92
e2 3c 44 6b 7d 94 8e 07
valid signature
Modified signature:
0f 03 c0 e6 2c 38 ed 29
48 26 93 38 07 4a 25 f7
75 e1 db ce 6f 7d da 02
c6 c3 fd da 4c 7d d4 6b
a8 cd ca 63 75 61 32 57
0b bc 8a 10 5d a5 0a ca
a9 4a 88 23 3d 8f 7f 92
e2 3c 44 6b 7d 94 8e 17
valid signature

After changes:

testing signature malleability
Signature:
d7 08 b2 73 a3 41 95 7f
43 22 a6 47 48 dd 1a f9
9d f3 03 46 0b 06 e4 a0
ef 17 c9 bd 38 5b 95 49
d1 02 d8 bb 8a eb af 81
d6 28 db 15 2f e2 92 7a
d5 ad ae 7b 8c 2b df f8
7f d8 4b a8 18 3f 60 05
valid signature
Modified signature:
d7 08 b2 73 a3 41 95 7f
43 22 a6 47 48 dd 1a f9
9d f3 03 46 0b 06 e4 a0
ef 17 c9 bd 38 5b 95 49
be d6 cd 18 a5 4e c2 d9
ac c5 d2 b8 0d dc 71 8f
d5 ad ae 7b 8c 2b df f8
7f d8 4b a8 18 3f 60 15
invalid signature

TODO:

  • Test all CC-enabled chains to ensure they are perfectly synced from scratch with the new changes.
  • CCL
  • CLC
  • DOC
  • ILN
  • MARTY

- #630
- https://soatok.blog/2024/08/14/security-issues-in-matrixs-olm-library/#vuln-ed25519

Actually, the current CC code doesn’t use Ed25519 signatures, so `CVE-2024-45193` has no impact on Komodo (KMD) or any existing assetchains. However, since CC could potentially use these types of signatures in the future (e.g., for newly developed CCs), we’ve added a `0 <= s < L` check to prevent signature malleability.
@DeckerSU DeckerSU requested review from dimxy and smk762 October 2, 2024 15:01
@DeckerSU DeckerSU linked an issue Oct 2, 2024 that may be closed by this pull request
using a signed integer type (int) is preferable here,
to avoid potential issues with unsigned underflow.
dimxy
dimxy previously approved these changes Oct 2, 2024
Copy link
Collaborator

@dimxy dimxy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DeckerSU
Copy link
Author

DeckerSU commented Oct 2, 2024

Tested and merged in KomodoOcean codebase, we should do the same here.

@DeckerSU DeckerSU requested a review from dimxy October 3, 2024 05:19
Copy link
Collaborator

@dimxy dimxy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DeckerSU DeckerSU merged commit 956650e into dev Oct 3, 2024
18 checks passed
@DeckerSU DeckerSU deleted the patch-cc-ed25519-verify branch October 5, 2024 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants