界: API Abuse

API は、呼び出し元と呼び出し先の間のコントラクトです。最も一般的な API の不正使用の形態は、呼び出し元がこのコントラクトの終わりを守らないことによって発生します。たとえば、プログラムが chroot() を呼び出した後に chdir() を呼び出すのに失敗すると、アクティブなルート ディレクトリを安全に変更する方法を指定したコントラクトに違反することになります。ライブラリの悪用のもう 1 つの良い例は、呼び出し先が信頼できる DNS 情報を呼び出し元に返すことを期待することです。この場合、呼び出し元は、呼び出し先の API の動作 (戻り値が認証目的に使用できること) についてある種の仮定をすることで、呼び出し先の API を悪用します。また、相手側から、呼び出し元と呼び出し先のコントラクトを違反することもできます。例えば、コーダーが SecureRandom をサブクラス化し、ランダムではない値を返した場合、コントラクトに違反することになります。

81 見つかった項目
脆弱性
Abstract
モデルクラスには必須の non-nullable プロパティがあるので、under-posting 攻撃の影響を受けやすいことが考えられます。
Explanation
必須の ([Required] 属性でマークされた) non-nullable プロパティを持つモデルクラスを使用すると、攻撃者から想定より少ないデータを含んでいるリクエストが送信された場合に問題を引き起こす可能性があります。

ASP.NET MVC フレームワークは、リクエストパラメータをモデルのプロパティにバインドしようとします。

モデルに必須の non-nullable パラメーターが含まれており、攻撃者がその必須パラメーターをリクエストで送信しない場合、つまり攻撃者が under-posting 攻撃を利用する場合、プロパティにはデフォルト値 (通常はゼロ) が与えられ、[Required] 検証属性を満たします。この場合、アプリケーションが不測の挙動を起こします。

次のコードで定義されるモデルクラス例には、non-nullable の必須 enum が含まれています。


public enum ArgumentOptions
{
OptionA = 1,
OptionB = 2
}

