
CVE-2025-6218 - WinRARパストラバーサルRCE脆弱性(バージョン7.11以前に影響)の包括的な分析と概念実証
⚠️ 重大な脆弱性 - 積極的な悪用が確認されました
CVE-2025-6218 は、WinRAR におけるパストラバーサルの深刻な脆弱性で、任意のコード実行を可能にします。現在、APT グループ(GOFFEE、Bitter(APT-C-08)、Gamaredon など)によって悪用されています。
CVE-2025-6218 は、Windows 版 WinRAR における深刻なパストラバーサルの脆弱性であり、攻撃者に任意のコード実行を許します。
| 項目 | 詳細 |
|---|---|
| CVSS スコア | 7.8(高) |
| 影響を受けるバージョン | WinRAR ≤ 7.11(Windows のみ) |
| 対象プラットフォーム | Windows 10、11、Server |
| 影響を受けるユーザー数 | 約5億人 |
| 修正版 | WinRAR 7.12(2025年6月) |
| ステータス | 🔴 現在も悪用中 |
| CISA KEV | 2025年12月9日追加 |
攻撃者は以下のことが可能です:
WinRAR は、特殊な .rar アーカイブ内のファイルパスを正しく検証しません。ユーザーが不正なアーカイブを展開すると、パストラバーサル(../ または ..\\)シーケンスを使用して、想定された展開先フォルダの外の任意のパスにファイルが書き込まれる可能性があります。
// Pseudocodice - WinRAR v7.11 (VULNERABILE) void extract_file(rar_entry *entry, char *dest_dir) { char final_path[MAX_PATH];
strcpy(final_path, dest_dir); // "C:\\Temp\\"
strcat(final_path, entry->filename); // + "..\\..\\..\\Windows\\System32\\malware.exe"
// ❌ ERRORE: Nessuna validazione del path traversal!
// final_path = "C:\\Temp\\..\\..\\..\\Windows\\System32\\malware.exe"
// Risolto come: "C:\\Windows\\System32\\malware.exe" ← EXPLOIT!
create_file(final_path); // File creato in directory non intesa
}
### v7.11 で欠けている保護
- ❌ ファイルが `dest_dir` 内に残っているかどうかのチェックがない
- ❌ `..` や `.` シーケンスに対するフィルタがない
- ❌ パスの正規化がない
- ❌ 許可されたディレクトリのホワイトリストがない
- ❌ コンテインメントの検証がない
### v7.12 での修正```c
// WinRAR v7.12 (PATCHED)
bool is_path_contained(char *path, char *base_dir) {
char canonical[MAX_PATH], canonical_base[MAX_PATH];
// Normalizza entrambi i percorsi
GetFullPathName(path, MAX_PATH, canonical, NULL);
GetFullPathName(base_dir, MAX_PATH, canonical_base, NULL);
// Verifica contenimento
if (strncmp(canonical, canonical_base, strlen(canonical_base)) != 0) {
return false; // Path esce dalla directory base
}
return true;
}
void extract_file_safe(rar_entry *entry, char *dest_dir) {
char final_path[MAX_PATH];
strcpy(final_path, dest_dir);
strcat(final_path, entry->filename);
// ✅ FIX: Verifica che il file rimane dentro dest_dir
if (!is_path_contained(final_path, dest_dir)) {
skip_extraction(); // Rifiuta estrazione
log_error("Path traversal detected!");
return;
}
create_file(final_path); // Adesso sicuro
}
Cartella di Estrazione: C:\Temp\Extract
Path nel RAR (craft): ..\..\..\..\Users\\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\payload.bat
Risoluzione Path: C:\Temp\Extract\.. = C:\Temp\ C:\Temp\.. = C:\ C:\.. = C:\ (non può andare oltre)
= C:\Users\\AppData\Roaming\...\Startup\payload.bat ✓
### 攻撃フロー図```
┌─────────────────────────────────────────────┐
│ 1. Attaccante crea RAR con path craft │
│ es: ..\\..\\..\\Startup\\malware.bat │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 2. Distribuzione via spear-phishing │
│ Email mirata con allegato RAR │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 3. Vittima estrae archivio con WinRAR │
│ (versione ≤ 7.11) │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 4. WinRAR non valida path traversal │
│ File estratto in Startup folder │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 5. Al boot: payload eseguito │
│ RAT stabilisce C2 connection │
└─────────────────────────────────────────────┘
| バージョン | ステータス | 注記 |
|---|---|---|
| ≤ 7.10 | 🔴 脆弱 | すべてのエクスプロイトが動作します |
| 7.11 | 🔴 脆弱 | 最後の脆弱バージョン |
| 7.12 Beta 1+ | 🟢 修正済み | パストラバーサルを修正 |
| 7.12+ | 🟢 修正済み | 修正を含む安定リリース |
| UNIX / Android | ✅ 影響なし | Windows以外のバージョンは影響を受けません |
(Get-Item "C:\Program Files\WinRAR\WinRAR.exe").VersionInfo.FileVersion
wmic datafile where name="C:\\Program Files\\WinRAR\\WinRAR.exe" get Version
---
## 🌍 攻撃シナリオ
### シナリオ 1: Bitter/APT-C-08 スピアフィッシング(アクティブ確認済み)
**対象**: 政府、軍事組織、戦略機関```
Email Phishing:
From: [email protected]
Subject: "Provision of Information for Sectoral for AJK.rar"
Attachment: Provision_of_Information.rar
Contenuto Archive:
├── Document.docx (esca legittima - report convincente)
└── ..\\..\\..\\..\\Users\\User\\AppData\\Roaming\\Microsoft\\Office\\STARTUP\\Template.dotm
(macro malato nascosto)
Esecuzione:
1. Vittima estrae RAR
2. WinRAR non valida path → Template.dotm finisce in Office STARTUP
3. Prossimo avvio Word → Macro eseguita automaticamente
4. PowerShell downloader attivato
5. C# Trojan scaricato: WmRAT, MiyaRAT, ZxxZ
6. C2 Server: johnfashionaccess.com
7. Capabilities:
- Keylogging
- Screenshot capture
- RDP credential stealing
- File exfiltration
- Lateral movement
目標: ロシア政府機関``` RAR specializzato: ├── run.bat (path: ..\..\..\..\Windows\Startup\run.bat) └── legitimate_document.pdf (esca)
Attack Chain:
### シナリオ3: ランサムウェア配信```
RAR Weaponized:
└── locker.exe (path: ..\\..\\..\\Startup\\locker.exe)
Infezione:
1. Estrazione RAR
2. locker.exe → Startup folder
3. Sistema reboota (naturale o forzato)
4. locker.exe eseguito con diritti user
5. File system encryption
6. Ransom note displayed
7. Bitcoin payment richiesto