입력 검증 및 표현 문제는 메타 문자, 대체 인코딩 및 숫자 표현 때문에 발생합니다. 보안 문제는 입력을 신뢰하기 때문에 발생합니다. 문제로는 "Buffer Overflows", "Cross-Site Scripting" 공격, "SQL Injection", 그 외 여러 가지가 있습니다.
Content-Disposition
헤더가 잘못 구성되었거나 공격자가 HTTP 응답의 Content-Type
및/또는 Content-Disposition
헤더를 제어할 수 있거나 대상 응용 프로그램에 브라우저에서 기본적으로 렌더링되지 않는 Content-Type
이 포함되어 있습니다.ContentNegotiationManager
를 사용하여 다양한 응답 형식을 동적으로 생성하는 경우 RFD 공격을 가능하게 하는 데 필요한 조건을 충족합니다.ContentNegotiationManager
는 요청 경로 확장자를 기반으로 응답 형식을 결정하고 JAF(Java Activation Framework)를 사용하여 클라이언트의 요청 형식과 더 잘 일치하는 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(activation.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
와는 다른 다음 프로토콜을 사용할 수 있게 됩니다.