CyberForces WAAP 技術解説Technical

技術解説Technical deep-dive

CyberForces WAAP の仕組み How CyberForces WAAP works

顧客 AWS アカウントの AWS WAFv2 を、クロスアカウントで安全に運用自動化する設計を、エンジニア向けに解説します。本番を勝手に変えない・全変更が可逆という前提の上に、各自動化が成り立っています。 An engineer-level look at how we operate and automate AWS WAFv2 across accounts — built on the invariant that production is never changed silently and every change is reversible.

アーキテクチャ概要Architecture overview

SaaS 側のコントロールプレーンが、顧客アカウントの IAM ロールを STS で引き受けて WAF を操作します。顧客側に常駐エージェントは不要(ログ取り込み用の軽量エージェントは任意)。A SaaS control plane assumes an IAM role in the customer account (STS) to manage WAF. No standing agent is required in the customer account (an optional lightweight agent only ingests logs).

顧客 AWS アカウントCustomer AWS account
Web ACL
Rule Group
IP Set
CloudFront / ALB
運用ロール(最小・常設)Runtime role
導入ロール(強・一時)Setup role (ephemeral)
S3 / Firehose → WAF logs
CyberForces コントロールプレーンCyberForces control plane
API (FastAPI + Mangum / Lambda)
DynamoDB 設定・ルール・テレメトリ・提案・脅威情報config, rules, telemetry, suggestions, intel
定期実行 Lambda 群Scheduled Lambdas (mining / promotion / adaptive / drift / intel)
Athena + Glue ログ横断検索・集計log search & aggregation
ML 悪性リクエスト判定malicious-request inference

⇅ STS AssumeRole + ExternalId

クロスアカウントの信頼Cross-account trust

顧客は CloudFormation で IAM ロールを作成。信頼ポリシーは CyberForces アカウント+ ExternalId(テナント ID)で、混乱した代理(confused deputy)を防止。権限は WAFv2 のルールグループ/IP セット操作などに名前プレフィックスで限定。The customer deploys an IAM role via CloudFormation. The trust policy pins the CyberForces account + ExternalId (tenant id) to prevent confused-deputy access, and permissions are name-prefix scoped to the rule group / IP sets we manage.

2 ロールのライフサイクルTwo-role lifecycle

「導入ロール」は Web ACL 作成・ターゲット紐付け・ログバケット作成などの強い権限を持つが一時的で、導入後に削除可能。「運用ロール」はルール更新・ログ参照など最小権限で常設。解約時のリソース削除は導入ロールで実施し、対象はサービス作成物のみ。The setup role holds strong permissions (create Web ACL, bind targets, create log buckets) but is ephemeral and deletable after onboarding. The runtime role is minimal and permanent. Offboarding teardown runs under the setup role and only removes resources we created.

IAM 権限の内訳IAM permission breakdown

強い操作(作成・関連付け・削除)は導入ロールに隔離し、日々の運用は最小権限に保ちます。Strong actions (create / associate / delete) are isolated in the setup role; day-to-day stays minimal.

運用ロールRuntime最小・常設minimal, permanent
  • ルールグループ/IP セット/正規表現セットの更新Update rule group / IP sets / regex sets
  • 自ルールグループの Web ACL への付け外し(容量変更時の再アタッチ)Attach/detach our rule group on a Web ACL
  • ログ参照(Athena / Glue / 対象 S3 の読取)Log read (Athena / Glue / log S3)
  • AI 分析のためのモデル呼び出し(Anthropic に限定)Model invocation for AI analysis (Anthropic-scoped)
導入ロールSetup強権限・一時・削除可strong, ephemeral, deletable
  • Web ACL の作成/削除/関連付け・関連付け解除Create / delete / (dis)associate Web ACLs
  • CloudFront 配信の取得・更新、ロードバランサの列挙CloudFront get/update, ELB describe
  • S3 ログバケットの作成・ポリシー設定(解約時の削除も)Create/configure (and tear down) log buckets
  • 導入完了後はスタックごと削除して権限を失効可能Delete the stack after onboarding to revoke

ログ基盤と可視化Log pipeline & observability

取り込み経路Ingestion

WAF ログは Firehose(Hive パーティション)または S3 ダイレクトで S3 に蓄積し、Glue テーブル+ Athena で検索。ログ有効化と同時に検索ソースを自動登録するため、導入直後から分析できます。WAF logs land in S3 via Firehose (Hive partitions) or S3-direct, queried through a Glue table + Athena. Enabling logging auto-registers the search source, so analysis works from day one.

ルールへの帰属Per-rule attribution

各ルールは決定的な名前とラベルを発行し、WAF ログの rule-group リスト(terminating / non-terminating)から per-rule の Block / Count を集計。ACL 単位ではなく個々のルールの効果が分かります。Each rule emits a deterministic name + label; we attribute per-rule Block/Count from the log's rule-group list (terminating / non-terminating) — efficacy at the individual-rule level, not just the ACL.

