Description
The MASTG v2 Android test set appears to be missing an atomic test for the use of broken hashing algorithms, equivalent to the iOS MASTG-TEST-0211: Broken Hashing Algorithms.
For example, the current Android v2 tests do not appear to detect security-sensitive uses such as:
MessageDigest.getInstance("MD5");
MessageDigest.getInstance("SHA-1");
Background
The deprecated Android MASTG-TEST-0014 had a broad scope. It instructed testers to identify cryptographic primitives including MessageDigest and to verify them against the guidance for insecure and deprecated algorithms.
Issue #2949 was created to port MASTG-TEST-0014 from v1 to v2.
An initial attempt in #3064 decomposed the broad v1 test into multiple atomic tests and included a draft named Weak Hashing Algorithms. However, that PR remains an open draft and the hashing test was not merged.
Later, #3551 ported only the explicit security-provider portion of MASTG-TEST-0014. It introduced MASTG-TEST-0312 and closed #2949.
MASTG-TEST-0312 checks whether an app explicitly supplies a JCA security provider. It does not evaluate the selected hashing algorithm. Consequently, a call such as MessageDigest.getInstance("MD5") uses the default provider and is outside its scope.
The old MASTG-TEST-0014 is now marked as deprecated and covered by MASTG-TEST-0312, although the latter covers only the provider-related portion of the old test. This seems to have left the broken-hashing portion without a corresponding Android v2 test or a separate tracking issue.
Proposed test
Add an atomic Android MASVS-CRYPTO test equivalent in purpose to MASTG-TEST-0211. It should:
- identify hashing APIs such as
java.security.MessageDigest.getInstance;
- explicitly cover broken algorithms such as MD5 and SHA-1, including their common JCA aliases;
- consider third-party and native cryptographic implementations where applicable;
- require contextual validation to distinguish security-sensitive hashing from non-security uses such as ordinary checksums;
- map to the same applicable weakness as the iOS counterpart;
- include a demo and/or static-analysis rule if appropriate.
The metadata of MASTG-TEST-0014 could also be updated to indicate partial coverage or to reference both MASTG-TEST-0312 and the new hashing test.
Related items
Description
The MASTG v2 Android test set appears to be missing an atomic test for the use of broken hashing algorithms, equivalent to the iOS MASTG-TEST-0211: Broken Hashing Algorithms.
For example, the current Android v2 tests do not appear to detect security-sensitive uses such as:
Background
The deprecated Android MASTG-TEST-0014 had a broad scope. It instructed testers to identify cryptographic primitives including
MessageDigestand to verify them against the guidance for insecure and deprecated algorithms.Issue #2949 was created to port MASTG-TEST-0014 from v1 to v2.
An initial attempt in #3064 decomposed the broad v1 test into multiple atomic tests and included a draft named Weak Hashing Algorithms. However, that PR remains an open draft and the hashing test was not merged.
Later, #3551 ported only the explicit security-provider portion of MASTG-TEST-0014. It introduced MASTG-TEST-0312 and closed #2949.
MASTG-TEST-0312 checks whether an app explicitly supplies a JCA security provider. It does not evaluate the selected hashing algorithm. Consequently, a call such as
MessageDigest.getInstance("MD5")uses the default provider and is outside its scope.The old MASTG-TEST-0014 is now marked as deprecated and covered by MASTG-TEST-0312, although the latter covers only the provider-related portion of the old test. This seems to have left the broken-hashing portion without a corresponding Android v2 test or a separate tracking issue.
Proposed test
Add an atomic Android MASVS-CRYPTO test equivalent in purpose to MASTG-TEST-0211. It should:
java.security.MessageDigest.getInstance;The metadata of MASTG-TEST-0014 could also be updated to indicate partial coverage or to reference both MASTG-TEST-0312 and the new hashing test.
Related items