계: Input Validation and Representation

입력 검증 및 표현 문제는 메타 문자, 대체 인코딩 및 숫자 표현 때문에 발생합니다. 보안 문제는 입력을 신뢰하기 때문에 발생합니다. 문제로는 "Buffer Overflows", "Cross-Site Scripting" 공격, "SQL Injection", 그 외 여러 가지가 있습니다.

1 개 항목 찾음
취약점
Abstract
이 응용 프로그램에서 공격자는 신뢰할 수 있는 도메인에서 시작된 것으로 보이는 임의의 콘텐트를 강제로 다운로드하게 하는 URL을 만들 수 있습니다.
Explanation
RFD(Reflected File Download)는 방문 시 신뢰할 수 있는 도메인에서 시작된 것으로 보이는 임의의 콘텐트가 포함된 파일 다운로드를 시작하는 피싱 URL 또는 페이지를 만들 수 있는 취약점입니다. 사용자는 지정된 도메인을 신뢰하기 때문에 다운로드한 파일을 열어 잠재적으로 악성 코드를 실행할 수 있습니다.

공격자가 성공적인 RFD 공격을 실행하려면 다음 요구 사항이 충족되어야 합니다.
- 대상 응용 프로그램이 적절한 검증 또는 인코딩 없이 사용자 입력을 리플렉션합니다. 이것은 페이로드를 주입하는 데 사용됩니다.
- 대상 응용 프로그램이 허용적인 URL을 허용합니다. 따라서 공격자는 다운로드한 파일의 이름과 확장자를 제어할 수 있습니다.
- 대상 응용 프로그램 Content-Disposition 헤더가 잘못 구성되었거나 공격자가 HTTP 응답의 Content-Type 및/또는 Content-Disposition 헤더를 제어할 수 있거나 대상 응용 프로그램에 브라우저에서 기본적으로 렌더링되지 않는 Content-Type이 포함되어 있습니다.

예를 들어 응용 프로그램에서 Spring Web MVC ContentNegotiationManager를 사용하여 다양한 응답 형식을 동적으로 생성하는 경우 RFD 공격을 가능하게 하는 데 필요한 조건을 충족합니다.

ContentNegotiationManager는 요청 경로 확장자를 기반으로 응답 형식을 결정하고 JAF(Java Activation Framework)를 사용하여 클라이언트의 요청 형식과 더 잘 일치하는 Content-Type을 찾도록 구성되었습니다. 또한 클라이언트에서는 요청의 Accept 헤더로 전송되는 미디어 유형을 통해 응답 콘텐트 유형을 지정할 수도 있습니다.

예제 1: 다음 예제에서 이 응용 프로그램은 경로 확장자 전략과 Java Activation Framework로 응답의 콘텐트 유형을 결정할 수 있도록 구성되어 있습니다.


<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
<property name="favorPathExtension" value="true" />
<property name="useJaf" value="true" />
</bean>
예제 2: 다음 예제에서 이 응용 프로그램은 요청의 Accept 헤더로 응답의 콘텐트 유형을 결정할 수 있도록 구성되어 있습니다.


<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
<property name="ignoreAcceptHeader" value="false" />
</bean>


참고로 Spring 4.2.1에서 ContentNegotiationManagerFactoryBean 속성은 기본적으로 다음과 같이 설정됩니다.

- useJaf: true
- favorPathExtension: true
- ignoreAcceptHeader: falseExample 1의 구성을 통해 공격자는 다음과 같은 악성 URL을 작성합니다.

http://server/some/resource/endpoint/foo.bat?input=payload

