계: API Abuse

API는 호출자와 피호출자 간의 계약입니다. 가장 흔한 형태의 API 오용은 호출자가 이 계약에서 자신의 몫을 이행하지 못하기 때문에 발생합니다. 예를 들어, 프로그램이 chroot()를 호출한 후 chdir()을 호출하지 못하면 활성 루트 디렉터리를 안전하게 변경하는 방법을 지정하는 계약을 위반하는 것입니다. 라이브러리 오용의 또 다른 좋은 예는 피호출자가 호출자에게 신뢰할 만한 DNS 정보를 반환할 것으로 예상하는 것입니다. 이 경우, 호출자는 자신의 행동에 대해 특정한 가정을 함으로써(반환 값이 인증 목적으로 사용될 것으로 예상) 피호출자 API를 오용합니다. 다른 쪽에서 호출자-피호출자 계약을 위반할 수도 있습니다. 예를 들어, 코더가 하위 클래스 SecureRandom을 지정하고 임의 값이 아닌 값을 반환하는 경우 계약을 위반하는 것입니다.

81 개 항목 찾음
취약점
Abstract
프로그램은 AWT/Swing을 사용하여 Enterprise JavaBeans 규격을 위반합니다.
Explanation
Enterprise JavaBeans 규격에 따르면 모든 bean 공급자는 bean이 이식 가능하고 EJB 컨테이너에서 일관성 있게 동작하도록 하기 위한 프로그래밍 지침을 따라야 합니다[1].

이 경우, 프로그램은 다음 EJB 지침을 위반합니다.

"enterprise bean은 디스플레이에 정보를 출력하거나 키보드에서 정보를 입력받을 때 AWT 기능을 사용할 수 없습니다."

규격에서 다음과 같이 정당화하는 요구 사항입니다.

"대부분의 서버는 응용 프로그램과 서버 시스템에 연결된 키보드/디스플레이가 직접 상호 작용하는 것을 허용하지 않습니다."
References
[1] The Enterprise JavaBeans 2.1 Specification Sun Microsystems
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1
[3] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 2
[4] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 6
[5] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[6] Standards Mapping - Common Weakness Enumeration CWE ID 575
desc.structural.java.ejb_bad_practices_use_of_awt_swing
Abstract
프로그램은 클래스 로더를 사용하여 Enterprise JavaBeans 규격을 위반합니다.
Explanation
Enterprise JavaBeans 규격에 따르면 모든 bean 공급자는 bean이 이식 가능하고 EJB 컨테이너에서 일관성 있게 동작하도록 하기 위한 프로그래밍 지침을 따라야 합니다[1].

이 경우, 프로그램은 다음 EJB 지침을 위반합니다.

"enterprise bean은 클래스 로더 생성, 현재 클래스 로더 얻기, 컨텍스트 클래스 로더 설정, 보안 관리자(security manager) 설정, 새 보안 관리자(security manager) 생성, JVM 중단 또는 입력, 출력 및 오류 스트림 변경을 할 수 없습니다."

규격에서 다음과 같이 정당화하는 요구 사항입니다.

"이들 함수는 EJB 컨테이너용으로 예약되어 있습니다. enterprise bean이 이들 함수를 사용하면 보안이 약해지고 컨테이너가 런타임 환경을 올바로 관리하는 기능이 저하됩니다."
References
[1] The Enterprise JavaBeans 2.1 Specification Sun Microsystems
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1
[3] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 2
[4] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 6
[5] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[6] Standards Mapping - Common Weakness Enumeration CWE ID 578
desc.structural.java.ejb_bad_practices_use_of_classloader
Abstract
프로그램은 java.io 패키지를 사용하여 Enterprise JavaBeans 규격을 위반합니다.
Explanation
Enterprise JavaBeans 규격에 따르면 모든 bean 공급자는 bean이 이식 가능하고 EJB 컨테이너에서 일관성 있게 동작하도록 하기 위한 프로그래밍 지침을 따라야 합니다[1].

이 경우, 프로그램은 다음 EJB 지침을 위반합니다.

"enterprise bean은 file system의 파일 및 디렉터리에 접근할 때 java.io 패키지를 사용할 수 없습니다."

규격에서 다음과 같이 정당화하는 요구 사항입니다.

"File system API는 비즈니스 구성 요소가 데이터에 접근할 수 있는 기능이 없습니다. 비즈니스 구성 요소는 JDBC와 같은 리소스 관리자 API를 사용하여 데이터를 저장해야 합니다."
References
[1] The Enterprise JavaBeans 2.1 Specification Sun Microsystems
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1
[3] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 2
[4] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 6
[5] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[6] Standards Mapping - Common Weakness Enumeration CWE ID 576
desc.structural.java.ejb_bad_practices_use_of_java_io
Abstract
프로그램은 소켓을 사용하여 Enterprise JavaBeans 규격을 위반합니다.
Explanation
Enterprise JavaBeans 규격에 따르면 모든 bean 공급자는 bean이 이식 가능하고 EJB 컨테이너에서 일관성 있게 동작하도록 하기 위한 프로그래밍 지침을 따라야 합니다[1].