public class Model
{
[Required]
public String Argument { get; set; }

[Required]
public ArgumentOptions Rounding { get; set; }
}
References
[1] Input Validation vs. Model Validation in ASP.NET MVC
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 3
[3] Standards Mapping - CIS Microsoft Azure Foundations Benchmark complete
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 4
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 3
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark integrity
[7] Standards Mapping - CIS Kubernetes Benchmark partial
[8] Standards Mapping - Common Weakness Enumeration CWE ID 345
[9] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-002422
[10] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-8 Transmission Confidentiality and Integrity (P1)
[11] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-8 Transmission Confidentiality and Integrity
[12] Standards Mapping - OWASP Top 10 2004 A1 Unvalidated Input
[13] Standards Mapping - OWASP Top 10 2007 A2 Injection Flaws
[14] Standards Mapping - OWASP Top 10 2010 A1 Injection
[15] Standards Mapping - OWASP Top 10 2013 A1 Injection
[16] Standards Mapping - OWASP Top 10 2017 A1 Injection
[17] Standards Mapping - OWASP Top 10 2021 A03 Injection
[18] Standards Mapping - OWASP API 2023 API3 Broken Object Property Level Authorization
[19] Standards Mapping - OWASP Application Security Verification Standard 4.0 3.5.3 Token-based Session Management (L2 L3), 13.2.6 RESTful Web Service Verification Requirements (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.6
[22] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002470 CAT II
[23] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002470 CAT II
[24] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002470 CAT II
[25] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002470 CAT II
[26] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002470 CAT II
[27] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002470 CAT II
[28] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002470 CAT II
[29] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002470 CAT II
[30] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002470 CAT II
[31] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002470 CAT II
[32] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002470 CAT II
[33] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002470 CAT II
[34] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002470 CAT II
[35] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002470 CAT II
[36] Standards Mapping - Web Application Security Consortium Version 2.00 Improper Input Handling (WASC-20)
desc.structural.dotnet.aspnet_mvc_bad_practices_required_non_nullable_in_model
Abstract
モデルクラスには必須のプロパティが含まれており、そのタイプは親モデルタイプのオプションメンバーなので、under-posting 攻撃の影響を受けやすいことが考えられます。
Explanation
モデルクラスに必須のプロパティが含まれており、そのタイプが親モデルクラスのオプションメンバーの場合、攻撃者が想定より少ない量のデータを含んでいるリクエストを送信すると under-posting 攻撃の影響を受ける可能性があります。

ASP.NET MVC フレームワークは、サブモデルを含むモデルのプロパティにリクエストパラメータをバインドしようとします。

サブモデルがオプションの場合、つまり親モデルに [Required] 属性なしのプロパティが含まれる場合、攻撃者がそのサブモデルを送信しないと、親プロパティには null 値が与えられ、子モデルの必須フィールドはモデル検証によってアサートされません。これは under-posting 攻撃の 1 つの形態です。

以下のモデルクラス定義を考慮してください。


public class ChildModel
{
public ChildModel()
{
}

[Required]
public String RequiredProperty { get; set; }
}

public class ParentModel
{
public ParentModel()
{
}

public ChildModel Child { get; set; }
}


攻撃者が ParentModel.Child プロパティの値を送信しない場合、ChildModel.RequiredProperty プロパティにはアサートされない [Required] が与えられます。この場合、問題となる不測の結果が生じる可能性があります。
References
[1] Input Validation vs. Model Validation in ASP.NET MVC
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 3
[3] Standards Mapping - CIS Microsoft Azure Foundations Benchmark complete
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 4
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 3
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark integrity
[7] Standards Mapping - CIS Kubernetes Benchmark partial
[8] Standards Mapping - Common Weakness Enumeration CWE ID 345
[9] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-002422
[10] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-8 Transmission Confidentiality and Integrity (P1)
[11] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-8 Transmission Confidentiality and Integrity
[12] Standards Mapping - OWASP Top 10 2004 A1 Unvalidated Input
[13] Standards Mapping - OWASP Top 10 2007 A2 Injection Flaws
[14] Standards Mapping - OWASP Top 10 2010 A1 Injection
[15] Standards Mapping - OWASP Top 10 2013 A1 Injection
[16] Standards Mapping - OWASP Top 10 2017 A1 Injection
[17] Standards Mapping - OWASP Top 10 2021 A03 Injection
[18] Standards Mapping - OWASP API 2023 API3 Broken Object Property Level Authorization
[19] Standards Mapping - OWASP Application Security Verification Standard 4.0 3.5.3 Token-based Session Management (L2 L3), 13.2.6 RESTful Web Service Verification Requirements (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.6
[22] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002470 CAT II
[23] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002470 CAT II
[24] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002470 CAT II
[25] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002470 CAT II
[26] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002470 CAT II
[27] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002470 CAT II
[28] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002470 CAT II
[29] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002470 CAT II
[30] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002470 CAT II
[31] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002470 CAT II
[32] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002470 CAT II
[33] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002470 CAT II
[34] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002470 CAT II
[35] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002470 CAT II
[36] Standards Mapping - Web Application Security Consortium Version 2.00 Improper Input Handling (WASC-20)
desc.structural.dotnet.aspnet_mvc_bad_practices_optional_submodel_with_required_property
Abstract
アプリケーションは、理由を示すことなく、ユーザーにフィンガープリントの入力を求めます。
Explanation
Apple のポリシーによると、アプリケーションは常にフィンガープリントが必要な理由をユーザーに説明する必要があります。説明しない場合、ユーザーが混乱したり、AppStore からアプリケーションを拒否する可能性があります。

例 1: 次のコードでは、タッチ ID を使用してユーザーを認証しますが、なぜ認証が必要か説明するローカライズされた理由を示すことができません。


[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:nil
reply:^(BOOL success, NSError *error) {
if (success) {
NSLog(@"Auth was OK");
}
}];
References
[1] David Thiel iOS Application Security: The Definitive Guide for Hackers and Developers No Starch Press
[2] Keychain and Authentication with Touch ID Apple
[3] https://developer.apple.com/reference/localauthentication/lacontext Apple
[4] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1
[5] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 4
[6] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 3
[7] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[8] Standards Mapping - General Data Protection Regulation (GDPR) Indirect Access to Sensitive Data
[9] Standards Mapping - OWASP Mobile 2024 M3 Insecure Authentication/Authorization
[10] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-AUTH-1, MASVS-AUTH-2
desc.structural.objc.biometric_authentication_missing_operation_message
Abstract
アプリケーションは、理由を示すことなく、ユーザーにフィンガープリントの入力を求めます。
Explanation
Apple のポリシーによると、アプリケーションは常にフィンガープリントが必要な理由をユーザーに説明する必要があります。説明しない場合、ユーザーが混乱したり、AppStore からアプリケーションを拒否する可能性があります。

例 1: 次のコードでは、タッチ ID を使用してユーザーを認証しますが、なぜ認証が必要か説明するローカライズされた理由を示すことができません。


context.evaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, localizedReason: "", reply: { (success, error) -> Void in
if (success) {
print("Auth was OK");
}
else {
print("Error received: %d", error!);
}
})
References
[1] David Thiel iOS Application Security: The Definitive Guide for Hackers and Developers No Starch Press
[2] Keychain and Authentication with Touch ID Apple
[3] https://developer.apple.com/reference/localauthentication/lacontext Apple
[4] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1
[5] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 4
[6] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 3
[7] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[8] Standards Mapping - General Data Protection Regulation (GDPR) Indirect Access to Sensitive Data
[9] Standards Mapping - OWASP Mobile 2024 M3 Insecure Authentication/Authorization
[10] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-AUTH-1, MASVS-AUTH-2
desc.structural.swift.biometric_authentication_missing_operation_message
Abstract
読み取り専用ではない Castor クエリにより、パフォーマンスが低下する可能性があります。
Explanation
Castor がオブジェクトをロックしていても、他のスレッドによりオブジェクトが読み取られたり書き込まれたりする可能性があります。読み取り専用のクエリは、デフォルトの共有モードと比較して、約 7 倍処理が早くなります。

例 1: 次の例では、クエリモードが SHARED に指定されており、読み取りアクセスと書き込みアクセスの両方が許可されています。

results = query.execute(Database.SHARED);
References
[1] ExoLab Group Castor JDO - Best practice
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1
[3] Standards Mapping - CIS Microsoft Azure Foundations Benchmark partial
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 4
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 1
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark integrity
[7] Standards Mapping - Common Weakness Enumeration CWE ID 265
[8] Standards Mapping - OWASP Application Security Verification Standard 4.0 1.14.5 Configuration Architectural Requirements (L2 L3)
[9] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 7.1.1
[10] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 7.1.1
[11] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 7.1.2
[12] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 7.1.2
[13] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 7.1.2
[14] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 7.1.2
[15] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 7.2.2
[16] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 5.4 - Authentication and Access Control
[17] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 5.4 - Authentication and Access Control
[18] 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
[19] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3500 CAT II
[20] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3500 CAT II
[21] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3500 CAT II
[22] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3500 CAT II
[23] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3500 CAT II
[24] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3500 CAT II
[25] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3500 CAT II
desc.structural.java.castor_bad_practices_query_mode_not_read_only
Abstract
Castor クエリは、明示的にクエリモードを定義していません。
Explanation
デフォルトでは、Castor は共有モードでクエリを実行します。共有モードでは、読み取りアクセスと書き取りアクセスの両方が許可されるため、目的とするクエリ操作の種類が不明瞭となります。オブジェクトが読み取り専用で使用される場合には、不要なパフォーマンス負荷がかかることになります。

例 1: 次の例では、クエリモードが指定されていません。

results = query.execute(); //missing query mode
References
[1] ExoLab Group Castor JDO - Best practice
[2] ExoLab Group, Intalio Inc., and Contributors Database (Castor JavaDoc)
[3] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1
[4] Standards Mapping - CIS Microsoft Azure Foundations Benchmark partial
[5] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 3
[6] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 1
[7] Standards Mapping - CIS Google Kubernetes Engine Benchmark integrity
[8] Standards Mapping - Common Weakness Enumeration CWE ID 265
[9] Standards Mapping - OWASP Application Security Verification Standard 4.0 1.14.5 Configuration Architectural Requirements (L2 L3)
[10] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 7.1.1
[11] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 7.1.1
[12] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 7.1.2
[13] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 7.1.2
[14] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 7.1.2
[15] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 7.1.2
[16] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 7.2.2
[17] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 5.4 - Authentication and Access Control
[18] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 5.4 - Authentication and Access Control
[19] 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
[20] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3500 CAT II
[21] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3500 CAT II
[22] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3500 CAT II
[23] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3500 CAT II
[24] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3500 CAT II
[25] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3500 CAT II
[26] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3500 CAT II
desc.semantic.java.castor_bad_practices_unspecified_query_mode
Abstract
ガーベジコレクションへの明示的なリクエストは、性能に関する問題が発生する可能性を示します。
Explanation
.NET 開発者であれば誰でも、ある段階で、ガーベジコレクタのせいであるとしか考えられない、デバッグにおいて不可解で不明な問題が発生することを経験します。特に、Time and State に関連したバグである場合、この理論を裏付ける実証的証拠が存在する可能性があります。GC.Collect() のコールを挿入することで問題が解消するかのように思える場合があります。

これまでの経験上、GC.Collect() をコールするという方法は間違っていることがほとんどです。なぜなら、GC.Collect() のコールを頻繁に呼び出すと、性能の問題が引き起こされる可能性があるからです。
References
[1] Scott Holden The perils of GC.Collect()
[2] Rico Mariani Performance Tidbits
[3] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 1
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[7] Standards Mapping - Common Weakness Enumeration CWE ID 730
[8] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001094
[9] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-5 Denial of Service Protection (P1)
[10] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-5 Denial of Service Protection
[11] Standards Mapping - OWASP Top 10 2004 A9 Application Denial of Service
[12] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.9
[13] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP6080 CAT II
[14] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP6080 CAT II
[15] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP6080 CAT II
[16] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP6080 CAT II
[17] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP6080 CAT II
[18] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP6080 CAT II
[19] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP6080 CAT II
[20] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002400 CAT II
[21] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002400 CAT II
[22] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002400 CAT II
[23] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002400 CAT II
[24] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002400 CAT II
[25] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002400 CAT II
[26] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002400 CAT II
[27] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002400 CAT II
[28] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002400 CAT II
[29] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002400 CAT II
[30] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002400 CAT II
[31] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002400 CAT II
[32] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002400 CAT II
[33] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002400 CAT II
[34] Standards Mapping - Web Application Security Consortium Version 2.00 Denial of Service (WASC-10)
[35] Standards Mapping - Web Application Security Consortium 24 + 2 Denial of Service
desc.structural.dotnet.code_correctness_call_to_gc_collect
Abstract
ガーベジコレクションへの明示的なリクエストは、性能に関する問題が発生する可能性を示します。
Explanation
Java 開発者であれば誰でもある段階で、ガーベジコレクタが原因であるとしか考えられない、デバッグに際して不可解で得体の知れない問題を経験するものです。特に、Time and State に関連したバグである場合、この理論を裏付ける実証的証拠が存在する可能性があります。System.gc() のコールを挿入することで問題が解消するかのように思える場合があります。

これまでの経験上、System.gc() をコールするという方法は間違っていることがほとんどです。なぜなら、System.gc() のコールを頻繁に呼び出すと、性能の問題が引き起こされる可能性があるからです。
References
[1] D. H. Hovermeyer FindBugs User Manual
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1
[3] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5
[4] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 1
[5] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[6] Standards Mapping - Common Weakness Enumeration CWE ID 730
[7] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001094
[8] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-5 Denial of Service Protection (P1)
[9] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-5 Denial of Service Protection
[10] Standards Mapping - OWASP Top 10 2004 A9 Application Denial of Service
[11] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.9
[12] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP6080 CAT II
[13] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP6080 CAT II
[14] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP6080 CAT II
[15] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP6080 CAT II
[16] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP6080 CAT II
[17] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP6080 CAT II
[18] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP6080 CAT II
[19] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002400 CAT II
[20] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002400 CAT II
[21] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002400 CAT II
[22] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002400 CAT II
[23] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002400 CAT II
[24] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002400 CAT II
[25] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002400 CAT II
[26] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002400 CAT II
[27] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002400 CAT II
[28] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002400 CAT II
[29] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002400 CAT II
[30] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002400 CAT II
[31] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002400 CAT II
[32] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002400 CAT II
[33] Standards Mapping - Web Application Security Consortium Version 2.00 Denial of Service (WASC-10)
[34] Standards Mapping - Web Application Security Consortium 24 + 2 Denial of Service
desc.structural.java.code_correctness_call_to_system_gc