Cybersecurity fundamentals project demonstrating encryption, authentication, and vulnerability analysis techniques. Educational resource for understanding modern security practices.
Python
0
14 commits
updated Feb 5, 2026
Protecting your software supply chain from typosquatting, malicious packages, and supply chain attacks
Features • Demo • Installation • Usage • Architecture • Contributing
ChainGuard is an advanced security tool designed to protect Python projects from software supply chain attacks. Built as a comprehensive security scanner, it detects malicious packages, typosquatting attempts, and vulnerable dependencies through multi-layered analysis combining CVE databases, static analysis, dynamic behavior monitoring, and threat intelligence.
Software supply chain attacks have surged by 300% in recent years. Attackers exploit developer trust by:
reqests instead of requests)ChainGuard employs four complementary security analysis techniques:
| Layer | Detection Method | Coverage |
|---|---|---|
| CVE Scanning | Known vulnerability databases | Published CVEs |
| Static Analysis | AST-based code inspection | Malicious patterns, suspicious imports |
| Dynamic Analysis | Runtime behavior monitoring | Network calls, file operations |
| Threat Intelligence | Community-sourced indicators | Typosquatting, malicious packages |
Uses Levenshtein Distance algorithm to identify packages suspiciously similar to popular libraries:
Distance("requests", "reqests") = 1 ⚠️ HIGH RISK
Distance("numpy", "numpz") = 1 ⚠️ HIGH RISK
subprocess, socket, eval)ChainGuard successfully identified 5 malicious and 1 suspicious package out of 24 analyzed dependencies.
Performance Comparison:
| Tool | Total Packages | Malicious | Suspicious | Detection Basis |
|---|---|---|---|---|
| ChainGuard | 24 | 5 | 1 | CVE + Static + Dynamic + TI |
| pip-audit | 24 | 1 | 0 | CVE / OSV only |
ChainGuard leverages behavioral, structural, and threat intelligence indicators beyond traditional vulnerability databases.
git clone https://github.com/alirkal34-jpg/ChainGuard.git
cd ChainGuard/ChainGuard-main
pip install -r requirements.txt
For advanced AI-powered threat analysis:
pip install google-generativeai
export GEMINI_API_KEY="your-api-key-here"
cd ChainGuard-main/src
python chain_guard.py
Workflow:
from chain_guard import ChainGuardScanner
scanner = ChainGuardScanner()
results = scanner.scan_project("/path/to/project")
scanner.generate_report(results)
┌─────────────────────────────────────────────────────────────┐
│ ChainGuard Core │
├─────────────────────────────────────────────────────────────┤
│ ┌───────────────┐ ┌──────────────┐ ┌─────────────────┐ │
│ │ File Scanner │→│ AST Parser │→│ Package │ │
│ │ │ │ │ │ Extractor │ │
│ └───────────────┘ └──────────────┘ └─────────────────┘ │
├─────────────────────────────────────────────────────────────┤
│ Security Analysis Engine │
├─────────────────────────────────────────────────────────────┤
│ ┌──────────────┐ ┌──────────────┐ ┌─────────────────┐ │
│ │ CVE Scanner │ │ Static │ │ Dynamic │ │
│ │ │ │ Analyzer │ │ Monitor │ │
│ └──────────────┘ └──────────────┘ └─────────────────┘ │
│ ┌──────────────┐ ┌──────────────┐ ┌─────────────────┐ │
│ │ Typosquat │ │ Metadata │ │ Threat │ │
│ │ Detector │ │ Validator │ │ Intelligence │ │
│ └──────────────┘ └──────────────┘ └─────────────────┘ │
├─────────────────────────────────────────────────────────────┤
│ Reporting & Visualization │
└─────────────────────────────────────────────────────────────┘
AST-based taint analysis for tracking user input through code execution paths.
class DataFlowAnalyzer(ast.NodeVisitor):
"""Tracks data flow from sources (user input) to sinks (dangerous functions)"""
- Monitors: input(), sys.argv, os.environ, request.*
- Detects: Code injection, command injection, path traversal
Multi-layered package analysis with configurable detection strategies.
Tkinter-based interface for intuitive project scanning and result visualization.
Create config.json in the project root:
{
"threshold": {
"levenshtein_distance": 2,
"risk_score": 50
},
"excluded_packages": ["internal-pkg"],
"trusted_sources": ["pypi.org"],
"enable_ai": false
}
ChainGuard/
├── ChainGuard-main/
│ ├── src/
│ │ ├── chain_guard.py # Main GUI application
│ │ └── app.py # Test application
│ ├── requirements.txt # Python dependencies
│ └── README.md # This file
├── LICENSE # MIT License
└── .gitignore # Git ignore rules
This project was developed for the Introduction to Cybersecurity course, based on comprehensive research into:
Contributions are welcome! Please follow these steps:
git checkout -b feature/AmazingFeature)git commit -m 'Add AmazingFeature')git push origin feature/AmazingFeature)See CONTRIBUTING.md for detailed guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
Ali Rubar Kal
⭐ Star this repository if you find it helpful!
Made with ❤️ for a safer software supply chain
14 commits
Python
100.0%
Cybersecurity fundamentals project demonstrating encryption, authentication, and vulnerability analysis techniques. Educational resource for understanding modern security practices.
Python
0
14 commits
updated Feb 5, 2026
Protecting your software supply chain from typosquatting, malicious packages, and supply chain attacks
Features • Demo • Installation • Usage • Architecture • Contributing
ChainGuard is an advanced security tool designed to protect Python projects from software supply chain attacks. Built as a comprehensive security scanner, it detects malicious packages, typosquatting attempts, and vulnerable dependencies through multi-layered analysis combining CVE databases, static analysis, dynamic behavior monitoring, and threat intelligence.
Software supply chain attacks have surged by 300% in recent years. Attackers exploit developer trust by:
reqests instead of requests)ChainGuard employs four complementary security analysis techniques:
| Layer | Detection Method | Coverage |
|---|---|---|
| CVE Scanning | Known vulnerability databases | Published CVEs |
| Static Analysis | AST-based code inspection | Malicious patterns, suspicious imports |
| Dynamic Analysis | Runtime behavior monitoring | Network calls, file operations |
| Threat Intelligence | Community-sourced indicators | Typosquatting, malicious packages |
Uses Levenshtein Distance algorithm to identify packages suspiciously similar to popular libraries:
Distance("requests", "reqests") = 1 ⚠️ HIGH RISK
Distance("numpy", "numpz") = 1 ⚠️ HIGH RISK
subprocess, socket, eval)ChainGuard successfully identified 5 malicious and 1 suspicious package out of 24 analyzed dependencies.
Performance Comparison:
| Tool | Total Packages | Malicious | Suspicious | Detection Basis |
|---|---|---|---|---|
| ChainGuard | 24 | 5 | 1 | CVE + Static + Dynamic + TI |
| pip-audit | 24 | 1 | 0 | CVE / OSV only |
ChainGuard leverages behavioral, structural, and threat intelligence indicators beyond traditional vulnerability databases.
git clone https://github.com/alirkal34-jpg/ChainGuard.git
cd ChainGuard/ChainGuard-main
pip install -r requirements.txt
For advanced AI-powered threat analysis:
pip install google-generativeai
export GEMINI_API_KEY="your-api-key-here"
cd ChainGuard-main/src
python chain_guard.py
Workflow:
from chain_guard import ChainGuardScanner
scanner = ChainGuardScanner()
results = scanner.scan_project("/path/to/project")
scanner.generate_report(results)
┌─────────────────────────────────────────────────────────────┐
│ ChainGuard Core │
├─────────────────────────────────────────────────────────────┤
│ ┌───────────────┐ ┌──────────────┐ ┌─────────────────┐ │
│ │ File Scanner │→│ AST Parser │→│ Package │ │
│ │ │ │ │ │ Extractor │ │
│ └───────────────┘ └──────────────┘ └─────────────────┘ │
├─────────────────────────────────────────────────────────────┤
│ Security Analysis Engine │
├─────────────────────────────────────────────────────────────┤
│ ┌──────────────┐ ┌──────────────┐ ┌─────────────────┐ │
│ │ CVE Scanner │ │ Static │ │ Dynamic │ │
│ │ │ │ Analyzer │ │ Monitor │ │
│ └──────────────┘ └──────────────┘ └─────────────────┘ │
│ ┌──────────────┐ ┌──────────────┐ ┌─────────────────┐ │
│ │ Typosquat │ │ Metadata │ │ Threat │ │
│ │ Detector │ │ Validator │ │ Intelligence │ │
│ └──────────────┘ └──────────────┘ └─────────────────┘ │
├─────────────────────────────────────────────────────────────┤
│ Reporting & Visualization │
└─────────────────────────────────────────────────────────────┘
AST-based taint analysis for tracking user input through code execution paths.
class DataFlowAnalyzer(ast.NodeVisitor):
"""Tracks data flow from sources (user input) to sinks (dangerous functions)"""
- Monitors: input(), sys.argv, os.environ, request.*
- Detects: Code injection, command injection, path traversal
Multi-layered package analysis with configurable detection strategies.
Tkinter-based interface for intuitive project scanning and result visualization.
Create config.json in the project root:
{
"threshold": {
"levenshtein_distance": 2,
"risk_score": 50
},
"excluded_packages": ["internal-pkg"],
"trusted_sources": ["pypi.org"],
"enable_ai": false
}
ChainGuard/
├── ChainGuard-main/
│ ├── src/
│ │ ├── chain_guard.py # Main GUI application
│ │ └── app.py # Test application
│ ├── requirements.txt # Python dependencies
│ └── README.md # This file
├── LICENSE # MIT License
└── .gitignore # Git ignore rules
This project was developed for the Introduction to Cybersecurity course, based on comprehensive research into:
Contributions are welcome! Please follow these steps:
git checkout -b feature/AmazingFeature)git commit -m 'Add AmazingFeature')git push origin feature/AmazingFeature)See CONTRIBUTING.md for detailed guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
Ali Rubar Kal
⭐ Star this repository if you find it helpful!
Made with ❤️ for a safer software supply chain
14 commits
Python
100.0%