이 경우, 프로그램은 다음 EJB 지침을 위반합니다.

"enterprise bean은 소켓에서 수신 대기하거나 소켓에서 연결을 수락하거나 멀티캐스트에 소켓을 사용할 수 없습니다."

규격에서 다음과 같이 정당화하는 요구 사항입니다.

"EJB 아키텍처를 사용하면 enterprise bean 인스턴스가 네트워크 소켓 클라이언트가 될 수 있지만 네트워크 서버는 될 수가 없습니다. 인스턴스가 네트워크 서버가 되면 EJB 클라이언트에게 서비스를 제공하는 역할에서 enterprise bean의 기본 함수와 충돌합니다."
References
[1] The Enterprise JavaBeans 2.1 Specification Sun Microsystems
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1
[3] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 2
[4] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 6
[5] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[6] Standards Mapping - Common Weakness Enumeration CWE ID 577
desc.structural.java.ejb_bad_practices_use_of_sockets
Abstract
프로그램은 스레드 동기화 기본 형식을 사용하여 Enterprise JavaBeans 규격을 위반합니다.
Explanation
Enterprise JavaBeans 규격에 따르면 모든 bean 공급자는 bean이 이식 가능하고 EJB 컨테이너에서 일관성 있게 동작하도록 하기 위한 프로그래밍 지침을 따라야 합니다[1].

이 경우, 프로그램은 다음 EJB 지침을 위반합니다.

"enterprise bean은 여러 인스턴스의 실행을 동기화할 때 스레드 동기화 기본 형식을 사용할 수 없습니다."

규격에서 다음과 같이 정당화하는 요구 사항입니다.

"이 규칙은 일부 EJB 컨테이너가 하나의 JVM을 사용하여 모든 enterprise bean의 인스턴스를 실행하는 반면 나머지는 여러 JVM에 인스턴스를 분산시키기 때문에 런타임 의미의 일관성을 유지하기 위해 필요합니다."
References
[1] The Enterprise JavaBeans 2.1 Specification Sun Microsystems
[2] THI01-J. Do not invoke ThreadGroup methods CERT
[3] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 2
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 6
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[7] Standards Mapping - Common Weakness Enumeration CWE ID 574
desc.structural.java.ejb_bad_practices_use_of_synchronization_primitives
Abstract
사용자 입력으로 FileResponse 인스턴스를 생성하면 공격자가 응용 프로그램 바이너리를 다운로드하거나, 보호되는 디렉터리 내에 있는 임의의 파일을 볼 수 있습니다.
Explanation
다음과 같은 경우 파일 공개가 발생합니다.
1. 신뢰할 수 없는 소스에서 데이터가 프로그램에 입력됩니다.


2. 데이터를 사용하여 경로를 동적으로 생성합니다.

예제 1: 다음 코드는 신뢰할 수 없는 데이터를 취하고 이를 통해 사용자에게 반환되는 파일을 엽니다.


from django.http import FileResponse
...
def file_disclosure(request):
path = request.GET['returnURL']
return FileResponse(open(path, 'rb'))
...


공격자가 민감한 파일 위치와 일치하는 요청 매개 변수를 URL에 제공한 경우, 해당 파일을 볼 수 있습니다. 예를 들어 "http://www.yourcorp.com/webApp/logic?returnURL=settings.py"에서 응용 프로그램의 "settings.py"를 볼 수 있습니다.
References
[1] Standards Mapping - CIS Azure Kubernetes Service Benchmark 4
[2] Standards Mapping - CIS Microsoft Azure Foundations Benchmark complete
[3] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 4.1
[4] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 1
[5] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[6] Standards Mapping - CIS Kubernetes Benchmark partial
[7] Standards Mapping - Common Weakness Enumeration CWE ID 552
[8] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-002754
[9] Standards Mapping - General Data Protection Regulation (GDPR) Access Violation
[10] Standards Mapping - NIST Special Publication 800-53 Revision 4 SI-10 Information Input Validation (P1)
[11] Standards Mapping - NIST Special Publication 800-53 Revision 5 SI-10 Information Input Validation
[12] Standards Mapping - OWASP Top 10 2004 A1 Unvalidated Input
[13] Standards Mapping - OWASP Top 10 2007 A4 Insecure Direct Object Reference
[14] Standards Mapping - OWASP Top 10 2010 A4 Insecure Direct Object References
[15] Standards Mapping - OWASP Top 10 2013 A4 Insecure Direct Object References
[16] Standards Mapping - OWASP Top 10 2017 A5 Broken Access Control
[17] Standards Mapping - OWASP Top 10 2021 A01 Broken Access Control
[18] Standards Mapping - OWASP API 2023 API1 Broken Object Level Authorization
[19] Standards Mapping - OWASP Application Security Verification Standard 4.0 1.12.1 Secure File Upload Architectural Requirements (L2 L3), 12.5.1 File Download Requirements (L1 L2 L3)
[20] Standards Mapping - OWASP Mobile 2014 M1 Weak Server Side Controls
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.1
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 6.5.4
[23] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 6.5.8
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.8
[25] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.8
[26] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.8
[27] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.8
[28] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[29] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 5.4 - Authentication and Access Control
[30] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 5.4 - Authentication and Access Control
[31] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 5.4 - Authentication and Access Control, Control Objective C.2.3 - Web Software Access Controls
[32] Standards Mapping - SANS Top 25 2009 Risky Resource Management - CWE ID 073
[33] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002560 CAT I
[34] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002560 CAT I
[35] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002560 CAT I
[36] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002560 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002560 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002560 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002560 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002560 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002560 CAT I
[42] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002560 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002560 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002560 CAT I
[45] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002560 CAT I
[46] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002560 CAT I
[47] Standards Mapping - Web Application Security Consortium Version 2.00 URL Redirector Abuse (WASC-38)
desc.dataflow.python.file_disclosure_django
Abstract
사용자 입력으로 서버 쪽 리디렉션 경로를 생성하면 공격자는 응용 프로그램 바이너리(응용 프로그램 클래스 또는 jar 파일 포함)를 다운로드하거나 보호할 수 있는 디렉터리 내 임의의 파일을 볼 수 있습니다.
Explanation
다음과 같은 경우 파일 공개가 발생합니다.
1. 신뢰할 수 없는 소스에서 데이터가 프로그램에 입력됩니다.


