element-hq / element-hq/element-web

Recovery key : bad MAC for the secret `m.cross_signing.master`

Open
#34,878 0 comments 0 reactions 0 assignees View on GitHub
A-E2EE-Key-Backup O-Uncommon S-Critical T-Defect Team: Crypto
Dominant language
TypeScript
Stars
13.5k
Forks
2.8k
PR merge metrics
PR metrics pending

Description

### Steps to reproduce

This is a bug encounter by a user using Tchap based on element version 1.12.17

1. Where are you starting? What can you see?
When trying to use the recovery key, the UI just shut down after enter. the error in the log indicate bad MAC for the secret `m.cross_signing.master`

### Outcome

#### What did you expect?
Verification to complete
#### What happened instead?
UI shut down and we can see in the log :

```
2026-08-24T07:16:46.659Z D SetupEncryptionToast[verify_this_session]: Primary button clicked: opening SetupEncryptionDialog
2026-08-24T07:16:46.659Z I Removed toast with key 'setupencryption'
2026-08-24T07:16:46.681Z D MatrixChat: handling action aria_hide_main_app
2026-08-24T07:16:47.741Z D SetupEncryptionStore.usePassphrase
2026-08-24T07:16:47.742Z D SecurityManager: enabling 4S key cache
2026-08-24T07:16:47.742Z D SecurityManager: accessSecretStorage: bootstrapCrossSigning
2026-08-24T07:16:47.742Z D SecurityManager: getSecretStorageKey: request for 4S keys [acedd131-7702-4691-9aaa-ade733be93c5] for secret `m.cross_signing.master`: looking for key acedd131-7702-4691-9aaa-ade733be93c5
2026-08-24T07:16:47.742Z D SecurityManager: getSecretStorageKey: prompting user for key abedd131-7502-4691-9aaa-ade733be93c4
2026-08-24T07:16:47.760Z D MatrixChat: handling action aria_hide_main_app
2026-08-24T07:16:59.383Z D FetchHttpApi: <-- GET https://matrix.agent.ssi.tchap.gouv.fr/_matrix/client/v3/sync?filter=xxx&timeout=xxx&org.matrix.msc4222.use_state_after=xxx&since=xxx [16289ms 200]
2026-08-24T07:16:59.386Z D MatrixChat: handling action MatrixActions.Room.receipt
2026-08-24T07:16:59.398Z D FetchHttpApi: --> GET https://matrix.agent.ssi.tchap.gouv.fr/_matrix/client/v3/sync?filter=xxx&timeout=xxx&org.matrix.msc4222.use_state_after=xxx&set_presence=xxx&since=xxx
2026-08-24T07:16:59.403Z D MatrixChat: handling action MatrixActions.sync
2026-08-24T07:17:00.300Z D FetchHttpApi: <-- GET https://matrix.agent.ssi.tchap.gouv.fr/_matrix/client/v3/sync?filter=xxx&timeout=xxx&org.matrix.msc4222.use_state_after=xxx&set_presence=xxx&since=xxx [902ms 200]
2026-08-24T07:17:00.306Z D MatrixChat: handling action MatrixActions.Room.receipt
2026-08-24T07:17:00.317Z D FetchHttpApi: --> GET https://matrix.agent.ssi.tchap.gouv.fr/_matrix/client/v3/sync?filter=xxx&timeout=xxx&org.matrix.msc4222.use_state_after=xxx&set_presence=xxx&since=xxx
2026-08-24T07:17:00.318Z D MatrixChat: handling action MatrixActions.sync
2026-08-24T07:17:05.145Z D SecurityManager: getSecretStorageKey: got key abedd131-7502-4691-9aaa-ade733be93c4 from user
2026-08-24T07:17:05.145Z D SecurityManager: Caching 4S key abedd131-7502-4691-9aaa-ade733be93c4
2026-08-24T07:17:05.145Z E SecurityManager: accessSecretStorage: error during operation Error decrypting secret m.cross_signing.master: bad MAC
Error: Error decrypting secret m.cross_signing.master: bad MAC
at i (https://www.tchap.gouv.fr/bundles/ec4076dd6d33874dccc1/2898.js:2:392521)
at async C.bootstrapCrossSigning (https://www.tchap.gouv.fr/bundles/ec4076dd6d33874dccc1/2343.js:1:14474)
at async re.bootstrapCrossSigning (https://www.tchap.gouv.fr/bundles/ec4076dd6d33874dccc1/2343.js:1:55103)
at async https://www.tchap.gouv.fr/bundles/ec4076dd6d33874dccc1/2898.js:2:1144288
at async T (https://www.tchap.gouv.fr/bundles/ec4076dd6d33874dccc1/2898.js:2:1143504)
at async j (https://www.tchap.gouv.fr/bundles/ec4076dd6d33874dccc1/2898.js:2:1143609)
2026-08-24T07:17:05.145Z D SecurityManager: disabling 4S key cache
2026-08-24T07:17:05.146Z D SetupEncryptionStore.usePassphrase: error Error decrypting secret m.cross_signing.master: bad MAC
Error: Error decrypting secret m.cross_signing.master: bad MAC
at i (https://www.tchap.gouv.fr/bundles/ec4076dd6d33874dccc1/2898.js:2:392521)
at async C.bootstrapCrossSigning (https://www.tchap.gouv.fr/bundles/ec4076dd6d33874dccc1/2343.js:1:14474)
at async re.bootstrapCrossSigning (https://www.tchap.gouv.fr/bundles/ec4076dd6d33874dccc1/2343.js:1:55103)
at async https://www.tchap.gouv.fr/bundles/ec4076dd6d33874dccc1/2898.js:2:1144288
at async T (https://www.tchap.gouv.fr/bundles/ec4076dd6d33874dccc1/2898.js:2:1143504)
at async j (https://www.tchap.gouv.fr/bundles/ec4076dd6d33874dccc1/2898.js:2:1143609)
2026-08-24T07:17:05.153Z D MatrixChat: handling action aria_hide_main_app
```

Do you have an ideas in which scenario the user enter this state ?

### Operating system

windows

### Browser information

Edge 151.0.0

### URL for webapp

_No response_

### Application version

1.12.17

### Homeserver

_No response_

### Will you send logs?

No

Contributor guide

Open the contributing guide

Research direction

Start by tracing SecurityManager.accessSecretStorage and bootstrapCrossSigning, then SetupEncryptionStore.usePassphrase, using the supplied bad-MAC log and the recovery-key flow as the reproduction path. Determine which scenario produces the decryption failure and ensure the failure is handled without shutting down the UI; the issue does not name a test or source file.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.