You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Optimize the document of Quark Script CWE-798 (#722)
* Optimize the document of Quark Script CWE-798
* Optimize the document of Quark Script CWE-798
* Optimize the document of Quark Script CWE-798
* Optimize the document of Quark Script CWE-798
* Optimize the document of Quark Script CWE-798
Copy file name to clipboardExpand all lines: docs/source/quark_script.rst
+24-18Lines changed: 24 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -399,33 +399,39 @@ Method (callComponentMethod) with urls is detected triggered!
399
399
400
400
401
401
Detect CWE-798 in Android Application
402
-
------------------------------------------------
402
+
-------------------------------------------------
403
403
404
-
This scenario seeks to find hard-coded credentials in the APK file.
404
+
This scenario seeks to find **hard-coded credentials** in the APK file.
405
405
406
-
CWE-798 Use of Hard-coded Credentials
407
-
============================================
406
+
CWE-798: Use of Hard-coded Credentials
407
+
======================================
408
408
409
409
We analyze the definition of CWE-798 and identify its characteristics.
410
410
411
-
See `CWE-798 <https://cwe.mitre.org/data/definitions/798.html>`_ for more details.
411
+
See `CWE-798 <https://cwe.mitre.org/data/definitions/798.html>`_ for more details.
412
412
413
-
.. image:: https://i.imgur.com/0G9APpf.jpg
413
+
.. image:: https://imgur.com/rF8J8hE.png
414
414
415
415
Code of CWE-798 in ovaa.apk
416
-
=========================================
416
+
============================
417
417
418
418
We use the `ovaa.apk <https://github.com/oversecured/ovaa>`_ sample to explain the vulnerability code of CWE-798.
419
419
420
-
.. image:: https://i.imgur.com/ikaJlDW.jpg
420
+
.. image:: https://imgur.com/Cg7DacP.png
421
421
422
+
CWE-798 Detection Process Using Quark Script API
423
+
=================================================
424
+
425
+
.. image:: https://imgur.com/R8CfDqD.png
426
+
427
+
Let’s use the above APIs to show how the Quark script finds this vulnerability.
428
+
429
+
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.
422
430
423
431
Quark Script: CWE-798.py
424
432
========================
425
433
426
-
Let's use the above APIs to show how the Quark script finds this vulnerability.
427
-
428
-
First, we design a detection rule ``findSecretKeySpec.json`` to spot on behavior using the method ``SecretKeySpec``. Then, we get all the parameter values that are input to this method. And we parse the AES key out of 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.
434
+
.. image:: https://imgur.com/IOyrqDc.png
429
435
430
436
.. code-block:: python
431
437
@@ -449,9 +455,10 @@ First, we design a detection rule ``findSecretKeySpec.json`` to spot on behavior
0 commit comments