2. 데이터를 사용하여 경로를 동적으로 생성합니다.

예제 1: 다음 코드는 신뢰할 수 없는 데이터를 취하고 이를 사용하여 서버 쪽 전달에 사용되는 경로를 빌드합니다.


...
String returnURL = request.getParameter("returnURL");
RequestDispatcher rd = request.getRequestDispatcher(returnURL);
rd.forward();
...
예제 2: 다음 코드는 신뢰할 수 없는 데이터를 취하고 이를 사용하여 서버 쪽 전달에 사용되는 경로를 빌드합니다.


...
<% String returnURL = request.getParameter("returnURL"); %>
<jsp:include page="<%=returnURL%>" />
...



공격자가 민감한 파일 위치와 일치하는 요청 매개 변수를 URL에 제공한 경우, 해당 파일을 볼 수 있습니다. 예를 들어 "http://www.yourcorp.com/webApp/logic?returnURL=WEB-INF/applicationContext.xml"에서 응용 프로그램의 applicationContext.xml을 볼 수 있습니다.
공격자는 applicationContext.xml을 확보한 후 applicationContext.xml 또는 클래스나 jar 파일에서 참조된 다른 구성 파일을 찾아 다운로드할 수 있습니다. 그러면 공격자는 응용 프로그램에 대한 민감한 정보를 얻고 해당 정보를 대상으로 다른 유형의 공격을 할 수 있습니다.
References
[1] Ryan Berg and Dinis Cruz Two Security Vulnerabilities in the Spring Framework's MVC
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 4
[3] Standards Mapping - CIS Microsoft Azure Foundations Benchmark complete
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 4.1
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 1
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[7] Standards Mapping - CIS Kubernetes Benchmark partial
[8] Standards Mapping - Common Weakness Enumeration CWE ID 552
[9] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-002754
[10] Standards Mapping - General Data Protection Regulation (GDPR) Access Violation
[11] Standards Mapping - NIST Special Publication 800-53 Revision 4 SI-10 Information Input Validation (P1)
[12] Standards Mapping - NIST Special Publication 800-53 Revision 5 SI-10 Information Input Validation
[13] Standards Mapping - OWASP Top 10 2004 A1 Unvalidated Input
[14] Standards Mapping - OWASP Top 10 2007 A4 Insecure Direct Object Reference
[15] Standards Mapping - OWASP Top 10 2010 A4 Insecure Direct Object References
[16] Standards Mapping - OWASP Top 10 2013 A4 Insecure Direct Object References
[17] Standards Mapping - OWASP Top 10 2017 A5 Broken Access Control
[18] Standards Mapping - OWASP Top 10 2021 A01 Broken Access Control
[19] Standards Mapping - OWASP API 2023 API1 Broken Object Level Authorization
[20] Standards Mapping - OWASP Application Security Verification Standard 4.0 1.12.1 Secure File Upload Architectural Requirements (L2 L3), 12.5.1 File Download Requirements (L1 L2 L3)
[21] Standards Mapping - OWASP Mobile 2014 M1 Weak Server Side Controls
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.1
[23] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 6.5.4
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 6.5.8
[25] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.8
[26] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.8
[27] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.8
[28] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.8
[29] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[30] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 5.4 - Authentication and Access Control
[31] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 5.4 - Authentication and Access Control
[32] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 5.4 - Authentication and Access Control, Control Objective C.2.3 - Web Software Access Controls
[33] Standards Mapping - SANS Top 25 2009 Risky Resource Management - CWE ID 073
[34] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002560 CAT I
[35] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002560 CAT I
[36] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002560 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002560 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002560 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002560 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002560 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002560 CAT I
[42] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002560 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002560 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002560 CAT I
[45] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002560 CAT I
[46] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002560 CAT I
[47] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002560 CAT I
[48] Standards Mapping - Web Application Security Consortium Version 2.00 URL Redirector Abuse (WASC-38)
desc.dataflow.java.file_disclosure_j2ee