File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed
java/ql/src/experimental/Security/CWE/CWE-036 Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 5
5
6
6
<overview >
7
7
<p >Calling <code >openStream</code > on URLs created from remote source can lead to local file disclosure.</p >
8
- <p >If <code >openStream</code > is called on a <code >java.net.URL</code >, that was created from a remote source
8
+ <p >If <code >openStream</code > is called on a <code >java.net.URL</code >, that was created from a remote source,
9
9
an attacker can try to pass absolute URLs starting with <code >file://</code > or <code >jar://</code > to access
10
10
local resources in addition to remote ones.</p >
11
11
</overview >
12
12
13
13
<recommendation >
14
- <p >When you construct a URL using <code >java.net.URL</code > from a remote source, make sure
15
- to not call openStream on it. Instead fetch the URL with a HTTP Client to access its content.
16
- Also validate that the URL uses the correct protocol and host combination.</p >
14
+ <p >When you construct a URL using <code >java.net.URL</code > from a remote source,
15
+ don't call < code > openStream</ code > on it. Instead, use an HTTP Client to fetch the URL and access its content.
16
+ You should also validate the URL to check that it uses the correct protocol and host combination.</ p > </p >
17
17
</recommendation >
18
18
19
19
<example >
Original file line number Diff line number Diff line change 1
1
/**
2
- * @name Calling openStream on URLs created from remote source can lead to file disclosure
3
- * @description If openStream is called on a java.net.URL, that was created from a remote source
4
- * an attacker can try to pass absolute URLs starting with file:// or jar:// to access
5
- * local resources in addition to remote ones.
2
+ * @name openStream called on URLs created from remote source
3
+ * @description Calling openStream on URLs created from remote source
4
+ * can lead to local file disclosure.
6
5
* @kind path-problem
7
6
*/
8
7
You can’t perform that action at this time.
0 commit comments