Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8715c1b

Browse files
committed
JS: Port HostHeaderPoisoningInEmailGeneration
1 parent bc88f50 commit 8715c1b

3 files changed

Lines changed: 30 additions & 20 deletions

File tree

javascript/ql/lib/semmle/javascript/security/dataflow/HostHeaderPoisoningInEmailGenerationQuery.qll

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,28 @@
66
import javascript
77

88
/**
9-
* A taint tracking configuration for host header poisoning in email generation.
9+
* A taint tracking configuration for host header poisoning.
1010
*/
11-
class Configuration extends TaintTracking::Configuration {
11+
module HostHeaderPoisoningConfig implements DataFlow::ConfigSig {
12+
predicate isSource(DataFlow::Node node) {
13+
exists(Http::RequestHeaderAccess input | node = input |
14+
input.getKind() = "header" and
15+
input.getAHeaderName() = "host"
16+
)
17+
}
18+
19+
predicate isSink(DataFlow::Node node) { exists(EmailSender email | node = email.getABody()) }
20+
}
21+
22+
/**
23+
* Taint tracking configuration host header poisoning.
24+
*/
25+
module HostHeaderPoisoningFlow = TaintTracking::Global<HostHeaderPoisoningConfig>;
26+
27+
/**
28+
* DEPRECATED. Use the `HostHeaderPoisoningFlow` module instead.
29+
*/
30+
deprecated class Configuration extends TaintTracking::Configuration {
1231
Configuration() { this = "TaintedHostHeader" }
1332

1433
override predicate isSource(DataFlow::Node node) {

javascript/ql/src/Security/CWE-640/HostHeaderPoisoningInEmailGeneration.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
import javascript
1515
import semmle.javascript.security.dataflow.HostHeaderPoisoningInEmailGenerationQuery
16-
import DataFlow::PathGraph
16+
import HostHeaderPoisoningFlow::PathGraph
1717

18-
from Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink
19-
where cfg.hasFlowPath(source, sink)
18+
from HostHeaderPoisoningFlow::PathNode source, HostHeaderPoisoningFlow::PathNode sink
19+
where HostHeaderPoisoningFlow::flowPath(source, sink)
2020
select sink.getNode(), source, sink, "Links in this email can be hijacked by poisoning the $@.",
2121
source.getNode(), "HTTP host header"
Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
1-
nodes
2-
| tst.js:17:11:17:113 | `Hi, lo ... token}` |
3-
| tst.js:17:11:17:113 | `Hi, lo ... token}` |
4-
| tst.js:17:84:17:91 | req.host |
5-
| tst.js:17:84:17:91 | req.host |
6-
| tst.js:18:11:18:127 | `Hi, lo ... reset.` |
7-
| tst.js:18:11:18:127 | `Hi, lo ... reset.` |
8-
| tst.js:18:78:18:85 | req.host |
9-
| tst.js:18:78:18:85 | req.host |
101
edges
112
| tst.js:17:84:17:91 | req.host | tst.js:17:11:17:113 | `Hi, lo ... token}` |
12-
| tst.js:17:84:17:91 | req.host | tst.js:17:11:17:113 | `Hi, lo ... token}` |
13-
| tst.js:17:84:17:91 | req.host | tst.js:17:11:17:113 | `Hi, lo ... token}` |
14-
| tst.js:17:84:17:91 | req.host | tst.js:17:11:17:113 | `Hi, lo ... token}` |
15-
| tst.js:18:78:18:85 | req.host | tst.js:18:11:18:127 | `Hi, lo ... reset.` |
16-
| tst.js:18:78:18:85 | req.host | tst.js:18:11:18:127 | `Hi, lo ... reset.` |
17-
| tst.js:18:78:18:85 | req.host | tst.js:18:11:18:127 | `Hi, lo ... reset.` |
183
| tst.js:18:78:18:85 | req.host | tst.js:18:11:18:127 | `Hi, lo ... reset.` |
4+
nodes
5+
| tst.js:17:11:17:113 | `Hi, lo ... token}` | semmle.label | `Hi, lo ... token}` |
6+
| tst.js:17:84:17:91 | req.host | semmle.label | req.host |
7+
| tst.js:18:11:18:127 | `Hi, lo ... reset.` | semmle.label | `Hi, lo ... reset.` |
8+
| tst.js:18:78:18:85 | req.host | semmle.label | req.host |
9+
subpaths
1910
#select
2011
| tst.js:17:11:17:113 | `Hi, lo ... token}` | tst.js:17:84:17:91 | req.host | tst.js:17:11:17:113 | `Hi, lo ... token}` | Links in this email can be hijacked by poisoning the $@. | tst.js:17:84:17:91 | req.host | HTTP host header |
2112
| tst.js:18:11:18:127 | `Hi, lo ... reset.` | tst.js:18:78:18:85 | req.host | tst.js:18:11:18:127 | `Hi, lo ... reset.` | Links in this email can be hijacked by poisoning the $@. | tst.js:18:78:18:85 | req.host | HTTP host header |

0 commit comments

Comments
 (0)