MASTG-TEST-0308: Runtime Use of Asymmetric Key Pairs Used For Multiple Purposes
Overview¶
This test is the dynamic counterpart to References to Asymmetric Key Pairs Used For Multiple Purposes, but it focuses on intercepting cryptographic operations rather than generating keys with multiple purposes.
Some of the relevant functions to intercept are:
Cipher.init(int opmode, Key key, AlgorithmParameters params)whereopmodeis one of:Cipher.ENCRYPT_MODECipher.DECRYPT_MODECipher.WRAP_MODECipher.UNWRAP_MODE
Signature.initSign(PrivateKey privateKey)Signature.initVerify(PublicKey publicKey)
Steps¶
- Execute a method trace ( Method Tracing) targeting all functions that use an asymmetric key to perform cryptographic operations.
Observation¶
The output should contain a list of all cryptographic operations together with their corresponding keys.
Evaluation¶
The test case fails if you find any keys used for multiple roles.
Using the output, ensure that each key (or key pair) is restricted to exactly one of the following groups of operations:
- Encryption/Decryption (used in
Cipheroperations withENCRYPT_MODEorDECRYPT_MODE) - Signing/Verification (used in
Signatureoperations) - Key Wrapping (used in
Cipheroperations withWRAP_MODEorUNWRAP_MODE)
Demos¶
MASTG-DEMO-0072: Runtime Use of Asymmetric Key Pairs Used For Multiple Purposes With Frida