界: API Abuse

API は、呼び出し元と呼び出し先の間のコントラクトです。最も一般的な API の不正使用の形態は、呼び出し元がこのコントラクトの終わりを守らないことによって発生します。たとえば、プログラムが chroot() を呼び出した後に chdir() を呼び出すのに失敗すると、アクティブなルート ディレクトリを安全に変更する方法を指定したコントラクトに違反することになります。ライブラリの悪用のもう 1 つの良い例は、呼び出し先が信頼できる DNS 情報を呼び出し元に返すことを期待することです。この場合、呼び出し元は、呼び出し先の API の動作 (戻り値が認証目的に使用できること) についてある種の仮定をすることで、呼び出し先の 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 はクラスローダーの作成、現在のクラスローダーの取得、コンテキストクラスローダーの設定、セキュリティマネージャの設定、新規セキュリティマネージャの設定、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