- Published on
Offensive and Defensive Cryptography
803 words5 min read
Crypton is an educational library to learn and practice Offensive and Defensive Cryptography.
It is basically a collection of explanation and implementation of all the existing vulnerabilities and attacks on various Encryption Systems (Symmetric and Asymmetric), Digital Signatures, Message Authentication Codes and Authenticated Encryption Systems.
Each attack is also supplemented with example challenges from "Capture The Flag" contests and their respective write-ups. Individuals who are already acquainted (or are into CTFs) with this field can use Crypton as a tool to solve challenges based on a particular existing vulnerability.
Block Ciphers
Topic | Explanation | Impl./Exploit | Challenge |
---|---|---|---|
Block Cipher Basics - working of block ciphers, padding etc. | link | ||
Modes of Encryption - different modes of operation on block ciphers: ECB, CBC, CTR | link | ||
Block Size Detection - detect blocksize of a block cipher encrypting data on a remote service | link | ||
Mode Detection - detect type of mode of encryption: independent or dependent encryption of blocks | link | ||
ECB Byte at a Time - byte at a time decryption of a secret string running on a remote service encrypting input +secret in ECB mode | link | link | |
CBC IV Detection - detect the value of Initialisation Vector on a remote service that is encrypting our input using a block cipher in CBC mode | link | link | |
CBC Bit Flipping Attack - exploiting cookie generation mechanism to login as admin when cookie is generated using a block cipher in CBC mode | link | link | |
CBC Byte at a Time - byte at a time decryption of a secret string running on a remote service encrypting input +secret in ECB mode | link | link | |
CBC Padding Oracle Attack - decryption of data encrypted by a vulnerable service providing encryption/decryption | link | link | |
CTR Bit Flipping - exploiting cookie generation mechanism to login as admin when cookie is generated using a block cipher in CBC mode | link | link |
RSA Encryption
Topic | Explanation | Impl./Exploit | Challenge |
---|---|---|---|
Unpadded RSA Enc/Dec - key generation, distribution, encryption/decryption, verification of decryption formula and padding in RSA | link | ||
Direct Root Attack - attack on unpadded RSA with low public key exponent | link | ||
Fermat's Factorisation - technique used to factor modulus n when p and q values are in proximity | link | link | link |
Pollard's p-1 Factorisation - technique to factorise n when both of it's factors p & q , p-1 and q-1 have very small prime divisors | link | link | link |
Common Modulus Attack - decrypt ciphertext when it's corresponding plaintext is encrypted two different times with the same modulus n | link | link | link |
Common Prime Attack - retrieve factors of moduli n1 and n2 when they have a common factor | link | link | |
Wiener's Attack - get value of decryption key exponent d when d < N0.25 | link | link | link |
Wiener's Attack Variant - get value of decryption key exponent d when d is a few bits greater than N0.25 or d < N0.25 | link | link | link |
Coppersmith's Attack - coppersmith's theorem, attack on stereotyped messages and factoring n with high bits known | link | link | link |
Franklin Reiter Related Message Attack - attack to retrieve related messages encrypted using the same modulus | link | link | link |
Hastad's Broadcast Attack- with extension - attack to retrieve a message broadcasted among different people, encrypted using same exponent but different moduli | link | link | link |
PKCS1-v1.5-Padded-RSA-Encryption/Decryption - ASN1 encoding, padded RSA encryption (needs to be fixed) | |||
Least Significant Bit Oracle Attack - attack on RSA oracle leaking least significant bit value on decryption | link | link | |
Attack-Retrieve-Modulus - attack on RSA oracle to extract value of modulus in case it is not public | link | link | link |
Intro-RSA-Challenges - basic challenges in RSA related to Number Theory | link | link |
Message Authentication Codes (MACs)
Topic | Explanation | Impl./Exploit | Challenge |
---|---|---|---|
Message Authentication Code- internals and security analysis of MACs | link | ||
CBC MAC Forgery- generating two message M1 and M2 having the same CBC-MAC authentication tag | link | link | |
Length Extension Attack on CBC-MAC- generate a valid authentication tag of message M1 || M2 (concatenation) given MAC(M1) | link | link |
Discrete Logarithm Problem
Topic | Explanation | Impl./Exploit | Challenge |
---|---|---|---|
DLP- Cyclic Groups, Discrete Logarithm Problem | link | link | |
Pollard's Rho Algorithm to solve DLP | link | link | link |
Baby Step Giant Step Algorithm to solve DLP | link | link | |
Pohlig Hellman Algorithm to solve DLP | link | link | |
Elliptic Curve DLP- defining identity element, inverse of a point, cyclic groups over points on an EC, Hasse's theorem, ECDLP | link | ||
Baby Step Giant Step Algorithm to solve Elliptic Curve DLP | link | link | |
Pollard's Rho Algorithm to solve Elliptic Curve DLP | link | link | link |
ElGamal Encryption
Topic | Explanation | Impl./Exploit | Challenge |
---|---|---|---|
ElGamal Cryptosystem- Encryption/Decryption- key generation, encryption, decryption in ElGamal Cryptosystem | link | link | link |
Authenticated Encryption (AE)
Topic | Explanation | Impl./Exploit | Challenge |
---|---|---|---|
AE basics & internals- working of authenticated encryption | link | ||
AE with MACs- different techniques of implementing AE with MACs: Encrypt and MAC, MAC then encrypt and encrypt then MAC | link | ||
Authenticated Ciphers | link | ||
AE with Associated Data | link | ||
AES-GCM- encryption in AES-GCM, Wegman-Carter MAC | link | link | |
Forbidden Attack on AES-GCM- attack on AES-GCM due to nonce-reuse | link | link |
Elliptic Curves
Topic | Explanation | Impl./Exploit | Challenge |
---|---|---|---|
Elliptic Curve Internals- defining Elliptic Curves, point addition, point doubling and scalar multiplication | link | python, sage |
Digital Signatures
Topic | Explanation | Impl./Exploit | Challenge |
---|---|---|---|
ElGamal Signatures- key generation, signature generation, signature verification and correctness of ElGamal Signature scheme | link | link | link |
Elliptic Curve DSA- signature generation, signature verification and correctness of signature algorithm | link | ||
Attack k-reuse ECDSA- forging of ECDSA signatures due to reuse of k | link | ||
Unpadded RSA Digital Signatures- signature generation and verification in RSA digital signature scheme | link | link | |
PKCS1-v1.5 padded RSA Digital Signatures | link | link | |
e=3 Bleichenbacher's Attack | link | link | link |
Identification
Topic | Explanation | Impl./Exploit | Challenge |
---|---|---|---|
Identification Internals | link | ||
Ephemeral Key Authentication | link | link |
Diffie Hellman Key Exchange
Topic | Explanation | Impl./Exploit | Challenge |
---|---|---|---|
Diffie Hellman Key Exchange Internals | link | link | |
Small Subgroup Confinement Attacks | link | link | link |
Invalid Curve Point Attack | link | link | link |