--- url: "https://owasp.org/Top10/2025/ja/A05_2025-Injection/" titulek: "A05 Injection - OWASP Top 10:2025" h1: "A05:2025 インジェクション (Injection)" popis: "OWASP Top 10:2025" jazyk: "ja" kanonicka: "https://owasp.org/Top10/2025/ja/A05_2025-Injection/" drobecky: [] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 10:09:22" znaku: 12871 slov: 771 kodovani: "iso-8859-2" sha256: "d56622088eb3636974b7bb381b24b6ce9e88e7f3fbd3a29a0124488bd8abe772" --- # A05:2025 インジェクション (Injection) ## 背景 (Background) インジェクションは前回の第3位から第5ä˝ă¸ă¨é †ä˝ă‚’ä¸‹ă’ăžă—ăŸăŒă€ă“ă‚ŒăŻă€Œćš—ĺˇĺŒ–ăŽĺ¤ąć•—ă€ă‚„ă€ŒĺŽ‰ĺ…¨ă§ăŞă„č¨­č¨ˆă€ă¨ăŽç›¸ĺŻžçš„ăŞé †ä˝ă‚’çś­ćŒă—ăŸçľćžœă€ă“ă†ăŞă‚Šăžă—ăŸă€‚ćœŹă‚Ťăƒ†ă‚´ăƒŞăŻćœ€ă‚‚é ťçšăŤăƒ†ă‚šăƒˆă•ă‚ŒăŚă„ă‚‹é ˜ĺŸŸăŽä¸€ă¤ă§ă‚ă‚Šă€čŞżćŸťĺŻžčąĄă¨ăŞăŁăŸă™ăšăŚăŽă‚˘ăƒ—ăƒŞă‚ąăƒźă‚ˇăƒ§ăƒłăŒä˝•ă‚‰ă‹ăŽĺ˝˘ă§ă‚¤ăƒłă‚¸ă‚§ă‚Żă‚ˇăƒ§ăƒłăŽć¤œćŸťă‚’ĺ—ă‘ăŚă„ăžă™ă€‚ç´äť˜ă‘ă‚‰ă‚ŒăŸ 37 ぎ CWE に関する CVE ć•°ăŻĺ…¨ă‚Ťăƒ†ă‚´ăƒŞăŽä¸­ă§ćœ€ĺ¤šă§ă™ă€‚ćœŹă‚Ťăƒ†ă‚´ăƒŞăŤăŻă€ĺ‡şçžé ťĺşŚăŻéŤ˜ă„ăŒĺ˝ąéŸżĺşŚăŻç›¸ĺŻžçš„ăŤä˝Žă„ă‚Żăƒ­ă‚šă‚ľă‚¤ăƒˆă‚šă‚ŻăƒŞăƒ—ăƒ†ă‚Łăƒłă‚° (XSS、30,000 件以上の CVE) ă‹ă‚‰ă€é ťĺşŚăŻä˝Žă„ăŒćˇąĺˆťăŞĺ˝ąéŸżă‚’ă‚‚ăŸă‚‰ă™ SQL インジェクション (14,000 件以上の CVE) まで、幅広い問題が含まれます。なお、XSS に関連する膨大な数の CVE ăŒă€ă‚Ťăƒ†ă‚´ăƒŞĺ…¨ä˝“ăŽĺšłĺ‡ĺŠ é‡ĺ˝ąéŸżă‚šă‚łă‚˘ă‚’ćŠźă—ä¸‹ă’ă‚‹čŚĺ› ă¨ăŞăŁăŚă„ăžă™ă€‚ ## スコアテーブル (Score Table) | 紐付けられた CWE 数 | 最大出現率 | 平均出現率 | 最大網羅率 | 平均網羅率 | ĺšłĺ‡ĺŠ é‡ć‚Şç”¨ă‚šă‚łă‚˘ | ĺšłĺ‡ĺŠ é‡ĺ˝ąéŸżă‚šă‚łă‚˘ | 出現総数 | CVE 総数 | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | 37 | 13.77% | 3.08% | 100.00% | 42.93% | 7.15 | 4.32 | 1,404,249 | 62,445 | ## 説明 (Description) ă‚¤ăƒłă‚¸ă‚§ă‚Żă‚ˇăƒ§ăƒłăŽč„†ĺźąć€§ăŻă€äżĄé źă§ăăŞă„ăƒŚăƒźă‚śăƒźĺ…ĽĺŠ›ăŒăƒ–ăƒŠă‚Śă‚śă‚„ăƒ‡ăƒźă‚żăƒ™ăƒźă‚šă€ă‚łăƒžăƒłăƒ‰ăƒŠă‚¤ăƒłăŞăŠăŽă‚¤ăƒłă‚żăƒźăƒ—ăƒŞă‚ż (Interpreter) ăŤé€äżĄă•ă‚Œă€ăăŽä¸€éƒ¨ăŒć„ĺ›łă›ăšă‚łăƒžăƒłăƒ‰ă¨ă—ăŚĺŽŸčĄŒă•ă‚ŒăŚă—ăžă†ă‚˘ăƒ—ăƒŞă‚ąăƒźă‚ˇăƒ§ăƒłăŽćŹ é™Ľă§ă™ă€‚ äťĽä¸‹ăŽé …ç›ŽăŤĺ˝“ăŚăŻăžă‚‹ĺ ´ĺˆă€ă‚˘ăƒ—ăƒŞă‚ąăƒźă‚ˇăƒ§ăƒłăŻč„†ĺźąă§ă‚ă‚‹ĺŻčƒ˝ć€§ăŒă‚ă‚Šăžă™ă€‚ - ユーザーから提供されたデータが、アプリケーションによって検証、フィルタリング、または無害化 (Sanitize) されていない。 - 文脈に応じたエスケープ処理を行わずに、動的クエリや非パラメータ化された呼び出しをインタープリタで直接使用している。 - 無害化されていないデータが ORM (オブジェクト関係マッピング) の検索パラメータに使用され、本来アクセスできない機密レコードが抽出されてしまう。 - 悪意ある可能性のあるデータが、動的クエリやコマンド、ストアドプロシージャの中で直接利用、あるいは結合されている。 代表的なものには SQL、NoSQL、OS コマンド、ORM、LDAP、および式言語 (EL) や OGNL (Object Graph Navigation Library) ă¸ăŽă‚¤ăƒłă‚¸ă‚§ă‚Żă‚ˇăƒ§ăƒłăŒă‚ă‚Šăžă™ă€‚ă‚¤ăƒłă‚żăƒźăƒ—ăƒŞă‚żăŽç¨ŽéĄžăŤă‹ă‹ă‚ă‚‰ăšă€ăăŽć šćœŹçš„ăŞćŚ‚ĺżľăŻĺŒä¸€ă§ă™ă€‚ć¤œĺ‡şăŤăŻă‚˝ăƒźă‚šă‚łăƒźăƒ‰ăƒŹăƒ“ăƒĽăƒźăŒćœ€ă‚‚ĺŠšćžœçš„ă§ă™ăŒă€ă™ăšăŚăŽĺ…ĽĺŠ›ďźˆăƒ‘ăƒŠăƒĄăƒźă‚żă€ăƒ˜ăƒƒăƒ€ăƒźă€URL、Cookie、JSON、XML 等)に対する自動テストやファジング (Fuzzing) も有効です。また、CI/CD パイプラインに SAST (静的解析)、DAST (動的解析)、IAST (インタラクティブ解析) を組み込むことで、本番環境へのデプロイ前に不備を特定できます。 なお、LLM (大規模言語モデル) において一般的になりつつある関連の脆弱性については、[OWASP LLM Top 10](https://genai.owasp.org/llm-top-10/)、特に [LLM01:2025 プロンプトインジェクション (Prompt Injection)](https://genai.owasp.org/llmrisk/llm01-prompt-injection/) で詳しく解説されています。 ## 防止方法 (How to Prevent) インジェクションを防ぐ最善の方法は、「データ」を「コマンド」や「クエリ」から分離し続けることです。 - **安全な API の利用:** インタープリタの使用自体を避ける、パラメータ化されたインターフェースを利用する、あるいは ORM ツールへ移行することが推奨されます。 - **注意:** パラメータ化していても、PL/SQL や T-SQL 内でクエリとデータを結合して `EXECUTE IMMEDIATE` 等を実行すると、SQL インジェクションが発生する恐れがあります。 ăƒ‡ăƒźă‚żă¨ă‚łăƒžăƒłăƒ‰ă‚’ĺˆ†é›˘ă§ăăŞă„ĺ ´ĺˆăŻă€äťĽä¸‹ăŽć‰‹ćł•ă§č„…ĺ¨ă‚’čť˝ć¸›ă—ăŚăă ă•ă„ă€‚ - **サーバー側での入力検証:** ポジティブな入力検証(許可リスト方式)を実施してください。ただし、多くのアプリでは特殊文字の入力を許容する必要があるため、これだけでは不十分です。 - **特殊文字のエスケープ:** 残存する動的クエリについては、各インタープリタ専用の構文を用いて特殊文字をエスケープしてください。 - **注意:** テーブル名やカラム名などの SQL ć§‹é€ ăăŽă‚‚ăŽăŻă‚¨ă‚šă‚ąăƒźăƒ—ă§ăăžă›ă‚“ă€‚ăƒŚăƒźă‚śăƒźă‹ă‚‰ćäž›ă•ă‚ŒăŸć§‹é€ ĺă‚’ă‚Żă‚¨ăƒŞăŤä˝żç”¨ă™ă‚‹ăŽăŻćĽľă‚ăŚĺąé™şă§ă™ă€‚ **警告:** ć–‡ĺ­—ĺˆ—ăŽăƒ‘ăƒźă‚šă‚„ă‚¨ă‚šă‚ąăƒźăƒ—ăŤă‚ˆă‚‹ĺŻžç­–ăŻăƒŸă‚šăŒčľˇăă‚„ă™ăă€ă‚ˇă‚šăƒ†ăƒ ăŽă‚ăšă‹ăŞĺ¤‰ć›´ă§ç„ĄĺŠšĺŒ–ă•ă‚Œă‚‹ćă‚ŒăŒă‚ă‚‹ăŸă‚ă€ĺ …ç‰˘ăŞć‰‹ćł•ă¨ăŻč¨€ăˆăžă›ă‚“ă€‚ ## 攻撃シナリオの例 (Example Attack Scenarios) **シナリオ #1:不適切な SQL 呼び出し** アプリケーションが、検証されていないデータを結合して SQL を構築している。 ``` String query = "SELECT * FROM accounts WHERE custID='" + request.getParameter("id") + "'"; ``` 攻撃者がブラウザの `id` パラメータを `' OR '1'='1` に書き換えると、クエリの意味が変わり、全口座のレコードが返されてしまいます。 ``` http://example.com/app/accountView?id=' OR '1'='1 ``` **シナリオ #2:フレームワークへの盲信** Hibernate Query Language (HQL) を使用していても、以下のように入力を結合すると脆弱になります。 ``` Query HQLQuery = session.createQuery("FROM accounts WHERE custID='" + request.getParameter("id") + "'"); ``` 攻撃者が `' OR custID IS NOT NULL OR custID='` を入力すると、フィルターを回避して全アカウントへの不正アクセスが可能になります。 **シナリオ #3:OS コマンドへの直接注入** アプリケーションがユーザー入力を直接 OS コマンドへ渡している。 ``` String cmd = "nslookup " + request.getParameter("domain"); Runtime.getRuntime().exec(cmd); ``` 攻撃者が `example.com; cat /etc/passwd` と入力することで、サーバー上で任意のコマンドが実行されます。 ## 関連資料 (References) - [OWASP Proactive Controls: Secure Database Access](https://owasp.org/www-project-proactive-controls/v3/en/c3-secure-database) - [OWASP ASVS: V5 Input Validation and Encoding](https://owasp.org/www-project-application-security-verification-standard) - [OWASP Testing Guide: SQL Injection,](https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/07-Input_Validation_Testing/05-Testing_for_SQL_Injection) [Command Injection](https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/07-Input_Validation_Testing/12-Testing_for_Command_Injection) , and [ORM Injection](https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/07-Input_Validation_Testing/05.7-Testing_for_ORM_Injection) - [OWASP Cheat Sheet: Injection Prevention](https://cheatsheetseries.owasp.org/cheatsheets/Injection_Prevention_Cheat_Sheet.html) - [OWASP Cheat Sheet: SQL Injection Prevention](https://cheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html) - [OWASP Cheat Sheet: Injection Prevention in Java](https://cheatsheetseries.owasp.org/cheatsheets/Injection_Prevention_Cheat_Sheet_in_Java.html) - [OWASP Cheat Sheet: Query Parameterization](https://cheatsheetseries.owasp.org/cheatsheets/Query_Parameterization_Cheat_Sheet.html) - [OWASP Automated Threats to Web Applications – OAT-014](https://owasp.org/www-project-automated-threats-to-web-applications/) - [PortSwigger: Server-side template injection](https://portswigger.net/kb/issues/00101080_serversidetemplateinjection) - [Awesome Fuzzing: a list of fuzzing resources](https://github.com/secfigo/Awesome-Fuzzing) ## 紐付けられた CWE 一覧 (List of Mapped CWEs) - [CWE-20 Improper Input Validation](https://cwe.mitre.org/data/definitions/20.html) - [CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')](https://cwe.mitre.org/data/definitions/74.html) - [CWE-76 Improper Neutralization of Equivalent Special Elements](https://cwe.mitre.org/data/definitions/76.html) - [CWE-77 Improper Neutralization of Special Elements used in a Command ('Command Injection')](https://cwe.mitre.org/data/definitions/77.html) - [CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')](https://cwe.mitre.org/data/definitions/78.html) - [CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')](https://cwe.mitre.org/data/definitions/79.html) - [CWE-80 Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)](https://cwe.mitre.org/data/definitions/80.html) - [CWE-83 Improper Neutralization of Script in Attributes in a Web Page](https://cwe.mitre.org/data/definitions/83.html) - [CWE-86 Improper Neutralization of Invalid Characters in Identifiers in Web Pages](https://cwe.mitre.org/data/definitions/86.html) - [CWE-88 Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')](https://cwe.mitre.org/data/definitions/88.html) - [CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')](https://cwe.mitre.org/data/definitions/89.html) - [CWE-90 Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection')](https://cwe.mitre.org/data/definitions/90.html) - [CWE-91 XML Injection (aka Blind XPath Injection)](https://cwe.mitre.org/data/definitions/91.html) - [CWE-93 Improper Neutralization of CRLF Sequences ('CRLF Injection')](https://cwe.mitre.org/data/definitions/93.html) - [CWE-94 Improper Control of Generation of Code ('Code Injection')](https://cwe.mitre.org/data/definitions/94.html) - [CWE-95 Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection')](https://cwe.mitre.org/data/definitions/95.html) - [CWE-96 Improper Neutralization of Directives in Statically Saved Code ('Static Code Injection')](https://cwe.mitre.org/data/definitions/96.html) - [CWE-97 Improper Neutralization of Server-Side Includes (SSI) Within a Web Page](https://cwe.mitre.org/data/definitions/97.html) - [CWE-98 Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion')](https://cwe.mitre.org/data/definitions/98.html) - [CWE-99 Improper Control of Resource Identifiers ('Resource Injection')](https://cwe.mitre.org/data/definitions/99.html) - [CWE-103 Struts: Incomplete validate() Method Definition](https://cwe.mitre.org/data/definitions/103.html) - [CWE-104 Struts: Form Bean Does Not Extend Validation Class](https://cwe.mitre.org/data/definitions/104.html) - [CWE-112 Missing XML Validation](https://cwe.mitre.org/data/definitions/112.html) - [CWE-113 Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Response Splitting')](https://cwe.mitre.org/data/definitions/113.html) - [CWE-114 Process Control](https://cwe.mitre.org/data/definitions/114.html) - [CWE-115 Misinterpretation of Output](https://cwe.mitre.org/data/definitions/115.html) - [CWE-116 Improper Encoding or Escaping of Output](https://cwe.mitre.org/data/definitions/116.html) - [CWE-129 Improper Validation of Array Index](https://cwe.mitre.org/data/definitions/129.html) - [CWE-159 Improper Handling of Invalid Use of Special Elements](https://cwe.mitre.org/data/definitions/159.html) - [CWE-470 Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')](https://cwe.mitre.org/data/definitions/470.html) - [CWE-493 Critical Public Variable Without Final Modifier](https://cwe.mitre.org/data/definitions/493.html) - [CWE-500 Public Static Field Not Marked Final](https://cwe.mitre.org/data/definitions/500.html) - [CWE-564 SQL Injection: Hibernate](https://cwe.mitre.org/data/definitions/564.html) - [CWE-610 Externally Controlled Reference to a Resource in Another Sphere](https://cwe.mitre.org/data/definitions/610.html) - [CWE-643 Improper Neutralization of Data within XPath Expressions ('XPath Injection')](https://cwe.mitre.org/data/definitions/643.html) - [CWE-644 Improper Neutralization of HTTP Headers for Scripting Syntax](https://cwe.mitre.org/data/definitions/644.html) - [CWE-917 Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection')](https://cwe.mitre.org/data/definitions/917.html)