Skip to content

Commit debebb2

Browse files
committed
rewrite the qhelp for js/insecure-dependency
1 parent b7a0b87 commit debebb2

File tree

4 files changed

+46
-12
lines changed

4 files changed

+46
-12
lines changed

javascript/ql/src/Security/CWE-300/InsecureDependencyResolution.qhelp

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,54 @@
22
"-//Semmle//qhelp//EN"
33
"qhelp.dtd">
44
<qhelp>
5+
56
<overview>
6-
<p>Using an insecure protocol like HTTP or FTP to download your dependencies leaves your npm build vulnerable to a
7-
<a href="https://en.wikipedia.org/wiki/Man-in-the-middle_attack">Man in the Middle (MITM)</a>.
8-
This can allow attackers to inject malicious code into the artifacts that you are resolving and infect build artifacts
9-
that are being produced. This can be used by attackers to perform a
10-
<a href="https://en.wikipedia.org/wiki/Supply_chain_attack">Supply chain attack</a>
11-
against your project's users.
7+
<p>
8+
Using an insecure protocol like HTTP or FTP to download build dependencies makes the build process vulnerable to a
9+
Man in the Middle (MITM) attack.
10+
</p>
11+
<p>
12+
This can allow attackers to inject malicious code into the downloaded dependencies and thereby
13+
infect the build artifacts and execute arbitrary code on the machine building the artifacts.
1214
</p>
1315

1416
</overview>
1517
<recommendation>
1618

17-
<p>Always use HTTPS or SFTP to download artifacts from artifact servers.</p>
19+
<p>Always use HTTPS or SFTP when downloading artifacts from an URL.</p>
1820

1921
</recommendation>
2022

23+
<example>
24+
<p>
25+
The below example shows a <code>package.json</code> file that downloads a dependency using unencrypted HTTP.
26+
</p>
27+
<sample src="examples/bad-package.json" />
28+
<p>
29+
The fix is to change the protocol to HTTPS.
30+
</p>
31+
<sample src="examples/good-package.json" />
32+
33+
</example>
34+
2135
<references>
2236
<li>
23-
Research:
24-
<a href="https://medium.com/bugbountywriteup/want-to-take-over-the-java-ecosystem-all-you-need-is-a-mitm-1fc329d898fb?source=friends_link&amp;sk=3c99970c55a899ad9ef41f126efcde0e">
37+
Jonathan Leitschuh:
38+
<a href="https://infosecwriteups.com/want-to-take-over-the-java-ecosystem-all-you-need-is-a-mitm-1fc329d898fb">
2539
Want to take over the Java ecosystem? All you need is a MITM!
2640
</a>
2741
</li>
2842
<li>
29-
Research:
43+
Max Veytsman:
3044
<a href="https://max.computer/blog/how-to-take-over-the-computer-of-any-java-or-clojure-or-scala-developer/">
3145
How to take over the computer of any Java (or Closure or Scala) Developer.
3246
</a>
3347
</li>
48+
<li>
49+
Wikipedia: <a href="https://en.wikipedia.org/wiki/Supply_chain_attack">Supply chain attack</a>
50+
</li>
51+
<li>
52+
Wikipedia: <a href="https://en.wikipedia.org/wiki/Man-in-the-middle_attack">Man-in-the-middle attack</a>
53+
</li>
3454
</references>
3555
</qhelp>

javascript/ql/src/Security/CWE-300/InsecureDependencyResolution.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* @name Dependency download using unencrypted communication channel
3-
* @description Using unencrypted HTTP URLs to fetch dependencies can leave an application
3+
* @description Using unencrypted protocols to fetch dependencies can leave an application
44
* open to man in the middle attacks.
55
* @kind problem
66
* @problem.severity warning
77
* @security-severity 8.1
88
* @precision high
9-
* @id js/http-dependency
9+
* @id js/insecure-dependency
1010
* @tags security
1111
* external/cwe/cwe-300
1212
* external/cwe/cwe-319
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "example-project",
3+
"dependencies": {
4+
"unencrypted": "http://example.org/foo/tarball/release/0.0.1",
5+
"lodash": "^4.0.0"
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "example-project",
3+
"dependencies": {
4+
"unencrypted": "https://example.org/foo/tarball/release/0.0.1",
5+
"lodash": "^4.0.0"
6+
}
7+
}

0 commit comments

Comments
 (0)