따라서 ContentNegotiationManager는 Java Activation Framework(activation.jar이 클래스 경로에 있는 경우)를 사용하여 지정된 파일 확장자의 미디어 유형을 확인하고 응답의 ContentType 헤더를 그에 따라 설정하려고 합니다. 이 예제에서는 파일 확장자가 "bat"이므로 Content-Type 헤더는 application/x-msdownload입니다(정확한 Content-Type은 서버 OS 및 JAF 구성에 따라 달라질 수 있음). 결과적으로 피해자가 이 악성 URL을 방문하면 피해자의 컴퓨터는 공격자가 제어하는 콘텐트가 포함된 ".bat" 파일 다운로드를 자동으로 시작합니다. 이 파일이 실행되면 피해자 시스템에서 공격자의 페이로드에 지정된 모든 명령이 실행됩니다.
References
[1] Oren Hafif Reflected File Download - A New Web Attack Vector
[2] Alvaro Munoz Reflected File Download in Spring MVC
[3] Standards Mapping - Common Weakness Enumeration CWE ID 79, CWE ID 233
[4] Standards Mapping - Common Weakness Enumeration Top 25 2019 [2] CWE ID 079
[5] Standards Mapping - Common Weakness Enumeration Top 25 2020 [1] CWE ID 079
[6] Standards Mapping - Common Weakness Enumeration Top 25 2021 [2] CWE ID 079
[7] Standards Mapping - Common Weakness Enumeration Top 25 2022 [2] CWE ID 079
[8] Standards Mapping - Common Weakness Enumeration Top 25 2023 [2] CWE ID 079
[9] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-002754
[10] Standards Mapping - FIPS200 SI
[11] Standards Mapping - General Data Protection Regulation (GDPR) Indirect Access to Sensitive Data
[12] Standards Mapping - NIST Special Publication 800-53 Revision 4 SI-10 Information Input Validation (P1)
[13] Standards Mapping - NIST Special Publication 800-53 Revision 5 SI-10 Information Input Validation
[14] Standards Mapping - OWASP API 2023 API1 Broken Object Level Authorization
[15] Standards Mapping - OWASP Application Security Verification Standard 4.0 5.3.3 Output Encoding and Injection Prevention Requirements (L1 L2 L3), 5.3.6 Output Encoding and Injection Prevention Requirements (L1 L2 L3), 8.1.3 General Data Protection (L2 L3)
[16] Standards Mapping - OWASP Mobile 2014 M7 Client Side Injection
[17] Standards Mapping - OWASP Top 10 2004 A1 Unvalidated Input
[18] Standards Mapping - OWASP Top 10 2007 A2 Injection Flaws
[19] Standards Mapping - OWASP Top 10 2010 A1 Injection
[20] Standards Mapping - OWASP Top 10 2013 A1 Injection
[21] Standards Mapping - OWASP Top 10 2017 A1 Injection
[22] Standards Mapping - OWASP Top 10 2021 A03 Injection
[23] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.4
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 6.3.1.1
[25] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 6.5.6
[26] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.6
[27] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.6
[28] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.6
[29] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.6
[30] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[31] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[32] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.1 - Terminal Software Attack Mitigation, Control Objective B.3.1.1 - Terminal Software Attack Mitigation
[33] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.1 - Terminal Software Attack Mitigation, Control Objective B.3.1.1 - Terminal Software Attack Mitigation, Control Objective C.3.2 - Web Software Attack Mitigation
[34] Standards Mapping - SANS Top 25 2009 Insecure Interaction - CWE ID 079
[35] Standards Mapping - SANS Top 25 2010 Insecure Interaction - CWE ID 079
[36] Standards Mapping - SANS Top 25 2011 Insecure Interaction - CWE ID 079
[37] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3510 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3510 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3510 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3510 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3510 CAT I
[42] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3510 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3510 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002560 CAT I
[45] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002560 CAT I
[46] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002560 CAT I
[47] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002560 CAT I
[48] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002560 CAT I
[49] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002560 CAT I
[50] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002560 CAT I
[51] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002560 CAT I
[52] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002560 CAT I
[53] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002560 CAT I
[54] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002560 CAT I
[55] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002560 CAT I
[56] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002560 CAT I
[57] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002530 CAT II, APSC-DV-002560 CAT I
[58] Standards Mapping - Web Application Security Consortium Version 2.00 Improper Input Handling (WASC-20)
desc.config.java.reflected_file_download