Skip to content

Commit 408dd31

Browse files
haby0smowton
andauthored
Update java/ql/src/experimental/Security/CWE/CWE-348/UseOfLessTrustedSource.qhelp
Co-authored-by: Chris Smowton <[email protected]>
1 parent 9ece4da commit 408dd31

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

java/ql/src/experimental/Security/CWE/CWE-348/UseOfLessTrustedSource.qhelp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ bypass a ban-list, for example.</p>
1515
</recommendation>
1616
<example>
1717

18-
<p>The following examples show the bad case and the good case respectively. Bad case, such as <code>bad1</code> to <code>bad2</code>.
19-
In the <code>bad1</code> method, obtain the client ip according to the specified identifier from the <code>header</code> for local
20-
output and logging. In the <code>bad2</code> method, the client ip is obtained and judged according to the specified identifier
21-
from the <code>header</code>. When used for permission verification, it can be bypassed by forging the ip. Good case, such as
22-
<code>good1</code>, split the value of <code>X-Forwarded-For</code> in <code>header</code> and get the last value of the split array.</p>
18+
<p>The following examples show the bad case and the good case respectively.
19+
In the <code>bad1</code> method, the client ip is obtained from an HTTP header for local
20+
output and logging. In the <code>bad2</code> method, the client ip the <code>X-Forwarded-For</code> is split into comma-separated values, but the less-trustworthy first one is used. Both of these examples could be deceived by providing a forged HTTP header. The method
21+
<code>good1</code> similarly splits an <code>X-Forwarded-For</code> value, but uses the last, more-trustworthy entry.</p>
2322

2423
<sample src="UseOfLessTrustedSource.java" />
2524

0 commit comments

Comments
 (0)