Skip to content

Commit ce405a5

Browse files
committed
Align the DEMOs with the wording used elsewhere.
1 parent 07c2f6c commit ce405a5

17 files changed

+36
-38
lines changed

demos/android/MASVS-CRYPTO/MASTG-DEMO-0012/MASTG-DEMO-0012.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
platform: android
3-
title: Weak Cryptographic Key Generation
3+
title: Cryptographic Key Generation With Insufficient Key Length
44
code: [java]
55
id: MASTG-DEMO-0012
66
test: MASTG-TEST-0208
@@ -14,7 +14,7 @@ test: MASTG-TEST-0208
1414

1515
Let's run our @MASTG-TOOL-0110 rule against the sample code.
1616

17-
{{ ../../../../rules/mastg-android-weak-key-generation.yml }}
17+
{{ ../../../../rules/mastg-android-key-generation-with-insufficient-key-length.yml }}
1818

1919
{{ run.sh }}
2020

@@ -26,4 +26,4 @@ The rule has identified some instances in the code file where cryptographic keys
2626

2727
### Evaluation
2828

29-
The test fails because the key size of the RSA key is set to `1024` bits, and the size of the AES key is set to `128`, which is considered weak in both cases.
29+
The test fails because the key size of the RSA key is set to `1024` bits, and the size of the AES key is set to `128`, which is considered insufficient in both cases.

demos/android/MASVS-CRYPTO/MASTG-DEMO-0012/output.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
└─────────────────┘
66

77
MastgTest_reversed.java
8-
❯❱ weak_key_size
8+
❯❱ insufficient_key_size
99
Cryptographic implementations with insufficient key length are being used.
1010

1111
27┆ KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
NO_COLOR=true semgrep -c ../../../../rules/mastg-android-weak-key-generation.yml ./MastgTest_reversed.java --text -o output.txt
1+
NO_COLOR=true semgrep -c ../../../../rules/mastg-android-key-generation-with-insufficient-key-length.yml ./MastgTest_reversed.java --text -o output.txt

demos/android/MASVS-CRYPTO/MASTG-DEMO-0022/MASTG-DEMO-0022.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
platform: android
3-
title: Uses of Insecure Symmetric Encryption Algorithms in Cipher with semgrep
3+
title: Uses of Deprecated, Risky or Broken Symmetric Encryption Algorithms in Cipher with semgrep
44
id: MASTG-DEMO-0022
55
code: [kotlin]
66
test: MASTG-TEST-0221
@@ -16,18 +16,18 @@ The code snippet below shows sample code contains use of insecure encryption alg
1616

1717
Let's run our @MASTG-TOOL-0110 rule against the sample code.
1818

19-
{{ ../../../../rules/mastg-android-weak-encryption-algorithms.yaml }}
19+
{{ ../../../../rules/mastg-android-risky-encryption-algorithms.yaml }}
2020

2121
{{ run.sh }}
2222

2323
### Observation
2424

25-
The rule has identified two instances in the code file where insecure encryption algorithms are used. The specified line numbers can be located in the reverse-engineered code for further investigation and remediation.
25+
The rule has identified two instances in the code file where deprecated, risky or broken encryption algorithms are used. The specified line numbers can be located in the reverse-engineered code for further investigation and remediation.
2626

2727
{{ output.txt }}
2828

2929
### Evaluation
3030

31-
The test fails due to the use of weak encryption algorithms, specifically DES, 3DES, RC4 and Blowfish.
31+
The test fails due to the use of deprecated, risky or broken encryption algorithms, specifically DES, 3DES, RC4 and Blowfish.
3232

3333
See @MASTG-TEST-0221 for more information.

demos/android/MASVS-CRYPTO/MASTG-DEMO-0022/MastgTest.kt

+9-9
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import javax.crypto.SecretKey
1313

