How To Scan For OSS Vulnerabilities Using OWASP Dependency Check In .Net 6.0


OWASP Dependency Check is a powerful tool that helps developers identify and remediate vulnerabilities in their application's dependencies. This article will create a simple "Hello, World!" C# .NET Core application and use OWASP Dependency Check to scan its dependencies for vulnerabilities.

Discover a comprehensive and informative article on the topic of OWASP, covering everything from its mission and history to its most important tools and resources here- Introduction To OWASP


Before we begin, make sure you have the following prerequisites installed,

  • .NET 6.0 SDK
  • OWASP Dependency Check

Creating the C# .NET 6.0 application

The first step in using OWASP Dependency Check is to create a C# .NET Core application that we can scan for vulnerabilities. We will create a simple "Hello, World!" application that uses the Newtonsoft.Json library.

  1. Open a command prompt or terminal window.
  2. Create a new directory for the project: mkdir dependency-check-demo
  3. Change to the new directory- cd dependency-check-demo
  4. Create a new .NET 6.0 Console application: dotnet new console
  5. Add the Newtonsoft.Json package to the project: dotnet add package Newtonsoft.Json
  6. Open the project in your favourite code editor.

In the Program.cs file, replace the contents with the following,

using System;
using Newtonsoft.Json;
using Newtonsoft.Json;
Console.WriteLine("Hello, World!");
var json = @"{'name':'James','age':40}";
dynamic obj = JsonConvert.DeserializeObject(json);
Console.WriteLine($"Hello, {}!");

Save the file and exit the code editor.

Running the C# .NET 6.0 application

Before we can scan the application for vulnerabilities, we need to compile and run it. We can do this using the following commands,

Restore the application's dependencies: dotnet restore

Build the application: dotnet build

Run the application: dotnet run

If everything worked correctly, you should see the message "Hello, John Smith!" printed on the console.

Scanning the application with OWASP Dependency Check

Now that we have a C# .NET 6.0 application, we can use OWASP Dependency Check to scan its dirdependencies for vulnerabilities. We can do this using the following command:

dependency-check --scan . --format HTML --project "dependency-check-demo" --out . --disableAssemblyScan

This command tells OWASP Dependency Check to scan the current directory (.) for dependencies, output the results in HTML format, set the project name to "dependency-check-demo", and disable scanning of assemblies (since our application doesn't use any).

After running the command, you should see a new dependency-check-report.html file in the current directory. Open this file in your web browser to view the scan results.


In this article, we created a simple "Hello, World!" C# .NET 6.0 application and used OWASP Dependency Check to scan its dependencies for vulnerabilities. With its support for a wide range of programming languages and package managers, OWASP Dependency Check is a versatile and useful tool for developers and security professionals. By regularly scanning our applications with this tool, we can help ensure that our applications are secure and free from unnecessary risks.


Similar Articles