Skip to content

Commit f0f5fc7

Browse files
committed
Improve SSRF additional flow step
1 parent c9ce2c8 commit f0f5fc7

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

go/ql/src/experimental/CWE-918/SSRF.qll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ module ServerSideRequestForgery {
2222

2323
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
2424
// propagate to a URL when its host is assigned to
25-
exists(Write w, Field f, SsaWithFields v | f.hasQualifiedName("net/url", "URL", "Host") |
26-
w.writesFieldPreUpdate(v.getAUse(), f, node1) and
27-
node2 = v.getAUse()
25+
exists(Write w, Field f | f.hasQualifiedName("net/url", "URL", "Host") |
26+
w.writesField(node2, f, node1)
2827
)
2928
}
3029

go/ql/test/experimental/CWE-918/SSRF.expected

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ edges
2424
| builtin.go:112:21:112:31 | call to Referer | builtin.go:115:15:115:28 | untrustedInput | provenance | Src:MaD:8 |
2525
| builtin.go:130:21:130:31 | call to Referer | builtin.go:133:38:133:51 | untrustedInput | provenance | Src:MaD:8 |
2626
| builtin.go:151:16:151:36 | call to FormValue | builtin.go:154:13:154:22 | unsafehost | provenance | Src:MaD:7 |
27-
| builtin.go:154:2:154:4 | implicit dereference | builtin.go:156:21:156:23 | url | provenance | |
28-
| builtin.go:154:2:154:4 | url | builtin.go:154:2:154:4 | implicit dereference | provenance | |
29-
| builtin.go:154:2:154:4 | url | builtin.go:156:21:156:23 | url | provenance | |
30-
| builtin.go:154:13:154:22 | unsafehost | builtin.go:154:2:154:4 | implicit dereference | provenance | Config |
31-
| builtin.go:154:13:154:22 | unsafehost | builtin.go:154:2:154:4 | url | provenance | Config |
27+
| builtin.go:154:2:154:4 | implicit dereference [postupdate] | builtin.go:154:2:154:4 | url [postupdate] | provenance | |
28+
| builtin.go:154:2:154:4 | url [postupdate] | builtin.go:156:21:156:23 | url | provenance | |
29+
| builtin.go:154:13:154:22 | unsafehost | builtin.go:154:2:154:4 | implicit dereference [postupdate] | provenance | Config |
30+
| builtin.go:154:13:154:22 | unsafehost | builtin.go:154:2:154:4 | url [postupdate] | provenance | Config |
3231
| builtin.go:156:21:156:23 | url | builtin.go:156:21:156:32 | call to String | provenance | MaD:12 |
3332
| new-tests.go:26:26:26:30 | &... [postupdate] | new-tests.go:31:48:31:56 | selection of word | provenance | Src:MaD:3 |
3433
| new-tests.go:26:26:26:30 | &... [postupdate] | new-tests.go:32:48:32:56 | selection of safe | provenance | Src:MaD:3 |
@@ -96,8 +95,8 @@ nodes
9695
| builtin.go:130:21:130:31 | call to Referer | semmle.label | call to Referer |
9796
| builtin.go:133:38:133:51 | untrustedInput | semmle.label | untrustedInput |
9897
| builtin.go:151:16:151:36 | call to FormValue | semmle.label | call to FormValue |
99-
| builtin.go:154:2:154:4 | implicit dereference | semmle.label | implicit dereference |
100-
| builtin.go:154:2:154:4 | url | semmle.label | url |
98+
| builtin.go:154:2:154:4 | implicit dereference [postupdate] | semmle.label | implicit dereference [postupdate] |
99+
| builtin.go:154:2:154:4 | url [postupdate] | semmle.label | url [postupdate] |
101100
| builtin.go:154:13:154:22 | unsafehost | semmle.label | unsafehost |
102101
| builtin.go:156:21:156:23 | url | semmle.label | url |
103102
| builtin.go:156:21:156:32 | call to String | semmle.label | call to String |

0 commit comments

Comments
 (0)