1414
class MastgTest(private val context: Context) {
1515

16-
// Vulnerable encryption using DES (weak algorithm)
16+
// Vulnerable encryption using DES (broken algorithm)
1717
fun vulnerableDesEncryption(data: String): String {
1818
try {
1919
// Weak key for DES
@@ -23,7 +23,7 @@ class MastgTest(private val context: Context) {
2323
val keyFactory = SecretKeyFactory.getInstance("DES")
2424
val secretKey: Key = keyFactory.generateSecret(keySpec)
2525

26-
// Weak encryption algorithm (DES)
26+
// Risky encryption algorithm (DES)
2727
val cipher = Cipher.getInstance("DES")
2828
cipher.init(Cipher.ENCRYPT_MODE, secretKey)
2929

@@ -44,7 +44,7 @@ class MastgTest(private val context: Context) {
4444
val keyFactory = SecretKeyFactory.getInstance("DESede")
4545
val secretKey: Key = keyFactory.generateSecret(keySpec)
4646

47-
// Weak encryption algorithm (3DES)
47+
// Risky encryption algorithm (3DES)
4848
val cipher = Cipher.getInstance("DESede")
4949
cipher.init(Cipher.ENCRYPT_MODE, secretKey)
5050

@@ -72,15 +72,15 @@ class MastgTest(private val context: Context) {
7272
}
7373
}
7474

75-
// Insecure encryption using Blowfish (weak algorithm)
75+
// Risky encryption using Blowfish (weak algorithm)
7676
fun vulnerableBlowfishEncryption(data: String): String {
7777
return try {
78-
// Weak key for Blowfish (insecure, small key size)
78+
// Weak key for Blowfish (risky, small key size)
7979
val keyBytes = ByteArray(8) // Only 8 bytes (64-bit key) - not secure
8080
SecureRandom().nextBytes(keyBytes)
8181
val secretKey: SecretKey = SecretKeySpec(keyBytes, "Blowfish")
8282

83-
// Weak encryption algorithm (Blowfish)
83+
// Risky encryption algorithm (Blowfish)
8484
val cipher = Cipher.getInstance("Blowfish")
8585
cipher.init(Cipher.ENCRYPT_MODE, secretKey)
8686

@@ -95,16 +95,16 @@ class MastgTest(private val context: Context) {
9595
fun mastgTest(): String {
9696
val sensitiveString = "Hello from the OWASP MASTG Test app."
9797

98-
// Encrypt with weak DES
98+
// Encrypt with broken DES
9999
val desEncryptedString = vulnerableDesEncryption(sensitiveString)
100100

101-
// Encrypt with weak 3DES
101+
// Encrypt with risky 3DES
102102
val tripleDesEncryptedString = vulnerable3DesEncryption(sensitiveString)
103103

104104
// Encrypt with deprecated RC4
105105
val rc4EncryptedString = vulnerableRc4Encryption(sensitiveString)
106106

107-
// Encrypt with weak Blowfish
107+
// Encrypt with risky Blowfish
108108
val blowfishEncryptedString = vulnerableBlowfishEncryption(sensitiveString)
109109

110110
// Returning the encrypted results

demos/android/MASVS-CRYPTO/MASTG-DEMO-0022/output.txt

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
└─────────────────┘
66

77
MastgTest_reversed.java
8-
❯❱ rules.weak-encryption-algorithms
9-
[MASVS-CRYPTO-1] Weak encryption algorithms found in use.
8+
❯❱ rules.risky-encryption-algorithms
9+
[MASVS-CRYPTO-1] Deprecated, risky or broken encryption algorithms found in use.
1010

1111
39┆ Cipher cipher = Cipher.getInstance("DES");
1212
⋮┆----------------------------------------
@@ -15,4 +15,3 @@
1515
81┆ Cipher cipher = Cipher.getInstance("RC4");
1616
⋮┆----------------------------------------
1717
100┆ Cipher cipher = Cipher.getInstance("Blowfish");
18-
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
NO_COLOR=true semgrep -c ../../../../rules/mastg-android-weak-encryption-algorithms.yaml ./MastgTest_reversed.java --text > output.txt
1+
NO_COLOR=true semgrep -c ../../../../rules/mastg-android-risky-encryption-algorithms.yaml ./MastgTest_reversed.java --text > output.txt

demos/android/MASVS-CRYPTO/MASTG-DEMO-0023/MASTG-DEMO-0023.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
---
22
platform: android
3-
title: Uses of Insecure Encryption Modes in Cipher with semgrep
3+
title: Uses of Risky or Broken Encryption Modes in Cipher with semgrep
44
id: MASTG-DEMO-0023
55
code: [kotlin]
66
test: MASTG-TEST-0232
77
---
88

99
### Sample
1010

11-
The code snippet below shows sample code contains use of insecure encryption modes.
11+
The code snippet below shows sample code contains use of risky or broken encryption modes.
1212

1313
{{ MastgTest.kt # MastgTest_reversed.java }}
1414

1515
### Steps
1616

1717
Let's run our @MASTG-TOOL-0110 rule against the sample code.
1818

19-
{{ ../../../../rules/mastg-android-weak-encryption-modes.yaml }}
19+
{{ ../../../../rules/mastg-android-risky-encryption-modes.yaml }}
2020

2121
{{ run.sh }}
2222

2323
### Observation
2424

25-
The rule has identified six instances in the code file where insecure encryption modes are used. The specified line numbers can be located in the reverse-engineered code for further investigation and remediation.
25+
The rule has identified six instances in the code file where risky or broken encryption modes are used. The specified line numbers can be located in the reverse-engineered code for further investigation and remediation.
2626

2727
{{ output.txt }}
2828

demos/android/MASVS-CRYPTO/MASTG-DEMO-0023/output.txt

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
└─────────────────┘
66

77
MastgTest_reversed.java
8-
❯❱ rules.weak-encryption-modes
9-
[MASVS-CRYPTO-1] Weak encryption modes found in use.
8+
❯❱ rules.risky-encryption-modes
9+
[MASVS-CRYPTO-1] Risky or broken encryption modes found in use.
1010

1111
36┆ Cipher cipher = Cipher.getInstance("AES");
1212
⋮┆----------------------------------------
@@ -19,4 +19,3 @@
1919
118┆ Cipher cipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
2020
⋮┆----------------------------------------
2121
141┆ Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding");
22-
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
NO_COLOR=true semgrep -c ../../../../rules/mastg-android-weak-encryption-modes.yaml ./MastgTest_reversed.java --text > output.txt
1+
NO_COLOR=true semgrep -c ../../../../rules/mastg-android-risky-encryption-modes.yaml ./MastgTest_reversed.java --text > output.txt

demos/ios/MASVS-CRYPTO/MASTG-DEMO-0011/MASTG-DEMO-0011.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
platform: ios
3-
title: Uses of Weak Key Size in SecKeyCreateRandomKey with r2
3+
title: Uses of Insufficient Key Size in SecKeyCreateRandomKey with r2
44
code: [swift]
55
id: MASTG-DEMO-0011
66
test: MASTG-TEST-0209
@@ -37,4 +37,4 @@ In the output we can see how the `kSecAttrKeySizeInBits` attribute is set to `10
3737

3838
{{ evaluation.txt }}
3939

40-
The test fails because the key size is set to `1024` bits, which is considered weak for RSA encryption. The key size should be increased to `2048` bits or higher to provide adequate security against modern cryptographic attacks.
40+
The test fails because the key size is set to `1024` bits, which is considered insufficient for RSA encryption. The key size should be increased to `2048` bits or higher to provide adequate security against modern cryptographic attacks.

demos/ios/MASVS-CRYPTO/MASTG-DEMO-0015/MASTG-DEMO-0015.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
platform: ios
3-
title: Uses of Insecure Hashing Algorithms in CommonCrypto with r2
3+
title: Uses of Risky or Broken Hashing Algorithms in CommonCrypto with r2
44
code: [swift]
55
id: MASTG-DEMO-0015
66
test: MASTG-TEST-0211

demos/ios/MASVS-CRYPTO/MASTG-DEMO-0016/MASTG-DEMO-0016.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
platform: ios
3-
title: Uses of Insecure Hashing Algorithms in CryptoKit with r2
3+
title: Uses of Risky or Broken Hashing Algorithms in CryptoKit with r2
44
code: [swift]
55
id: MASTG-DEMO-0016
66
test: MASTG-TEST-0211

demos/ios/MASVS-CRYPTO/MASTG-DEMO-0018/MASTG-DEMO-0018.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
platform: ios
3-
title: Uses of Insecure Encryption Algorithms in CommonCrypto with r2
3+
title: Uses of Deprecated, Risky or Broken Encryption Algorithms in CommonCrypto with r2
44
code: [swift]
55
id: MASTG-DEMO-0018
66
test: MASTG-TEST-0210

rules/mastg-android-weak-key-generation.yml rules/mastg-android-key-generation-with-insufficient-key-length.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
rules:
2-
- id: weak_key_size
2+
- id: insufficient_key_size
33
severity: WARNING
44
languages:
55
- java

rules/mastg-android-weak-encryption-algorithms.yaml rules/mastg-android-risky-encryption-algorithms.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
rules:
2-
- id: weak-encryption-algorithms
2+
- id: risky-encryption-algorithms
33
languages:
44
- java
55
severity: WARNING

rules/mastg-android-weak-encryption-modes.yaml rules/mastg-android-risky-encryption-modes.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
rules:
2-
- id: weak-encryption-modes
2+
- id: risky-encryption-modes
33
languages:
44
- java
55
severity: WARNING

0 commit comments

Comments
 (0)