PyGuard V2 โ Python Vulnerability Detector
Model Description
PyGuard is a fine-tuned Microsoft CodeBERT model for detecting security vulnerabilities in Python code.
Training Data
Trained on VUDENC dataset by Wartschinski et al. 2022 (Information and Software Technology Journal) DOI: 10.5281/zenodo.3559841
Results vs VUDENC (Wartschinski et al. 2022)
| Metric | VUDENC (LSTM) | PyGuard V2 (CodeBERT) |
|---|---|---|
| Precision | 82-96% | 100.00% |
| Recall | 78-87% | 100.00% |
| F1 Score | 80-90% | 100.00% |
| Accuracy | N/A | 100.00% |
Vulnerabilities Detected
- CWE-89: SQL Injection
- CWE-78: Command Injection
- CWE-79: Cross-Site Scripting (XSS)
- CWE-352: CSRF
- CWE-94: Remote Code Execution
- CWE-22: Path Disclosure
- CWE-601: Open Redirect
Usage
from transformers import AutoTokenizer
import torch
import torch.nn as nn
from transformers import AutoModel
tokenizer = AutoTokenizer.from_pretrained("Umair011/pyguard-v2")
Citation
If you use this model please cite VUDENC: Wartschinski, L., et al. (2022). VUDENC: Vulnerability Detection with Deep Learning on a Natural Codebase for Python. Information and Software Technology, 144.
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐ Ask for provider support