Adversarial Testing for Browser E2EE: Authentication, Replay, and State Recovery

https://hackernoon.imgix.net/images/6VcBXzupQOUeeTZOwdzpwpc8moj1-g782bav.png

An end-to-end encryption test should do more than prove that one browser can decrypt what another browser encrypted. It should impersonate an active relay, change authenticated metadata, move ciphertext into the wrong context, attempt a downgrade, interrupt state transitions, and then verify two outcomes: every attack is rejected, and honest communication still works afterward. This article develops that method against a small browser E2EE package that runs locally with Node.js and no server.

The happy-path round trip is only a starting point

The smallest useful encryption test looks familiar:

const wire = await sender.encryptText("hello", 1, "primary");const value = await receiver.decryptText(wire);assert.equal(value.text, "hello");

This detects broken wiring. It does not establish that an attacker cannot replace a public key, alter a revision number, replay a file chunk in another transfer, or leave the session permanently unusable after a rejected message.

There is another trap: an implementation and its test helper can share...

Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE