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
This scenario seeks to find **Improper Neutralization of Input During Web Page Generation (‘Cross-site Scripting’)** in the APK file.
1392
1394
1393
-
This scenario seeks to find **Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').** See `CWE-79 <https://cwe.mitre.org/data/definitions/79.html>`_ for more details.
1395
+
CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Let’s use this `APK <https://github.com/jaiswalakshansh/Vuldroid>`_ and the above APIs to show how the Quark script finds this vulnerability.
1398
+
We analyze the definition of CWE-79 and identify its characteristics.
1396
1399
1397
-
First, we design a detection rule ``loadUrlFromIntent.json`` to spot on behavior loading URL from intent data to the WebView instance.
1400
+
See `CWE-79 <https://cwe.mitre.org/data/definitions/79.html>`_ for more details.
1398
1401
1399
-
Next, we use API ``quarkResultInstance.findMethodInCaller(callerMethod, targetMethod)`` and ``methodInstance.getArguments()`` to check if the Javascript execution is enabled in the WebView. Finally, we check if there are any famous XSS filters. If **NO**, that may cause CWE-79 vulnerability.
1402
+
.. image:: https://imgur.com/jAwgD0x.png
1403
+
1404
+
Code of CWE-79 in Vuldroid.apk
1405
+
===============================
1400
1406
1407
+
We use the `Vuldroid.apk <https://github.com/jaiswalakshansh/Vuldroid>`_ sample to explain the vulnerability code of CWE-79.
1408
+
1409
+
.. image:: https://imgur.com/lC6EKun.png
1401
1410
1402
1411
Quark Script CWE-79.py
1403
-
========================
1412
+
=======================
1413
+
1414
+
Let’s use the above APIs to show how the Quark script finds this vulnerability.
1415
+
1416
+
First, we design a detection rule ``loadUrlFromIntent.json`` to spot the behavior loading URL from intent data to the WebView instance.
1417
+
1418
+
Next, we use API ``quarkResultInstance.findMethodInCaller(callerMethod, targetMethod)`` and ``methodInstance.getArguments()`` to check if the Javascript execution is enabled in the WebView. Finally, we check if there are any famous XSS filters. If NO, that may cause CWE-79 vulnerability.
0 commit comments