File tree Expand file tree Collapse file tree
java/ql/src/experimental/Security/CWE/CWE-036 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66<overview >
77<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,
99an attacker can try to pass absolute URLs starting with <code >file://</code > or <code >jar://</code > to access
1010local resources in addition to remote ones.</p >
1111</overview >
1212
1313<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 >
1717</recommendation >
1818
1919<example >
Original file line number Diff line number Diff line change 11/**
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.
65 * @kind path-problem
76 */
87
You can’t perform that action at this time.
0 commit comments