コストと性能Cost & performance

Athena クエリはパーティション刈り込み+時間窓上限でスキャン量を抑制。集計結果は 24 時間テナント共有でキャッシュし、定期ジョブで事前ウォーム。Athena queries use partition pruning + a bounded time window to cap scanned bytes; results are cached 24h per tenant and pre-warmed by a scheduled job.

クエリ例(イメージ)Example queries (illustrative)

いずれもサーバ側で生成し、ユーザー由来の値はエスケープ。窓は時間で絞り、パーティションを刈り込みます。All server-built; user-derived values are escaped, the window is time-bounded, and partitions are pruned.

ルール別の Block / CountPer-rule Block / Count
SELECT rg.terminatingrule.ruleid AS rule,
       action, COUNT(*) AS hits
FROM waf_logs
CROSS JOIN UNNEST(rulegrouplist)
       AS t(rg)
WHERE <partition> AND <time>
GROUP BY 1, 2
過検知マイニングFalse-positive mining
SELECT rid, uri, ip, country,
       COUNT(*) AS blocks
FROM blocked_rows
GROUP BY GROUPING SETS (
  (rid), (rid, uri),
  (rid, ip), (rid, country))
HAVING COUNT(*) >= <min>
シャドー評価Shadow evaluation
SELECT COUNT(*) AS would_match,
  COUNT_IF(action='ALLOW')
       AS would_block
FROM waf_logs
WHERE <partition> AND <time>
  AND (<rule predicate>)
-- 例: regexp_like(uri,'/admin')

自動化の制御プレーンThe automation control plane

モード(off / 提案 / 自動)Modes (off / suggest / auto)

本番を変えうる機能はすべて、テナント/統合単位の単一設定層でモード制御。既定は「提案のみ」、「自動」は明示オプトイン。Every production-changing feature is gated by a single per-tenant / per-integration config layer. Default is suggest; auto is explicit opt-in.

バージョンと監査Versions & audit

各デプロイはルールセット全体をスナップショット。いつでも以前の版へロールバック可能。自動・手動を問わず変更はアラートとして通知。Every deploy snapshots the full rule set for one-click rollback. Automated or manual, each change emits an audit alert.

デプロイ経路Deploy path

UI からの手動デプロイと、定期ジョブからの自動デプロイは同一の内部経路を通り、容量超過時の再構成やバージョン記録も共通。Manual deploys (UI) and automated deploys (scheduled jobs) share one internal path — same capacity handling and version snapshotting.

データモデルと定期実行Data model & scheduled jobs

データストア(DynamoDB)Data stores (DynamoDB)

統合Integrationsアカウント・ロール・Web ACL/ログ設定accounts, roles, Web ACL/log config
ルールRulesポリシーの各ルールeach policy rule
バージョンVersionsデプロイ毎のスナップショットper-deploy snapshots
ログソースLog sources検索対象の登録registered search sources
設定キャッシュCacheテレメトリ等の 24h 共有キャッシュ24h shared telemetry cache
過検知提案FP suggestions除外候補exclusion candidates
自動化設定Automation configモード・閾値modes & thresholds
脅威情報Threat intel悪性 IP / JA3malicious IPs / JA3
イベント集計Event stats検知の集計・時系列detection counts & time series

定期実行ジョブScheduled jobs

ジョブJob 周期Cadence 役割Role
過検知マイニングFP mining日次daily除外候補の生成+テレメトリ事前計算generate suggestions + warm telemetry
Count→Block 昇格Promotion毎時hourly条件を満たしたルールを昇格(自動時)promote ready rules (auto mode)
レート自動調整Rate adjust数分間隔minutes急増時の強化・収束時の緩和tighten on spikes, relax after
自動隔離Quarantine数分間隔minutes反復攻撃元のブロック・期限切れ解除block repeat offenders, expire TTLs
ドリフト検知Drift detect日次dailyあるべき姿との差分検知・通知detect & alert divergence
脅威情報 同期/配信Threat-intel sync/distribute日次dailyフィード取得→ブロックリスト反映fetch feeds → managed blocklist

自動化メカニズム(詳細)Automation mechanisms (in detail)

過検知マイニングFalse-positive mining

BLOCK ログをルール × 次元(URI パス/送信元 IP/国)で一括集計し、誤検知になりやすい安全な次元(既知の良性パス、内部レンジの IP など)に限定して除外候補を生成。承認すると対象ルールに「除外条件」を追記(論理的には否定条件として AND 合成)し、バージョンを記録。攻撃者をホワイトリスト化しうる広い除外は提案しません。BLOCK logs are aggregated by rule × dimension (URI path / source IP / country) in one pass; only low-risk dimensions (known-benign paths, internal IP ranges) become exclusion candidates. Applying one appends a negated condition to the rule and snapshots a version. Broad exclusions that could whitelist an attacker are never suggested.

