Skip to content

Commit eba7e84

Browse files
committed
Revert "Optimize the document of Quark Script CWE-798"
This reverts commit 41e67f5.
1 parent 12767bd commit eba7e84

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

CWE-798/README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,36 @@
11
# Detect CWE-798 in Android Application
22

3-
This scenario seeks to find **hard-coded credentials** in the APK file.
3+
This scenario seeks to find hard-coded credentials in the APK file.
44

5-
## CWE-798: Use of Hard-coded Credentials
5+
## CWE-798 Use of Hard-coded Credentials
66

77
We analyze the definition of CWE-798 and identify its characteristics.
88

9-
See [CWE-798](https://cwe.mitre.org/data/definitions/798.html) for more details.
9+
See [CWE-798](https://cwe.mitre.org/data/definitions/798.html) for more
10+
details.
1011

11-
![image](https://imgur.com/rF8J8hE.png)
12+
![image](https://i.imgur.com/0G9APpf.jpg)
1213

1314
## Code of CWE-798 in ovaa.apk
1415

15-
We use the [ovaa.apk](https://github.com/oversecured/ovaa) sample to explain the vulnerability code of CWE-798.
16+
We use the [ovaa.apk](https://github.com/oversecured/ovaa) sample to
17+
explain the vulnerability code of CWE-798.
1618

17-
![image](https://imgur.com/Cg7DacP.png)
18-
19-
20-
## CWE-798 Detection Process Using Quark Script API
21-
22-
![image](https://imgur.com/R8CfDqD.png)
23-
24-
Let’s use the above APIs to show how the Quark script finds this vulnerability.
25-
26-
First, we design a detection rule ``findSecretKeySpec.json`` to spot on behavior using the constructor ``SecretKeySpec``. Second, we get all the parameter values from this constructor. Then, we parse the AES key from the parameter values. Finally, we check if the AES key is hardcoded in the APK file. If the answer is **YES**, BINGO!!! We find hard-coded credentials in the APK file.
19+
![image](https://i.imgur.com/ikaJlDW.jpg)
2720

2821
## Quark Script: CWE-798.py
2922

30-
![image](https://imgur.com/IOyrqDc.png)
23+
Let\'s use the above APIs to show how the Quark script finds this
24+
vulnerability.
25+
26+
First, we design a detection rule `findSecretKeySpec.json` to spot on
27+
behavior using the method `SecretKeySpec`. Then, we get all the
28+
parameter values that are input to this method. And we parse the AES key
29+
out of the parameter values. Finally, we check if the AES key is
30+
hardcoded in the APK file. If the answer is YES, BINGO!!! We find
31+
hard-coded credentials in the APK file.
3132

32-
```python
33+
``` python
3334
import re
3435
from quark.script import runQuarkAnalysis, Rule
3536

@@ -53,9 +54,7 @@ for secretKeySpec in quarkResult.behaviorOccurList:
5354

5455
## Quark Rule: findSecretKeySpec.json
5556

56-
![image](https://imgur.com/2BYOE70.png)
57-
58-
```json
57+
``` json
5958
{
6059
"crime": "Detect APK using SecretKeySpec.",
6160
"permission": [],
@@ -78,7 +77,8 @@ for secretKeySpec in quarkResult.behaviorOccurList:
7877

7978
## Quark Script Result
8079

81-
```TEXT
82-
$ python3 CWE-798.py
80+
``` TEXT
81+
$ python3 findSecretKeySpec.py
82+
8383
Found hard-coded AES key 49u5gh249gh24985ghf429gh4ch8f23f
8484
```

0 commit comments

Comments
 (0)