CWE-426:不受信任的搜索路径
View customized information:
This might allow attackers to execute their own programs, access unauthorized data files, or modify configuration in unexpected ways. If the product uses a search path to locate critical resources such as programs, then an attacker could modify that search path to point to a malicious program, which the targeted product would then execute. The problem extends to any type of critical resource that the product trusts. 不受信任的搜索路径的一些最常见的变体是:
![]() ![]()
![]() ![]()
![]() ![]()
![]() ![]()
![]()
![]() 语言 Class: Not Language-Specific(Undetermined Prevalence) 操作系统 班级:不是特定于操作系统的(Undetermined Prevalence) ![]()
示例1 该程序旨在执行命令列出限制目录的内容,然后执行其他操作的命令。假设它具有setuid特权运行,以绕过操作系统的权限检查。
(bad code)
示例语言:C
#define dir“/限制/目录”
char cmd [500]; Sprintf(CMD,“ LS -L%480S”,DIR); /*将特权提高到访问DIR所需的特权。*/ Raiseprivileges(...); system(cmd); Dropprivileges(...); ... This code may look harmless at first, since both the directory and the command are set to fixed values that the attacker can't control. The attacker can only see the contents for DIR, which is the intended program behavior. Finally, the programmer is also careful to limit the code that executes with raised privileges. 但是,由于该程序不会修改路径环境变量,因此以下攻击将起作用:
(攻击代码)
示例2 该代码打印所有属于当前用户的运行过程。
(bad code)
示例语言:php
//assume getCurrentUser() returns a username that is guaranteed to be alphanumeric (avoidingCWE-78) $ username = getCurrentuser(); $ command ='PS Aux |格雷普'。$ username; 系统($命令); 如果由未经授权的Web用户调用,它将提供有关基础系统的潜在敏感信息的网页,例如命令行参数(CWE-497)。This program is also potentially vulnerable to a PATH based attack (CWE-426),作为攻击者可能能够创建PS或GREP命令的恶意版本。尽管该程序没有明确提高运行系统命令的特权,但默认情况下,PHP解释器可能比用户更高的特权运行。 示例3 The following code is from a web application that allows users access to an interface through which they can update their password on the system. In this environment, user passwords can be managed using the Network Information System (NIS), which is commonly used on UNIX systems. When performing NIS updates, part of the process for updating passwords is to run a make command in the /var/yp directory. Performing NIS updates requires extra privileges.
(bad code)
示例语言:爪哇
...
system.runtime.getRuntime()。exec(“ make”); ... 这里的问题在于,该程序在执行call to Runtime.exec()之前没有指定制造和清洁其环境的绝对路径。如果攻击者可以修改$路径变量,以指向称为Make的恶意二进制,并导致该程序在其环境中执行,则将加载恶意二进制,而不是预期的。由于应用程序的性质,它具有执行系统操作所需的特权,这意味着攻击者的制造现在将使用这些特权运行,可能使攻击者完全控制系统。
![]()
提供更多信息 - 请选择其他过滤器。
|
使用共同弱点枚举(CWE)和本网站的相关参考使用条款。CWEis sponsored by the美国国土安全部(DHS)Cybersecurity and Infrastructure Security Agency(CISA),由Homeland Security Systems Engineering and Development Institute(HSSEDI)由manbetx客户端首页(MITER)。版权所有©2006–2023,Miter Comanbetx客户端首页rporation。CWE,CWSS,CWRAF和CWE徽标是Miter Corporation的商标。manbetx客户端首页 |