CVE-2024-12970 描述了 Pardus 操作系统 My Computer 软件中的一个 OS 命令注入漏洞。该漏洞允许用户通过文件名参数注入系统命令,从而使攻击者能够在系统上执行恶意命令。
该漏洞存在于 Pardus My Computer 软件 0.7.2 版本之前的版本中。
漏洞存在于 get_file_info 函数中。该函数使用 subprocess 调用来获取用户提供的磁盘信息。然而,由于该调用中的文件路径参数(file)未经过正确验证,因此通过用户提供的磁盘名称导致了 OS 命令注入漏洞。
函数:
def get_file_info(file, network=False):
if network:
try:
process = subprocess.check_output(f"df '{file}' --block-size=1000 -T | awk 'NR==1 {{next}} {{print $1,$2,$3,$4,$5,$7; exit}}'", shell=True, timeout=1)
except subprocess.TimeoutExpired:
print("timeout error on {}".format(file))
return None
该漏洞基于 file 参数由用户提供,并直接用于 subprocess.check_output() 函数。用户可以向 file 参数传入自己选择的磁盘名称,该磁盘名称会直接在 shell 命令中使用。这使用户能够进行命令注入。
示例漏洞参数行:
process = subprocess.check_output(f"df '{file}' --block-size=1000 -T | awk 'NR==1 {{next}} {{print $1,$2,$3,$4,$5,$7; exit}}'", shell=True)
为了利用该漏洞,攻击者可以在其挂载的磁盘名称中放置如下恶意 payload:
&' <çalıştırılmak istenen shell komutu> #
当具有该名称的磁盘通过 Pardus My Computer 挂载时,exploit 即会执行。