|
| 1 | +# Dependency Analysis |
| 2 | + |
| 3 | +## Vulnerable Dependency in Multiple Paths |
| 4 | + |
| 5 | +This project demonstrates a vulnerable dependency (`commons-collections:3.2.1`) appearing in multiple paths in the dependency graph. |
| 6 | + |
| 7 | +### The Vulnerable Package |
| 8 | + |
| 9 | +**Package**: `commons-collections:3.2.1` |
| 10 | + |
| 11 | +**Known Vulnerabilities**: |
| 12 | +- CVE-2015-7501: Apache Commons Collections InvokerTransformer class allows remote attackers to execute arbitrary Java code via crafted serialized objects through unsafe deserialization |
| 13 | +- This vulnerability affects commons-collections versions 3.0 through 3.2.1 |
| 14 | + |
| 15 | +### Dependency Paths |
| 16 | + |
| 17 | +The `commons-collections:3.2.1` package appears in the following paths in the dependency graph: |
| 18 | + |
| 19 | +1. **Direct Dependency** |
| 20 | + ``` |
| 21 | + vulnerable-app |
| 22 | + └── commons-collections:3.2.1 |
| 23 | + ``` |
| 24 | + |
| 25 | +2. **Transitive Dependency via commons-beanutils** |
| 26 | + ``` |
| 27 | + vulnerable-app |
| 28 | + └── commons-beanutils:1.9.2 |
| 29 | + └── commons-collections:3.2.1 |
| 30 | + ``` |
| 31 | + |
| 32 | +3. **Transitive Dependency via commons-digester** |
| 33 | + ``` |
| 34 | + vulnerable-app |
| 35 | + └── commons-digester:2.1 |
| 36 | + └── commons-beanutils:1.8.3 |
| 37 | + └── commons-collections:3.2.1 |
| 38 | + ``` |
| 39 | + |
| 40 | +### Verification |
| 41 | + |
| 42 | +To verify that the package appears in multiple paths, run: |
| 43 | + |
| 44 | +```bash |
| 45 | +mvn dependency:tree -Dverbose |
| 46 | +``` |
| 47 | + |
| 48 | +Look for lines showing `commons-collections` with annotations like "omitted for duplicate" which indicates it's being pulled in through multiple paths. |
| 49 | + |
| 50 | +Example output: |
| 51 | +``` |
| 52 | +[INFO] +- commons-collections:commons-collections:jar:3.2.1:compile |
| 53 | +[INFO] +- commons-beanutils:commons-beanutils:jar:1.9.2:compile |
| 54 | +[INFO] | \- (commons-collections:commons-collections:jar:3.2.1:compile - omitted for duplicate) |
| 55 | +[INFO] +- commons-digester:commons-digester:jar:2.1:compile |
| 56 | +[INFO] | +- (commons-beanutils:commons-beanutils:jar:1.8.3:compile - omitted for conflict with 1.9.2) |
| 57 | +[INFO] | \- (commons-collections:commons-collections:jar:3.2.1:compile - would be included) |
| 58 | +``` |
| 59 | + |
| 60 | +The key indicators are: |
| 61 | +- "omitted for duplicate" means the same dependency version is already included from another path |
| 62 | +- "omitted for conflict" means a different version of the same dependency is already included from another path |
| 63 | +- Both indicate multiple paths to the same or similar dependencies |
| 64 | + |
| 65 | +### Why This Matters |
| 66 | + |
| 67 | +In real-world scenarios, vulnerable dependencies often appear in multiple paths through the dependency graph. This makes them: |
| 68 | +- More challenging to identify |
| 69 | +- Harder to remediate (requires updating multiple parent dependencies) |
| 70 | +- More likely to be overlooked by basic security scanning |
| 71 | + |
| 72 | +This repository intentionally includes this pattern to demonstrate how dependency scanning tools like GitHub's Dependabot and CodeQL can detect such vulnerabilities across the entire dependency graph. |
| 73 | + |
| 74 | +## Viewing the Full Dependency Graph |
| 75 | + |
| 76 | +To see the complete dependency tree: |
| 77 | + |
| 78 | +```bash |
| 79 | +# Standard view (duplicates are omitted) |
| 80 | +mvn dependency:tree |
| 81 | + |
| 82 | +# Verbose view (shows all paths including duplicates) |
| 83 | +mvn dependency:tree -Dverbose |
| 84 | + |
| 85 | +# Filter to see only commons-related dependencies |
| 86 | +mvn dependency:tree -Dverbose | grep commons |
| 87 | +``` |
| 88 | + |
| 89 | +## Security Recommendations |
| 90 | + |
| 91 | +⚠️ **For educational purposes only** |
| 92 | + |
| 93 | +In a production environment, you would: |
| 94 | +1. Upgrade to a patched version of the vulnerable library |
| 95 | +2. If no patch exists, find alternative libraries |
| 96 | +3. Use dependency scanning tools to continuously monitor for vulnerabilities |
| 97 | +4. Implement Software Composition Analysis (SCA) in your CI/CD pipeline |
0 commit comments