あなたはSentinel IT Servicesのセキュリティアナリストとして、オレゴン州ポートランドにあるGreenValley Credit Unionのウェブアプリケーションを監視しています。ログ分析中に、顧客ログインポータルでSQLインジェクションの試みを発見しました。攻撃者は悪意のある文字列を入力してクエリロジックを操作しようとしていました。アプリケーションは、クエリ実行前に特殊文字をエスケープされた文字列に置き換えることでクエリ操作を防ぎ、SQL文が変更されないようにすることで、この問題を軽減しています。観察された防御メカニズムに基づいて、アプリケーションはどのSQLインジェクション対策を採用していますか?
正解:B
The behavior described matches the countermeasure commonly referred to in CEH materials as escaping or encoding special characters, most notably the single quote character. SQL injection frequently relies on breaking out of a quoted string in the SQL statement using the single quote, then appending logical operators such as OR 1=1, comments, or additional clauses. When an application replaces special characters with escaped equivalents before the SQL statement is executed, it attempts to ensure the input is treated purely as data rather than executable SQL syntax. A classic example is transforming a single quote into an escaped form such as \ ' or doubling it to ' ' depending on the database and escaping rules. By doing so, the database parser interprets the quote as part of the literal string value, preventing the attacker from terminating the string and altering query logic.
Option B is therefore the best fit because it precisely describes encoding or escaping the single quote, which is the most commonly targeted delimiter in SQL injection payloads. Option A, user input validation, is broader and typically refers to allowlisting accepted characters and formats, but the question specifically emphasizes replacement with escaped equivalents rather than rejecting invalid input. Option D, parameterized queries or prepared statements, is the strongest modern control recommended in CEH guidance because it separates code from data at the API level, but it is different from character escaping and does not rely on rewriting input characters. Option C limits damage but does not prevent injection. The observed mechanism is clearly single- quote encoding.