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
We analyze the definition of CWE-89 and identify its characteristics.
839
838
840
839
See `CWE-89 <https://cwe.mitre.org/data/definitions/89.html>`_ for more details.
841
840
842
-
.. image:: https://i.imgur.com/iJ1yIBb.jpg
841
+
.. image:: https://imgur.com/Yx9vIS2.jpg
842
+
843
+
Code of CWE-89 in AndroGoat.apk
844
+
================================
843
845
846
+
We use the `AndroGoat.apk <https://github.com/satishpatnayak/AndroGoat>`_ sample to explain the vulnerability code of CWE-89.
844
847
845
-
Code of CWE-89 in androgoat.apk
846
-
=========================================
848
+
.. image:: https://imgur.com/QWvu8te.jpg
847
849
848
-
We use the `androgoat.apk <https://github.com/satishpatnayak/AndroGoat>`_ sample to explain the vulnerability code of CWE-89.
850
+
CWE-89 Detection Process Using Quark Script API
851
+
================================================
849
852
850
-
.. image:: https://i.imgur.com/bdQqWFb.jpg
853
+
.. image:: https://imgur.com/gvPBB3v.jpg
851
854
855
+
Let’s use the above APIs to show how the Quark script finds this vulnerability.
852
856
857
+
First, we design a detection rule ``executeSQLCommand.json`` to spot on behavior using SQL command Execution. Then, we use API ``behaviorInstance.isArgFromMethod(targetMethod)`` to check if ``append`` uses the value of ``getText`` as the argument. If yes, we confirmed that the SQL command string is built from user input, which will cause CWE-89 vulnerability.
853
858
854
859
Quark Script: CWE-89.py
855
860
========================
856
861
857
-
Let's use the above APIs to show how the Quark script finds this vulnerability.
858
-
859
-
First, we design a detection rule ``executeSQLCommand.json`` to spot on behavior using SQL command Execution. Then, we use API ``behaviorInstance.isArgFromMethod(targetMethod)`` to check if ``append`` uses the value of ``getText`` as the argument. If yes, we confirmed that the SQL command string is built from user input, which will cause CWE-89 vulnerability.
862
+
.. image:: https://imgur.com/B6Mfp2L.jpg
860
863
861
864
.. code-block:: python
862
865
@@ -866,7 +869,7 @@ First, we design a detection rule ``executeSQLCommand.json`` to spot on behavior
866
869
RULE_PATH="executeSQLCommand.json"
867
870
868
871
targetMethod = [
869
-
"Landroid/widget/EditText;", # class name
872
+
"Landroid/widget/EditText;", # class name
870
873
"getText", # method name
871
874
"()Landroid/text/Editable;", # descriptor
872
875
]
@@ -880,9 +883,10 @@ First, we design a detection rule ``executeSQLCommand.json`` to spot on behavior
0 commit comments