セキュリティプロンプトガイド:セキュリティテストのための効果的なプロンプトの作成
概要
このガイドでは、ペネトレーションテストとセキュリティ分析にAIを使用する際に、効果的なプロンプトを作成するためのベストプラクティスを提供します。優れたプロンプトは、より正確で詳細かつ実用的なセキュリティ評価をもたらします。
プロンプトエンジニアリングの基本原則
1. 役割の割り当て
AIに特定のセキュリティ専門家の役割を割り当てることからプロンプトを開始します。
You are an experienced penetration tester and security analyst with expertise in web application security, network security, and vulnerability assessment.
2. 明確なタスクの定義
AIに分析または達成させたいことを具体的に記述します。
良い例 (Good):
Analyze this web application for SQL injection vulnerabilities in the login form, focusing on input validation and parameterized queries.
悪い例 (Poor):
Check this app for security issues.
3. XMLタグを使用した構造化された入力
XMLタグを使用して、プロンプトのさまざまなコンポーネントを整理します。
<target>
Application: E-commerce website
URL: https://example-shop.com
Technology: PHP/MySQL
</target>
<scope>
- Authentication mechanisms
- Payment processing
- User data handling
</scope>
<constraints>
- Read-only testing only
- No destructive actions
- Focus on OWASP Top 10
</constraints>
4. 思考の連鎖 (Chain of Thought) の推論
AIに推論を説明させることで、段階的な分析を促します。
Analyze the following code for security vulnerabilities. For each potential issue:
1. Identify the vulnerability type
2. Explain the potential impact
3. Provide a specific remediation recommendation
4. Rate the severity (Critical/High/Medium/Low)
セキュリティ固有のプロンプトテンプレート
脆弱性評価テンプレート
You are a senior security consultant performing a comprehensive security assessment.
<target_info>
Application: {{APPLICATION_NAME}}
Technology Stack: {{TECH_STACK}}
Environment: {{ENVIRONMENT}}
</target_info>
<assessment_scope>
{{SCOPE_DETAILS}}
</assessment_scope>
Please analyze the provided information and:
1. Identify potential security vulnerabilities
2. Categorize findings by OWASP Top 10 classification
3. Provide proof-of-concept examples where applicable
4. Suggest specific remediation steps
5. Prioritize findings by risk level
<constraints>
- Follow responsible disclosure principles
- Focus on defensive recommendations
- Provide actionable remediation guidance
</constraints>
Webアプリケーションセキュリティ評価テンプレート
You are a web application security expert conducting a comprehensive security assessment.
<web_app_info>
Application: {{APPLICATION_NAME}}
URL: {{BASE_URL}}
Technology Stack: {{TECH_STACK}}
Authentication: {{AUTH_METHOD}}
</web_app_info>
<application_scope>
{{PAGES_AND_FUNCTIONALITY}}
</application_scope>
<analysis_focus>
{{SPECIFIC_CONCERNS}}
</analysis_focus>
Analyze the web application and provide:
1. OWASP Top 10 vulnerability assessment
2. Authentication and session management analysis
3. Input validation and output encoding review
4. Business logic flaw identification
5. Client-side security assessment
6. Detailed remediation recommendations with code examples
モバイルアプリケーションセキュリティ評価テンプレート
You are a mobile security specialist analyzing mobile application security.
<mobile_app_info>
Platform: {{PLATFORM}} (iOS/Android)
Application: {{APP_NAME}}
Version: {{APP_VERSION}}
Architecture: {{ARCHITECTURE}}
</mobile_app_info>
<app_components>
Binary: {{BINARY_INFO}}
Manifest/Info.plist: {{MANIFEST_DATA}}
Network Communications: {{NETWORK_TRAFFIC}}
</app_components>
<analysis_focus>
{{SPECIFIC_CONCERNS}}
</analysis_focus>
Perform mobile security analysis focusing on:
1. Platform-specific security controls (iOS/Android)
2. Data storage security (keychain, shared preferences)
3. Network communication security (certificate pinning, encryption)
4. Authentication and authorization mechanisms
5. Runtime protection and anti-tampering measures
6. Privacy and permission model compliance
7. OWASP Mobile Top 10 assessment
APIセキュリティ評価テンプレート
You are an API security expert specializing in REST, GraphQL, and other API technologies.
<api_details>
API Type: {{API_TYPE}}
Base URL: {{API_BASE_URL}}
Authentication: {{AUTH_METHOD}}
Documentation: {{API_DOCS_URL}}
Technology: {{FRAMEWORK}}
</api_details>
<endpoints>
{{ENDPOINT_LIST}}
</endpoints>
<sample_requests>
{{REQUEST_EXAMPLES}}
</sample_requests>
Conduct comprehensive API security assessment covering:
1. Authentication and authorization vulnerabilities
2. Input validation and injection attacks
3. Rate limiting and DoS protection
4. Data exposure and information leakage
5. Business logic vulnerabilities
6. API versioning and deprecation security
7. CORS and cross-origin security policies
8. Provide specific test cases and curl commands for validation
AIペネトレーションテストプロンプトのベストプラクティス
すべきこと (Do's)
- 具体的にする: 正確なバージョン、設定、パラメータを含めます。
- コンテキストを提供する: ビジネス上の目的とシステムの重要性を説明します。
- 境界を設定する: スコープ内 (in scope) とスコープ外 (out of scope) を明確に定義します。
- 証拠を要求する: 具体的な例とProof-of-Concept (PoC) コードを求めます。
- 優先順位付けを求める: リスクに基づいた検出事項のランク付けを要求します。
すべきでないこと (Don'ts)
- 曖昧な要求を避ける: 一般的な「セキュリティチェック (security checks)」を求めないでください。
- コンテキストを省略しない: 常に関連するシステム情報を提供してください。
- はい/いいえの質問を避ける: 代わりに詳細な分析を求めてください。
- コンプライアンスを無視しない: プロンプトで規制要件を考慮してください。
プロンプトシナリオの例
シナリオ1:一般的なセキュリティテスト
You are a security consultant performing a general security assessment.
<target>
Application: {{APPLICATION_NAME}}
Type: {{APPLICATION_TYPE}} (Web/Mobile/API/Desktop)
Technology Stack: {{TECH_STACK}}
Environment: {{ENVIRONMENT}}
</target>
<scope>
{{TESTING_SCOPE}}
</scope>
<constraints>
- Time limit: {{TIME_CONSTRAINT}}
- Access level: {{ACCESS_LEVEL}}
- Compliance requirements: {{COMPLIANCE}}
</constraints>
Conduct a comprehensive security evaluation covering:
1. Common vulnerability patterns for this technology stack
2. Configuration and deployment security
3. Authentication and access control mechanisms
4. Data protection and privacy considerations
5. Security monitoring and logging capabilities
Provide a prioritized list of findings with risk ratings and remediation timelines.
シナリオ2:ドキュメント付きの特定の機能テスト
You are a security expert testing a specific application feature.
<feature_details>
Feature: {{FEATURE_NAME}}
Functionality: {{FEATURE_DESCRIPTION}}
User Roles: {{USER_ROLES}}
Data Handled: {{DATA_TYPES}}
</feature_details>
<documentation>
Official Documentation: {{DOC_LINKS}}
API Specification: {{API_SPEC}}
Security Guidelines: {{SECURITY_DOCS}}
</documentation>
<test_parameters>
{{SPECIFIC_PARAMETERS}}
</test_parameters>
Focus your security analysis on:
1. Feature-specific vulnerabilities and edge cases
2. Compliance with documented security requirements
3. Proper implementation of security controls per documentation
4. Data flow security throughout the feature lifecycle
5. Integration security with other system components
Cross-reference findings with official documentation and provide specific sections that address or contradict your discoveries.
シナリオ3:脆弱性の再テストとバグバウンティレポートの検証
You are a senior security analyst validating and retesting reported vulnerabilities.
<original_report>
Vulnerability Type: {{VULN_TYPE}}
Severity: {{REPORTED_SEVERITY}}
Reporter: {{REPORTER_INFO}}
Discovery Date: {{DISCOVERY_DATE}}
</original_report>
<vulnerability_details>
{{VULNERABILITY_DESCRIPTION}}
</vulnerability_details>
<proof_of_concept>
{{POC_STEPS}}
</proof_of_concept>
<remediation_claims>
{{CLAIMED_FIXES}}
</remediation_claims>
Perform thorough validation by:
1. Reproducing the original vulnerability using provided PoC
2. Testing variations and edge cases of the reported issue
3. Validating effectiveness of implemented remediation measures
4. Assessing potential bypass techniques for the fix
5. Confirming the actual risk level and business impact
6. Documenting any residual risks or incomplete fixes
Provide a detailed retest report with:
- Vulnerability status (Confirmed/Fixed/Partially Fixed/False Positive)
- Evidence of testing performed
- Risk assessment validation
- Recommendations for additional security measures
プロンプト改善のヒント
- 反復と改善: AIの応答に基づいてプロンプトを調整します。
- 異なるアプローチをテストする: 複雑なシナリオにはさまざまなプロンプト構造を試してください。
- 例を含める: 可能な場合は、入力/出力のサンプルを提供します。
- 結果を検証する: AIの検出事項を確立されたセキュリティフレームワークと照らし合わせます。
- 成功したプロンプトを文書化する: 再利用のために効果的なプロンプトのライブラリを構築します。
結論
セキュリティテストのための効果的なAIプロンプティングには、明確な役割定義、構造化された入力、および具体的なタスクの指示が必要です。これらのガイドラインとテンプレートに従うことで、専門的な基準と倫理的な実践を維持しながら、ペネトレーションテストやセキュリティ評価のワークフローでAIツールをより効果的に活用できます。