入力の検証や表現の問題は、メタキャラクター、代替エンコーディング、数値表現などによって引き起こされます。セキュリティの問題は、入力を信頼することに起因します。この問題に含まれるのは、「Buffer Overflow」、「Cross-Site Scripting」攻撃、「SQL Injection」などです。
Content-Disposition
ヘッダーの設定が間違っている。これにより、HTTP レスポンスの Content-Type
ヘッダーと Content-Disposition
ヘッダーまたはそのいずれかが攻撃者によって操作される可能性があるほか、ターゲット アプリケーションに、デフォルトではブラウザーにレンダリングされない Content-Type
が含まれる場合があります。ContentNegotiationManager
を使用して、さまざまなレスポンス形式を動的に生成している場合、RFD 攻撃に必要な条件が整います。ContentNegotiationManager
は、リクエスト パス拡張に基づいてレスポンス形式を決定し、Java Activation Framework (JAF) を使用してクライアントが要求した形式により一致する Content-Type
を探すように設定されます。また、リクエストの Accept
ヘッダーで送信されるメディア タイプを介してレスポンス コンテンツ タイプを指定することをクライアントに許可します。例 2: 次の例のアプリケーションは、リクエストの
<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
<property name="favorPathExtension" value="true" />
<property name="useJaf" value="true" />
</bean>
Accept
ヘッダーによってレスポンス コンテンツ タイプを決定するように設定されています。
<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
<property name="ignoreAcceptHeader" value="false" />
</bean>
ContentNegotiationManagerFactoryBean
プロパティのデフォルト値は次のとおりです。useJaf
: true
favorPathExtension
: true
ignoreAcceptHeader
: false
Example 1
の構成では、攻撃者が次のような悪意のある URL を作成することが可能です。ContentNegotiationManager
は、Java Activation Framework (activity.jar がクラスパスにある場合) を使用して、指定したファイル拡張子についてメディア タイプを解決しようとし、それに合わせてレスポンスの ContentType
ヘッダーを設定します。この例では、ファイル拡張子は "bat" で、Content-Type
ヘッダーは application/x-msdownload
です (正確な Content-Type
は、サーバーの OS と JAF の設定によって異なります)。その結果、この悪意のある URL にアクセスした被害者のマシンは、攻撃者が操作したコンテンツを含む ".bat" ファイルのダウンロードを自動的に開始します。その後、このファイルが実行されると、被害者のマシンは攻撃者のペイロードで指定されたコマンドを実行します。
...
PageReference ref = ApexPages.currentPage();
Map<String,String> params = ref.getParameters();
HttpRequest req = new HttpRequest();
req.setEndpoint(params.get('url'));
HTTPResponse res = new Http().send(req);
http
や https
とは異なるプロトコルを使用することが可能になります。
string url = Request.Form["url"];
HttpClient client = new HttpClient();
HttpResponseMessage response = await client.GetAsync(url);
http
や https
とは異なるプロトコルを使用することが可能になります。
char *url = maliciousInput();
CURL *curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, url);
CURLcode res = curl_easy_perform(curl);
http
や https
とは異なるプロトコルを使用することが可能になります。
...
final server = await HttpServer.bind('localhost', 18081);
server.listen((request) async {
final headers = request.headers;
final url = headers.value('url');
final client = IOClient();
final response = await client.get(Uri.parse(url!));
...
}
http
や https
とは異なるプロトコルを使用することが可能になります。
url := request.Form.Get("url")
res, err =: http.Get(url)
...
http
や https
とは異なる次のようなプロトコルを使用することが可能になります。
String url = request.getParameter("url");
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(url);
CloseableHttpResponse response1 = httpclient.execute(httpGet);
http
や https
とは異なるプロトコルを使用することが可能になります。
var http = require('http');
var url = require('url');
function listener(request, response){
var request_url = url.parse(request.url, true)['query']['url'];
http.request(request_url)
...
}
...
http.createServer(listener).listen(8080);
...
http
や https
とは異なるプロトコルを使用することが可能になります。
val url: String = request.getParameter("url")
val httpclient: CloseableHttpClient = HttpClients.createDefault()
val httpGet = HttpGet(url)
val response1: CloseableHttpResponse = httpclient.execute(httpGet)
http
や https
とは異なるプロトコルを使用することが可能になります。
$url = $_GET['url'];
$c = curl_init();
curl_setopt($c, CURLOPT_POST, 0);
curl_setopt($c,CURLOPT_URL,$url);
$response=curl_exec($c);
curl_close($c);
http
や https
とは異なるプロトコルを使用することが可能になります。
url = request.GET['url']
handle = urllib.urlopen(url)
http
や https
とは異なるプロトコルを使用することが可能になります。
url = req['url']
Net::HTTP.get(url)
http
や https
とは異なるプロトコルを使用することが可能になります。
def getFile(url: String) = Action { request =>
...
val url = request.body.asText.getOrElse("http://google.com")
ws.url(url).get().map { response =>
Ok(s"Request sent to $url")
}
...
}
http
や https
とは異なるプロトコルを使用することが可能になります。