|
1 | | -# vulnerable-dependencies |
2 | | -Simulates a repository with multiple projects, CPM, and vulnerable direct and transitive dependencies |
| 1 | +# Vulnerable Dependencies Demo |
| 2 | + |
| 3 | +This repository demonstrates a .NET 9 solution with multiple projects that contain vulnerable direct and transitive dependencies. It uses Central Package Management (CPM) to manage these dependencies. |
| 4 | + |
| 5 | +## Project Structure |
| 6 | + |
| 7 | +- **VulnerableApi**: A .NET 9 Web API project with vulnerable dependencies |
| 8 | + - Uses vulnerable Newtonsoft.Json settings |
| 9 | + - Contains SSRF vulnerability through user-controlled HTTP requests |
| 10 | + - Uses vulnerable JWT authentication configuration |
| 11 | + |
| 12 | +- **VulnerableLibrary**: A class library with vulnerable dependencies |
| 13 | + - Uses vulnerable regex patterns (potential ReDoS) |
| 14 | + - Contains outdated SharpZipLib reference |
| 15 | + - Uses vulnerable versions of System.Net.Http |
| 16 | + |
| 17 | +- **VulnerableConsole**: A console application that uses both direct and transitive dependencies |
| 18 | + - Uses vulnerable log4net version |
| 19 | + - Demonstrates vulnerable JSON serialization |
| 20 | + - References the VulnerableLibrary with its transitive dependencies |
| 21 | + |
| 22 | +## Vulnerability Examples |
| 23 | + |
| 24 | +This repository contains examples of: |
| 25 | + |
| 26 | +1. **Direct dependencies with known vulnerabilities**: |
| 27 | + - Newtonsoft.Json 12.0.3 (CVE-2020-0605) |
| 28 | + - System.Text.RegularExpressions 4.3.0 (CVE-2019-0820) |
| 29 | + - System.Net.Http 4.3.0 (CVE-2018-8292) |
| 30 | + |
| 31 | +2. **Transitive dependencies with vulnerabilities**: |
| 32 | + - Dependencies coming through Microsoft.AspNet.WebApi.Client |
| 33 | + - Dependencies coming through Microsoft.Data.OData |
| 34 | + |
| 35 | +3. **Vulnerable code patterns**: |
| 36 | + - TypeNameHandling.All in Newtonsoft.Json (CVE-2017-9785) |
| 37 | + - Regex patterns vulnerable to ReDoS |
| 38 | + - SSRF through unvalidated user input |
| 39 | + |
| 40 | +## Central Package Management |
| 41 | + |
| 42 | +The project uses Central Package Management (CPM) via the Directory.Packages.props file to define all package versions in a central location. |
| 43 | + |
| 44 | +## Running the Sample |
| 45 | + |
| 46 | +```powershell |
| 47 | +dotnet restore |
| 48 | +dotnet build |
| 49 | +``` |
| 50 | + |
| 51 | +## Security Analysis |
| 52 | + |
| 53 | +You can use various tools to detect the vulnerabilities in this sample: |
| 54 | + |
| 55 | +- NuGet Package Vulnerability Detection |
| 56 | +- Static Code Analysis tools |
| 57 | +- Dependency scanning tools |
| 58 | + |
| 59 | +## Note |
| 60 | + |
| 61 | +This is a demonstration repository used to illustrate vulnerable dependencies. Do not use any of this code in a production environment. |
0 commit comments