ストーリー
佐
佐藤CTO
脆弱性を見つけた。次は修正だ。でもどの脆弱性から手をつける?
佐
佐藤CTO
CVSSスコア9.8のSQLインジェクションとCVSSスコア5.3のXSS。リソースが限られている場合、どちらを先に修正する?
佐
佐藤CTO
正解だ。CVSSは脆弱性の深刻度を定量的に評価するための共通指標だ。これに加えて、実際のビジネス影響を考慮して優先順位を決める
CVSS(Common Vulnerability Scoring System)
CVSSv3.1の構成
| グループ | 評価対象 | 変動 |
|---|
| Base Metrics | 脆弱性の固有の特性 | 変化しない |
| Temporal Metrics | 時間経過による変化(パッチ有無等) | 時間で変化 |
| Environmental Metrics | 環境固有の影響 | 組織ごとに異なる |
Base Metricsの詳細
| 指標 | 説明 | 値 |
|---|
| Attack Vector (AV) | 攻撃に必要なネットワークアクセス | Network / Adjacent / Local / Physical |
| Attack Complexity (AC) | 攻撃の複雑さ | Low / High |
| Privileges Required (PR) | 必要な権限レベル | None / Low / High |
| User Interaction (UI) | ユーザーの操作が必要か | None / Required |
| Scope (S) | 影響範囲の変化 | Unchanged / Changed |
| Confidentiality (C) | 機密性への影響 | None / Low / High |
| Integrity (I) | 完全性への影響 | None / Low / High |
| Availability (A) | 可用性への影響 | None / Low / High |
CVSSスコアとリスクレベル
| スコア | リスクレベル | 対応期限(例) |
|---|
| 9.0-10.0 | Critical | 24時間以内 |
| 7.0-8.9 | High | 7日以内 |
| 4.0-6.9 | Medium | 30日以内 |
| 0.1-3.9 | Low | 90日以内 |
| 0.0 | None | 対応不要 |
// CVSS計算の概念的な実装
interface CvssVector {
attackVector: 'Network' | 'Adjacent' | 'Local' | 'Physical';
attackComplexity: 'Low' | 'High';
privilegesRequired: 'None' | 'Low' | 'High';
userInteraction: 'None' | 'Required';
scope: 'Unchanged' | 'Changed';
confidentiality: 'None' | 'Low' | 'High';
integrity: 'None' | 'Low' | 'High';
availability: 'None' | 'Low' | 'High';
}
// 具体例: SQLインジェクション(CVSS 9.8)
const sqliVector: CvssVector = {
attackVector: 'Network', // ネットワーク経由
attackComplexity: 'Low', // 容易
privilegesRequired: 'None', // 権限不要
userInteraction: 'None', // 操作不要
scope: 'Unchanged',
confidentiality: 'High', // 全データ漏洩
integrity: 'High', // データ改ざん可能
availability: 'High', // サービス停止可能
};
// CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H = 9.8
// 具体例: Reflected XSS(CVSS 6.1)
const xssVector: CvssVector = {
attackVector: 'Network',
attackComplexity: 'Low',
privilegesRequired: 'None',
userInteraction: 'Required', // ユーザーがリンクをクリックする必要
scope: 'Changed',
confidentiality: 'Low', // セッション情報の漏洩
integrity: 'Low', // DOM操作
availability: 'None', // 可用性への影響なし
};
// CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N = 6.1
修正の優先順位付け
リスクベースの優先順位決定
// ビジネスインパクトを考慮した優先順位決定
interface VulnerabilityPrioritization {
vulnerabilityId: string;
cvssScore: number;
businessImpact: {
affectedAssets: string[];
dataClassification: 'Restricted' | 'Confidential' | 'Internal' | 'Public';
revenueImpact: 'Critical' | 'High' | 'Medium' | 'Low';
regulatoryImpact: boolean;
customerFacing: boolean;
};
exploitability: {
knownExploit: boolean;
exploitInWild: boolean;
exploitMaturity: 'Weaponized' | 'PoC' | 'Theoretical' | 'Unknown';
};
remediationEffort: {
estimatedHours: number;
complexity: 'Low' | 'Medium' | 'High';
breakingChange: boolean;
testingRequired: 'Unit' | 'Integration' | 'Full Regression';
};
priorityScore: number; // 0-100
deadline: string;
}
function calculatePriority(vuln: VulnerabilityPrioritization): number {
let score = vuln.cvssScore * 10; // 0-100
// ビジネスインパクト加算
if (vuln.businessImpact.dataClassification === 'Restricted') score += 20;
if (vuln.businessImpact.customerFacing) score += 10;
if (vuln.businessImpact.regulatoryImpact) score += 15;
// 攻撃の実現性
if (vuln.exploitability.exploitInWild) score += 30;
if (vuln.exploitability.knownExploit) score += 15;
// 修正の容易さ(容易なら優先度UP)
if (vuln.remediationEffort.complexity === 'Low') score += 5;
return Math.min(100, score);
}
パッチ管理
パッチ管理プロセス
1. 脆弱性の通知受信
│ (CVE公開、Snykアラート、セキュリティアドバイザリ)
▼
2. 影響範囲の評価
│ (SBOM照合、影響を受けるサービスの特定)
▼
3. 優先順位付け
│ (CVSS + ビジネスインパクト + 悪用可能性)
▼
4. 修正方法の決定
│ (バージョンアップ、ワークアラウンド、WAFルール)
▼
5. テスト
│ (自動テスト、手動テスト、回帰テスト)
▼
6. デプロイ
│ (カナリアデプロイ、段階的ロールアウト)
▼
7. 検証
│ (スキャン再実行、脆弱性の解消確認)
▼
8. 文書化
(変更記録、残留リスクの評価)
自動パッチ管理(Dependabot / Renovate)
# .github/dependabot.yml
version: 2
updates:
- package-ecosystem: npm
directory: /
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- dependencies
- security
reviewers:
- security-team
# セキュリティアップデートは優先
allow:
- dependency-type: direct
# メジャーバージョンアップは手動レビュー
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
- package-ecosystem: docker
directory: /
schedule:
interval: weekly
labels:
- docker
- security
- package-ecosystem: terraform
directory: /infrastructure
schedule:
interval: weekly
緊急パッチ適用のプレイブック
// 緊急パッチ適用のフロー定義
interface EmergencyPatchPlaybook {
trigger: string;
steps: PlaybookStep[];
rollbackPlan: string;
communicationPlan: CommunicationPlan;
}
interface PlaybookStep {
order: number;
action: string;
owner: string;
maxDuration: string;
automatable: boolean;
}
const emergencyPatchPlaybook: EmergencyPatchPlaybook = {
trigger: 'CVSS 9.0以上 かつ 悪用事例が確認された脆弱性',
steps: [
{ order: 1, action: 'セキュリティチームへのアラート通知', owner: 'Automated', maxDuration: '5min', automatable: true },
{ order: 2, action: '影響範囲の特定(SBOM照合)', owner: 'Security Lead', maxDuration: '30min', automatable: true },
{ order: 3, action: '一時的な緩和策の適用(WAFルール等)', owner: 'SRE Team', maxDuration: '1h', automatable: false },
{ order: 4, action: 'パッチの適用とテスト', owner: 'Dev Team', maxDuration: '4h', automatable: false },
{ order: 5, action: 'カナリアデプロイ', owner: 'SRE Team', maxDuration: '2h', automatable: true },
{ order: 6, action: '脆弱性スキャンの再実行', owner: 'Security Team', maxDuration: '1h', automatable: true },
{ order: 7, action: '完全ロールアウト', owner: 'SRE Team', maxDuration: '2h', automatable: true },
{ order: 8, action: 'ポストモーテムの実施', owner: 'Security Lead', maxDuration: '1week', automatable: false },
],
rollbackPlan: '前バージョンへの即時ロールバック + WAFルールで暫定防御',
communicationPlan: {
internal: { channel: '#security-incidents', frequency: '1h毎' },
management: { method: 'メール + Slack', frequency: '初報 + 完了報告' },
external: { method: 'ステータスページ更新', condition: 'サービス影響がある場合のみ' },
},
};
脆弱性報告と情報共有
責任ある脆弱性開示(Responsible Disclosure)
| 要素 | 内容 |
|---|
| security.txt | /.well-known/security.txt に連絡先を公開 |
| バグバウンティ | HackerOne等で外部研究者からの報告を受付 |
| 開示ポリシー | 報告から修正・公開までの期限(通常90日) |
| CVE採番 | 重大な脆弱性にはCVE番号を割り当て |
# /.well-known/security.txt
Contact: mailto:security@example.com
Encryption: https://example.com/.well-known/pgp-key.txt
Acknowledgments: https://example.com/security/hall-of-fame
Policy: https://example.com/security/disclosure-policy
Preferred-Languages: ja, en
Expires: 2025-12-31T23:59:59.000Z
まとめ
| ポイント | 内容 |
|---|
| CVSS | 脆弱性の深刻度を0-10で定量評価する共通指標 |
| 優先順位付け | CVSS + ビジネスインパクト + 悪用可能性の3軸で判断 |
| パッチ管理 | 自動化(Dependabot)+ 緊急パッチプレイブック |
| 責任ある開示 | security.txt、バグバウンティ、開示ポリシー |
| 文書化 | 修正記録、残留リスク、ポストモーテム |
チェックリスト
次のステップへ
次は「演習:脆弱性診断を実施しよう」です。Step 4で学んだ脆弱性の知識を使って、実際のアプリケーションに対する脆弱性診断を実施しましょう。
推定読了時間: 40分