CryptoLab: Interactive Educational Platform Turns Cryptographic Protocols Course into Hands-On Alice, Bob and Mallory Experiments

A university instructor developed CryptoLab, an educational testbed that lets students run live cryptographic protocol experiments with active attackers instead of simple encrypt-decrypt exercises. The platform models the classic Alice-Mallory-Bob scenario where each participant runs as a separate application mode, allowing inspection, modification, dropping, and replay of packets. The first lab focuses on AES-GCM, AEAD properties, nonce reuse, replay protection, weak RNGs, key rotation, and metadata leakage. Students can operate in interactive mode to manually attack traffic or execute automated scenarios that verify expected security outcomes. Experiments demonstrate that modifying ciphertext triggers authentication failure and that a valid authentication tag does not guarantee message freshness without additional replay defenses. The tool also includes Python 3.10 assignments for correctly using cryptographic primitives rather than implementing algorithms from scratch. CryptoLab currently supports Windows x64 and macOS Apple Silicon builds and serves as the foundation for upcoming labs on symmetric encryption modes, asymmetric cryptography, key exchange, and TLS.

HabrTranslated from Russian

Read at source

CryptoLab is an educational testbed created to transform traditional cryptographic protocols laboratory work into interactive experiments featuring Alice, Bob, and Mallory. Instead of simply calling encrypt and decrypt functions, students now place an active adversary between sender and receiver to observe real protocol behavior under attack.

The first laboratory centers on the model Alice → Mallory → Bob, where Alice acts as the client, Bob as the server, and Mallory controls the communication channel. Mallory can INSPECT, MODIFY, DROP, or REPLAY packets. In normal operation the packet passes unchanged; once students assume the Mallory role they begin tampering to see concrete results.

Key Experiments in the First Lab

One experiment shows what happens when Mallory alters ciphertext protected by AES-GCM. Because AEAD is used correctly, any modification causes the authentication tag check to fail, resulting in immediate rejection rather than partial plaintext delivery. This demonstrates the principle that AEAD decryption must return either valid plaintext or failure, never forwarding data to application logic before authentication succeeds.

A second experiment covers replay attacks. Students capture a fully valid packet containing a correct authentication tag and nonce, then resend it. Without replay protection the server accepts the duplicate because the cryptographic primitive itself only guarantees authenticity and integrity, not freshness. Enabling replay protection through sequence numbers or a replay cache causes the second copy to be rejected, illustrating that replay defense is a protocol-level property built around the primitive.

Additional covered topics include ciphertext and authentication tag handling, AAD, nonce reuse consequences, CSPRNG versus weak RNG behavior, salt usage, key rotation and revocation, and metadata leakage. The lab supports both interactive sessions and automated scenarios launched via command line, such as ./CryptoLab scenario --lab 1 --name 08_weak_rng, which also serve as regression checks during platform development.

Programming tasks remain part of the course but focus on the correct use of existing libraries rather than implementing algorithms. Students write supporting logic for data preparation, key and parameter handling, protocol message formatting, validation, state management, and error handling in Python 3.10.

The platform is distributed as a ready-to-run application for Windows x64 and macOS Apple Silicon without requiring separate installation of Python or Docker. The first lab has already undergone multiple development iterations and now forms the foundation for a second lab on symmetric encryption modes (ECB, CBC, CTR, GCM), padding oracle attacks, and bit-flipping. Future labs will extend the same testbed to asymmetric cryptography, key exchange, digital signatures, handshake protocols, TLS, and PKI.

Meridian digestThe week's most consequential security stories, distilled into one briefing.See the digest

More in Other

Mail.ru Reduces Lifetime 1TB Cloud Storage Promo to Standard 8GB Quota for Select Users
Kimi K3 Open Model Surpasses Closed AI Leaders with Million-Token Context and 896 Experts
Innostage Completes Functional Testing of PT NGFW 1.10.3 Across 156 Criteria