技術解説Technical deep-dive
CyberForces LLM Firewall の仕組み How CyberForces LLM Firewall works
アプリと LLM の間に挟む 1 本の API として、入力テキストを複数の検知器で解析し、構造化した判定を返します。ポリシーが常に最優先で、何を検知・ブロックするかは利用者が制御します。 A single API between your app and the LLM runs the input text through several detectors and returns a structured verdict. Policy is always authoritative — you decide what is detected and blocked.
アーキテクチャ概要Architecture overview
アプリは LLM を呼ぶ前に、入力テキストをファイアウォール API に送ります。API は各検知器を並列に実行し、ポリシーに従って判定を合成して返します。サーバレス構成(FastAPI + Lambda)で、プロンプトは検知のためだけに処理されます。Before calling the LLM, your app sends the input text to the firewall API. It runs each detector in parallel and composes a verdict under your policy. It's serverless (FastAPI + Lambda), and prompts are processed only for detection.
並列実行と低レイテンシParallel, low latency
各検知器は並列に実行され、壁時計時間は最も遅い検知器に律速されます。重い読み取りは結果をキャッシュし、軽量パスは早期に確定します。Detectors run in parallel, so wall-clock time is bounded by the slowest one. Heavy reads are cached and lightweight paths short-circuit early.
プロンプトの扱いHow prompts are handled
入力は検知のためだけに処理し、当社モデルの学習には使いません。PII スキャンは原文に対して行い、ML 検知は必要に応じて翻訳後のテキストを使います。Input is processed only for detection, never to train our models. PII scanning runs on the original text; ML detection uses the translated text where helpful.
API と判定結果The API & the verdict
X-API-Key で認証し、入力テキストを 1 つ送るだけ。判定は全検知器の結果を構造化して返します。アプリ側は is_malicious と overall_severity で許可/ブロックを決められます。Authenticate with X-API-Key and send one input. The verdict returns every detector's result, structured — your app can decide on is_malicious and overall_severity alone.
POST /v1/secure-llm-firewall
X-API-Key: sllmf_********
Content-Type: application/json
{ "text": "<user input>" }
{
"is_malicious": true,
"overall_severity": "high",
"prompt_injection": { "is_injection": true,
"confidence": 0.98 },
"web_attack": { "is_attack": false },
"pii_detection": { "total_findings": 0 },
"harmful_content": { "detected": false }
}
各検知器は深刻度(none / low / medium / high / critical)と検知内容(findings)を持ち、overall_severity はその最大値です。無効化した検知器は応答に含まれません。Each detector carries a severity (none / low / medium / high / critical) and its findings; overall_severity is the max. Disabled detectors are omitted from the response.
検知器(詳細)Detectors (in detail)
プロンプトインジェクション(多言語)Prompt injection (multilingual)
Transformer 系の分類器が、指示の上書き・脱獄・システムプロンプト抽出を判定します。モデルが取りこぼしやすい直接操作系(接地の無視、振る舞い上書き、"from now on" 等)は、実データで選別した高精度ルールで補強。日本語などの入力は翻訳層で英語に正規化してから評価します。A transformer classifier scores instruction-override, jailbreaks, and system-prompt extraction. Direct-manipulation families the model tends to miss (grounding bypass, behaviour override, "from now on") are recovered with high-precision rules screened on real data. Non-English input is normalized to English by the translation layer first.
個人情報・秘密情報(80+ ルール)PII & secrets (80+ rules)
SSN・クレジットカード・IBAN・各種クラウド/SaaS の API キー・認証情報に加え、日本のマイナンバー・法人番号・運転免許証・在留カードなどを含む 80 以上のルールで検出。各ルールはキーワード前置フィルタで無関係な本文を高速に除外し、検知時はカテゴリと深刻度を返します(実際の値はマスク可能)。80+ rules cover SSNs, credit cards, IBANs, cloud/SaaS API keys, and credentials — plus Japan-specific identifiers (My Number, corporate number, driver's licence, residence card). A keyword pre-filter skips unrelated text fast, and findings carry a category and severity (the raw value can be masked).
Web 攻撃(WAF)Web attack (WAF)
SQLi・XSS・コマンドインジェクション・パストラバーサル・SSRF・XXE・テンプレート/NoSQL インジェクション・デシリアライズなど 12 カテゴリを正規表現で検知し、URL/16 進/Unicode/Base64 などの多段デコードで難読化を看破。SSRF はメタデータ等の高シグナル指標に限定し、過検知を抑えています。Regex detection for 12 categories — SQLi, XSS, command injection, path traversal, SSRF, XXE, template/NoSQL injection, deserialization and more — with multi-stage URL/hex/unicode/base64 decoding to see through obfuscation. SSRF is scoped to high-signal indicators (e.g. cloud metadata) to limit false positives.
有害コンテンツ・テキスト難読化Harmful content & obfuscation
武器・薬物・詐欺・ハッキングなどの有害な要求を検知。さらに Base64 の塊・ゼロ幅文字・Unicode 難読化・制御文字といった、検知回避を狙うテキスト操作を検出します(少数の不可視文字は良性として扱い、語分割回避のような明確な操作のみを検知)。Flags harmful requests (weapons, drugs, fraud, hacking) and text-manipulation evasions — base64 blobs, zero-width characters, Unicode obfuscation, control characters — while treating a couple of stray invisible characters as benign and catching only deliberate splitting.
翻訳層(日本語ファースト)Translation layer (Japanese-first)
多言語モデルは日本語の素の入力を過検知しがちです。そこで日本語は高品質な日→英モデルで正規化してから ML 検知に渡し、誤検知を抑えつつ攻撃の取りこぼしを減らします。PII などのルール検知は原文に対して行います。Multilingual models tend to over-flag native Japanese, so Japanese is normalized via a high-quality ja→en model before ML detection — cutting false positives while recovering missed attacks. Rule-based detection (e.g. PII) still runs on the original text.
ポリシーモデルThe policy model
プロジェクト既定+キー上書きProject default + key override
検知器・PII ルール・WAF カテゴリの ON/OFF をプロジェクト単位で既定化し、API キー単位で上書きできます。チームや用途ごとに別ポリシーを適用できます。Set detector / PII-rule / WAF-category toggles per project, and override them per API key — so each team or use case gets its own policy.
ポリシーが最優先Policy is authoritative
有効な設定は「プロジェクト AND キー上書き」で合成され、無効化した検知器は実行も応答もされません。何を検知・ブロックするかは常にお客様の制御下です。The effective config is project AND key-override; a disabled detector neither runs nor appears in the response. What gets detected and blocked is always under your control.
監査ログと通知Audit & notifications
ポリシー変更や検知・ブロックは記録され、通知先を集約して送れます。運用の見直しやインシデント対応に使えます。Policy changes and detections/blocks are recorded, with consolidated notifications — ready for review and incident response.
安全・プライバシーの前提Safety & privacy
- 学習に使わないNot used for training
お客様のプロンプトを当社モデルの学習に使用しません。Your prompts are never used to train our models. - 検査は入力のみInput-only inspection
判定に必要な範囲で入力を処理し、PII の生値はマスク可能。Inputs are processed only as needed; raw PII values can be masked. - ポリシー最優先Policy-authoritative
無効化した検知器は実行も応答もしない。制御はお客様に。A disabled detector neither runs nor responds — control stays with you. - 多言語・低レイテンシMultilingual, low latency
日本語を取りこぼさず、並列実行で前段に置いても軽快。Doesn't miss Japanese, and parallel execution keeps it snappy in front of your LLM.
用語集Glossary
- プロンプトインジェクションPrompt injection
- 入力でモデルの指示や制約を上書きしようとする攻撃。脱獄やシステムプロンプト抽出を含む。An attack that uses input to override the model's instructions or guardrails — including jailbreaks and system-prompt extraction.
- PII
- 個人を特定しうる情報。マイナンバー・クレカ・API キー・認証情報なども検知対象。Personally identifiable information — plus secrets like My Number, cards, API keys and credentials.
- WAF / Web 攻撃WAF / web attack
- SQLi・XSS・SSRF など、Web アプリへの古典的攻撃。多段デコードで難読化も検知。Classic web attacks (SQLi, XSS, SSRF…), detected through multi-stage decoding too.
- overall_severity
- none / low / medium / high / critical の 5 段階。各検知器の最大値。One of none / low / medium / high / critical — the max across detectors.
- is_malicious
- いずれかの検知器が発火したかを表す総合フラグ。ブロック判断に使える。The overall flag: did any detector fire? Use it for the block decision.
- ポリシーPolicy
- 検知器・ルールの ON/OFF。プロジェクト既定を API キー単位で上書きできる。Detector/rule toggles — project defaults overridable per API key.
評価・PoC のご相談Evaluations & PoCs
検知精度の検証や導入についてのご相談は、お問い合わせフォームよりお気軽にどうぞ。For detection-accuracy evaluations or onboarding, reach out via the contact form.