+
+
+
+Using a package with a known vulnerability is a security risk that could leave the
+software vulnerable to attack.
+
+
+This query reads the packages imported by the project build files and
+.config
files, and checks them against a list of packages with known
+vulnerabilities.
+
+
+
+
+
+Upgrade the package to the recommended version using, for example, the NuGet package manager,
+or by editing the project files directly.
+
+
+
+
+
+The following example shows a C# project file referencing package System.Net.Http
+version 4.3.1, which is vulnerable to CVE-2018-8292.
+
+
+
+The project file can be fixed by changing the version of the package to 4.3.4.
+
+
+
+
+
+
+OWASP: A9-Using Components with Known Vulnerabilities.
+
+
+
+
diff --git a/csharp/ql/src/Security Features/CWE-937/VulnerablePackage.ql b/csharp/ql/src/Security Features/CWE-937/VulnerablePackage.ql
new file mode 100644
index 000000000000..956317935076
--- /dev/null
+++ b/csharp/ql/src/Security Features/CWE-937/VulnerablePackage.ql
@@ -0,0 +1,19 @@
+/**
+ * @name Using a package with a known vulnerability
+ * @description Using a package with a known vulnerability is a security risk.
+ * Upgrade the package to a version that does not contain the vulnerability.
+ * @kind problem
+ * @problem.severity error
+ * @precision high
+ * @id cs/use-of-vulnerable-package
+ * @tags security
+ * external/cwe/cwe-937
+ */
+
+import csharp
+import Vulnerabilities
+
+from Vulnerability vuln, VulnerablePackage package
+where vuln = package.getVulnerability()
+select package, "Package '" + package + "' has vulnerability $@, and should be upgraded to version " + package.getFixedVersion() + ".",
+ vuln.getUrl(), vuln.toString()
diff --git a/csharp/ql/src/Security Features/CWE-937/VulnerablePackageBAD.csproj b/csharp/ql/src/Security Features/CWE-937/VulnerablePackageBAD.csproj
new file mode 100644
index 000000000000..b13494984ecb
--- /dev/null
+++ b/csharp/ql/src/Security Features/CWE-937/VulnerablePackageBAD.csproj
@@ -0,0 +1,15 @@
+