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
<p>Apps that rely on URL Parsing to verify that a given URL is pointing to a trust server may be susceptible to many different ways to get URL parsing and verification wrong, which allows an attacker to register a fake site to break the access control.</p>
8
+
</overview>
9
+
10
+
<recommendation>
11
+
<p>Verify the whole host and domain (FQDN) or check endsWith dot+domain.</p>
12
+
</recommendation>
13
+
14
+
<example>
15
+
<p>The following example shows two ways of verify host domain. In the 'BAD' case,
16
+
verification is implemented as partial domain match. In the 'GOOD' case, full domain is verified.</p>
17
+
<samplesrc="IncorrectURLVerification.java" />
18
+
</example>
19
+
20
+
<references>
21
+
<li>
22
+
<ahref="https://drive.google.com/file/d/0BwMN49Gzo3x6T1N5WGQ4TTNlMHBOb1ZRQTVEWnVBZjFUaE5N/view">Common Android app vulnerabilities from Sebastian Porst of Google</a>
23
+
</li>
24
+
<li>
25
+
<ahref="https://www.bugcrowd.com/resources/webinars/overview-of-common-android-app-vulnerabilities/">Common Android app vulnerabilities from bugcrowd</a>
* @name Insertion of sensitive information into log files
4
+
* @description Apps that rely on URL parsing to verify that a given URL is pointing to a trusted server are susceptible to wrong ways of URL parsing and verification.
5
+
* @kind problem
6
+
* @tags security
7
+
* external/cwe-939
8
+
*/
9
+
10
+
import java
11
+
import semmle.code.java.dataflow.FlowSources
12
+
import semmle.code.java.dataflow.TaintTracking
13
+
import DataFlow
14
+
import PathGraph
15
+
16
+
17
+
/**
18
+
* The Java class `android.net.Uri` and `java.net.URL`.
19
+
*/
20
+
classUriextendsRefType{
21
+
Uri(){
22
+
hasQualifiedName("android.net","Uri")or
23
+
hasQualifiedName("java.net","URL")
24
+
}
25
+
}
26
+
27
+
/**
28
+
* The method `getHost()` declared in `android.net.Uri` and `java.net.URL`.
29
+
*/
30
+
classUriGetHostMethodextendsMethod{
31
+
UriGetHostMethod(){
32
+
getDeclaringType()instanceofUriand
33
+
hasName("getHost")and
34
+
getNumberOfParameters()=0
35
+
}
36
+
}
37
+
38
+
/**
39
+
* A library method that acts like `String.format` by formatting a number of
this.getArgument(0).(VarAccess).getVariable().getAnAssignedValue().(StringLiteral).getRepresentedString().charAt(0)!="."//check variable starts with "."
0 commit comments