YARA_Rules_Dataset / README.md
darkknight25's picture
Update README.md
92fb1f4 verified
---
license: mit
task_categories:
- text-classification
language:
- en
tags:
- cybersecurity
pretty_name: sunny thakur
size_categories:
- n<1K
---
YARA Rules Dataset for Ransomware Detection and Benign Software Classification
Overview
This dataset contains 700 YARA rules (R001–R700) designed for detecting ransomware variants and identifying benign software. It is curated for cybersecurity professionals, machine learning (ML) engineers, and data scientists to support threat detection, malware analysis, and ML model training for binary classification (malicious vs. benign). The dataset balances 350 malicious rules targeting ransomware and 350 benign rules for common software, ensuring robust training data.
Dataset Structure
The dataset is provided in JSONL format (yara_rules_dataset.jsonl), with each entry representing a single YARA rule. The fields are:
```
rule_id: Unique identifier (e.g., R001, R002, ..., R700).
rule_name: Descriptive name (e.g., WannaCry2, Benign_Nagios).
rule_text: YARA rule with metadata, strings, and conditions.
category: Type (Ransomware or Benign).
label: Classification (malicious or benign).
severity: Risk level (critical for ransomware, none for benign).
target_os: Affected platforms (Windows for ransomware, Linux for benign).
hash: Unique sample hash for reference.
```
Example Entry
```
{"rule_id": "R621", "rule_name": "Rakhni2", "rule_text": "rule Rakhni2 { meta: description = \"Detects Rakhni ransomware variant\" author = \"CyberSecTeam\" date = \"2032-03-10\" strings: $s1 = \"rakhni2\" nocase $s2 = \"ransom_v51\" condition: $s1 or $s2 }", "category": "Ransomware", "label": "malicious", "severity": "critical", "target_os": ["Windows"], "hash": "w1x2y3z4a5b6c7d8e9f0"}
```
Features
Malicious Rules: 350 rules targeting ransomware variants (e.g., WannaCry, Ryuk, Conti, LockBit) based on real-world TTPs from MITRE ATT&CK, CrowdStrike, and FireEye.
Benign Rules: 350 rules for common Linux tools (e.g., Nagios, Grafana, Htop) to reduce false positives in ML models.
YARA Syntax: Rules use case-insensitive (nocase) string matching, simple conditions (or for malicious, and for benign), and consistent metadata.
ML Compatibility: Balanced labels and structured JSONL format for training binary classifiers.
Platforms: Malicious rules target Windows; benign rules target Linux.
Use Cases
Threat Detection: Deploy YARA rules in SIEM or EDR systems for ransomware detection.
ML/AI Training: Use as a labeled dataset for training supervised models to classify malicious vs. benign files.
Pentesting: Validate detection capabilities in red team exercises.
Malware Analysis: Study ransomware signatures and benign software patterns.
Install dependencies (e.g., YARA):sudo apt-get install yara
Parse the JSONL file using Python:
```
import json
with open('yara_rules_dataset.jsonl', 'r') as f:
rules = [json.loads(line) for line in f]
```
Usage
Running YARA Rules
Compile and scan files with YARA:
```
yara -r rules.yar target_directory
```
To extract rules from JSONL:
import json
with open('yara_rules_dataset.jsonl', 'r') as f, open('rules.yar', 'w') as out:
for line in f:
rule = json.loads(line)
out.write(rule['rule_text'] + '\n')
ML Training
Use the dataset to train a binary classifier:
```
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
# Load dataset
df = pd.read_json('yara_rules_dataset.jsonl', lines=True)
# Extract features (e.g., rule_text) and labels
X = df['rule_text'] # Feature engineering needed
y = df['label'].map({'malicious': 1, 'benign': 0})
# Split data
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
# Train model (example)
model = RandomForestClassifier()
# model.fit(X_train, y_train) # Requires feature extraction
```
Sources
MITRE ATT&CK: https://attack.mitre.org
CrowdStrike Adversary Universe: https://www.crowdstrike.com
FireEye Threat Research: https://www.fireeye.com
CISA Alerts: https://www.cisa.gov
YARA Rules Repository: https://github.com/Yara-Rules/rules
Kaspersky APT Reports: https://securelist.com
Trend Micro Research: https://www.trendmicro.com
Contributing
We welcome contributions to expand the dataset or improve rules. To contribute:
Fork the repository.
Add new YARA rules in JSONL format, ensuring unique rule_id and valid syntax.
Submit a pull request with a clear description of changes.
Please adhere to the following:
Validate YARA rules with yara -C rules.yar.
Ensure balanced malicious/benign entries.
Cite sources for new rules.
License
This dataset is licensed under the MIT License. See LICENSE for details.
Contact
For issues or inquiries, open a GitHub issue or contact sunny48445@gmail.com
Last updated: June 8, 2025