シャドー評価(デプロイ前試算)Shadow evaluation

ルールの一次条件を、直近ログに対するクエリ述語へ翻訳し、マッチ件数と「そのうち現状は許可されている件数(=ブロックに切り替えると新たに止まる量)」を試算。状態を持つレート制限など翻訳できない種別は明示します。ユーザー由来の値は厳格にエスケープして組み立てます。A rule's primary condition is translated into a query predicate over recent logs to estimate match volume and how many of those are currently allowed (i.e. would become newly blocked). Stateful types like rate limits that can't be translated are flagged. All user-derived values are strictly escaped when building the query.

Count → Block 自動昇格Count → Block promotion

監視(Count)で配信したルールに「段階ロールアウト」情報を付与。定期ジョブが、十分な観測期間・一定以上の発火実績・該当ルールに未解決の過検知提案がないこと、を満たした場合に Block へ昇格(自動モード時)。昇格は再デプロイ+バージョン記録+通知を伴います。提案モードでは「昇格準備完了」を提示するのみ。Rules shipped in Count carry staged-rollout metadata. A scheduled job promotes a rule to Block (in auto mode) only when it has observed long enough, fired enough, and has no open false-positive suggestion. Promotion includes a redeploy, a version snapshot, and an alert. In suggest mode it only surfaces "ready to promote".

適応的防御Adaptive defense

反復的に攻撃する送信元(重大検知・ML 判定の繰り返し)を有効期限つきで自動ブロックし、定期スイープで期限切れを自動解除。トラフィック急増時にはレート制限を一時的に強化し、収束後に元へ戻します。すべての閾値・有効期限はテナント設定で調整可能。Repeat-offender sources (severe or ML-flagged, recurring) are auto-blocked with a TTL and released by a periodic sweep. On traffic spikes, rate limits are tightened temporarily and restored once the spike subsides. All thresholds and TTLs are tenant-configurable.

脅威インテリジェンス配信Threat-intel distribution

公開フィード(ボットネット C2 IP など)と任意の API ソースを定期取得して保管し、日次でサービス管理のブロックリスト・ルールへ反映。モードに応じて未適用(off)/監視のみ/自動ブロックを切替えます。Public feeds (e.g. botnet C2 IPs) and optional API sources are fetched and stored, then reflected daily into a service-managed blocklist rule. The mode selects off / watch-only / auto-block.

構成ドリフト検知Configuration-drift detection

「設定として持つルール(あるべき姿)」と「実際にデプロイ済みのルールグループ+ Web ACL からの参照」を定期比較し、差分(手動変更・参照外れなど)を検知して通知。是正は人間承認で、勝手に顧客アカウントを上書きしません。We periodically compare the desired rule set against the actually-deployed rule group and Web ACL references, detecting drift (manual edits, lost attachment) and alerting. Remediation is human-approved — we never silently overwrite the account.

fleet 一括展開(3-way マージ)Fleet rollout (3-way merge)

基準となる 1 つのポリシーを複数の統合へ反映。プリセット ID/由来 ID で対応付け、追加・更新・削除を反映しつつ、各統合が独自に追加したルールは保持します(単純置換ではありません)。One source policy is reconciled onto many integrations: matched rules are added/updated/removed by preset id / origin id, while each integration's own local rules are preserved (not a blind replace).

安全・可逆性の前提Safety & reversibility

用語集Glossary

Web ACL / Rule Group / IP Set
AWS WAF の構成要素。Web ACL に当社の Rule Group を参照させ、IP Set でアドレス群を管理。AWS WAF building blocks. The Web ACL references our rule group; IP sets hold address groups.
Count / Block
Count は記録のみ(遮断しない)、Block は遮断。新規ルールは Count から始めるのが安全。Count records only; Block enforces. New rules safely start in Count.
過検知(False Positive)False positive
正規のリクエストを誤って検知・ブロックすること。A legitimate request wrongly flagged or blocked.
シャドー評価Shadow evaluation
デプロイせずに、直近ログでルールの影響を試算すること。Estimating a rule's impact against recent logs without deploying it.
ドリフトDrift
あるべき設定と、実際にデプロイ済みの構成との差分。Divergence between the desired config and what's actually deployed.
fleet
複数の統合(環境)をまとめて扱う単位。一括展開の対象。A set of integrations managed together — the target of bulk rollout.
JA3
TLS の接続特徴から算出する指紋。UA を偽装しても既知ツールを識別しやすい。A TLS handshake fingerprint that helps identify tools even when the UA is spoofed.
ExternalId / TTL
ExternalId は AssumeRole の混乱代理対策。TTL は自動ブロック等の有効期限。ExternalId guards AssumeRole against confused-deputy; TTL is the expiry on auto-blocks.

評価・PoC のご相談Evaluations & PoCs

アーキテクチャの詳細や検証についてのご相談は、お問い合わせフォームよりお気軽にどうぞ。For architecture details or a proof of concept, reach out via the contact form.