目标达成 感谢每一位支持者 — 我们达成了 100% 目标!

目标: 1000 元 · 已筹: 1336

100%

CWE-470 使用外部可控制的输入来选择类或代码(不安全的反射) 类漏洞列表 68

CWE-470 使用外部可控制的输入来选择类或代码(不安全的反射) 类弱点 68 条 CVE 漏洞汇总,含 AI 中文分析。

CWE-470 属于不安全反射漏洞,指程序利用外部输入通过反射机制动态选择类或方法,却未对输入进行充分校验。攻击者可构造恶意输入,诱导系统实例化非预期类或调用危险方法,从而执行任意代码或导致拒绝服务。开发者应避免直接信任外部输入,需实施严格的白名单验证机制,限制可反射的类范围,并采用安全的替代方案以消除动态加载风险。

MITRE CWE 官方描述
CWE:CWE-470 使用外部控制的输入来选择类或代码('不安全的反射') 英文:该产品使用带有反射的外部输入来选择要使用的类或代码,但它未能充分防止输入选择不当的类或代码。 如果产品使用外部输入来确定要实例化的类或要调用的方法,那么攻击者可以提供值来选择非预期的类或方法。如果发生这种情况,攻击者可以创建开发者未预期的控制流路径。这些路径可能会绕过身份验证或访问控制检查,或以其他方式导致产品以非预期的方式运行。如果攻击者能够将文件上传到出现在产品的类路径(CWE-427)中的位置,或者向产品的类路径(CWE-426)添加新条目,则这种情况将演变为一种灾难性场景。在这两种情况下,攻击者都可以使用反射向产品引入新的恶意行为。
常见影响 (3)
Integrity, Confidentiality, Availability, Other Execute Unauthorized Code or Commands, Alter Execution Logic
The attacker might be able to execute code that is not directly accessible to the attacker. Alternately, the attacker could call unexpected code in the wrong place or the wrong time, possibly modifying critical system state.
Availability, Other DoS: Crash, Exit, or Restart, Other
The attacker might be able to use reflection to call the wrong code, possibly with unexpected arguments that violate the API (CWE-227). This could cause the product to exit or hang.
Confidentiality Read Application Data
By causing the wrong code to be invoked, the attacker might be able to trigger a runtime error that leaks sensitive information in the error message, such as CWE-536.
缓解措施 (3)
Architecture and Design Refactor your code to avoid using reflection.
Architecture and Design Do not use user-controlled inputs to select and load classes or code.
Implementation Apply strict input validation by using allowlists or indirect selection to ensure that the user is only selecting allowable classes or code.
代码示例 (1)
A common reason that programmers use the reflection API is to implement their own command dispatcher. The following example shows a command dispatcher that does not use reflection:
String ctl = request.getParameter("ctl"); Worker ao = null; if (ctl.equals("Add")) { ao = new AddCommand(); } else if (ctl.equals("Modify")) { ao = new ModifyCommand(); } else { throw new UnknownActionError(); } ao.doAction(request);
Good · Java
String ctl = request.getParameter("ctl"); Class cmdClass = Class.forName(ctl + "Command"); Worker ao = (Worker) cmdClass.newInstance(); ao.doAction(request);
Bad · Java
CVE ID 标题 CVSS 风险等级 Published
CVE-2024-0200 GitHub Enterprise Server 安全漏洞 — Enterprise Server 7.2 High 2024-01-16
CVE-2023-32217 IdentityIQ 安全漏洞 — IdentityIQ 9.0 Critical 2023-05-31
CVE-2023-0460 Alphabet YouTube Embedded 安全漏洞 — YouTube Android Player API SDK 5.1 Medium 2023-03-01
CVE-2022-41853 HSQLDB 安全漏洞 — hsqldb 8.0 High 2022-10-06
CVE-2022-23744 Check Point Endpoint Security Client 安全漏洞 — Enterprise Endpoint Security Windows Clients. 3.4 - 2022-07-07
CVE-2020-7857 Tobesoft Xplatform 输入验证错误漏洞 — XPlatform 7.5 High 2021-04-20
CVE-2019-10174 Red Hat Infinispan 安全漏洞 — infinispan 9.1 - 2019-11-25
CVE-2019-3834 Red Hat JBoss Operations Network 安全漏洞 — struts 8.6 - 2019-10-03

CWE-470(使用外部可控制的输入来选择类或代码(不安全的反射)) 是常见的弱点类别,本平台收录该类弱点关联的 68 条 CVE 漏洞。