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
Copy file name to clipboardExpand all lines: java/ql/src/experimental/Security/CWE/CWE-200/InsecureWebResourceResponse.qhelp
+13-13Lines changed: 13 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -3,36 +3,36 @@
3
3
"qhelp.dtd">
4
4
<qhelp>
5
5
<overview>
6
-
<p>Android provides a <code>WebResourceResponse</code> API, which is a <code>WebView</code> class that
7
-
allows an Android application to behave as a web server by handling requests of popular protocols such
8
-
as <code>http(s)</code>, <code>file</code>, as well as <code>javascript</code>; and returning a response
9
-
(including status code, content type, content encoding, headers and the response body). Improper
10
-
implementation with insufficient input validation can lead to leaking of sensitive configuration file
11
-
or user data because requests could refer to paths intended to be application-private.
6
+
<p>Android provides a <code>WebResourceResponse</code> class, which allows an Android application to behave
7
+
as a web server by handling requests of popular protocols such as <code>http(s)</code>, <code>file</code>,
8
+
as well as <code>javascript</code>; and returning a response (including status code, content type, content
9
+
encoding, headers and the response body). Improper implementation with insufficient input validation can lead
10
+
to leakage of sensitive configuration files or user data because requests could refer to paths intended to be
11
+
application-private.
12
12
</p>
13
13
</overview>
14
14
15
15
<recommendation>
16
16
<p>
17
-
Unsanitized userprovided url must not be used to serve a response directly. When handling a request,
18
-
always validate that the file path is not the receiver's protected directory. Alternatively the Android
19
-
API <code>WebViewAssetLoader</code> can be used, which safely processes data from resources, assets or
20
-
a predefined directory.
17
+
Unsanitized user-provided URLs must not be used to serve a response directly. When handling a request,
18
+
always validate that the requested file path is not in the receiver's protected directory. Alternatively
19
+
the Android class <code>WebViewAssetLoader</code> can be used, which safely processes data from resources,
20
+
assets or a predefined directory.
21
21
</p>
22
22
</recommendation>
23
23
24
24
<example>
25
25
<p>
26
-
The following examples show a bad situation and two good situations respectively. In the bad situation, a
27
-
response is served without path validation. In the good situation, a response is either served with path
26
+
The following examples show a bad scenario and two good scenarios respectively. In the bad scenario, a
27
+
response is served without path validation. In the good scenario, a response is either served with path
28
28
validation or through the safe <code>WebViewAssetLoader</code> implementation.
29
29
</p>
30
30
<samplesrc="InsecureWebResourceResponse.java" />
31
31
</example>
32
32
33
33
<references>
34
34
<li>
35
-
Google:
35
+
Oversecured:
36
36
<ahref="https://blog.oversecured.com/Android-Exploring-vulnerabilities-in-WebResourceResponse/">Android: Exploring vulnerabilities in WebResourceResponse</a>.
0 commit comments